source: branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/JobController.cs @ 9324

Last change on this file since 9324 was 9324, checked in by fschoepp, 7 years ago

#1888:

  • DAL: Added a Delete method which deletes by experiment id.
  • HL DataTables will now be transposed and mapped as double[ROWS][COLUMNS] (transposed)
  • JS: Moved all classes into "modules" to prevent namespace pollution (using OAAS_MODEL for model classes, OAAS_VIEW for views and OAAS_CONTROLLER for controllers)
  • JS: Moved DatatypeMapper classes into Backbone views
  • JS: Models now correctly send DELETE requests
  • Added a new job overview page (which also renders run details) using AJAX
  • Using moment.min.js to format DateTime as string
  • Controllers now inherit from BaseController which provides a RedirectToLoginIfNecessary-method
  • Added loading animations to several AJAX bound places (loading experiments / scenarios)
  • Added a section to _Layout.cshtml which allows page-specific JavaScript includes (<script> only for a certain page)
  • Fixed Build/Edit of experiment menu redirecting to the wrong page
  • The Experiment Variation Dialog disables input fields, if the property has not been activated before
File size: 2.2 KB
Line 
1using System; 
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.Web.Mvc;
6using HeuristicLab.Services.Optimization.ControllerService.Parsers;
7using HeuristicLab.Services.Optimization.ControllerService.Model;
8using HeuristicLab.Services.Optimization.Web.Models;
9
10using System.Web.Security;
11
12namespace HeuristicLab.Services.Optimization.Web.Controllers
13{
14    [Authorize(Roles = "Web User")]
15    public class JobController : BaseController
16    {
17      //
18      // GET: /Job/   
19      public ActionResult Index() {
20        RedirectToLoginIfNecessary("%2fJob");
21        return View();
22      }
23
24      [HttpDelete]
25      public JsonResult Job(string jobId) {
26        var success = ControllerService.withControllerService<bool>((service) => {
27          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
28          return service.DeleteJob(u, jobId);
29        });
30        return Json(success, JsonRequestBehavior.DenyGet);
31      }
32
33      [HttpGet]
34      public JsonResult JobList() {
35        var jobs = ControllerService.withControllerService<IEnumerable<Job>>((service) => {
36          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
37          return service.GetJobs(u);
38        });
39        return Json(jobs, JsonRequestBehavior.AllowGet);
40      }
41
42      /*[HttpGet]
43      public JsonResult Job(string jobId) {
44        var job = ControllerService.withControllerService<Job>((service) => {
45          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
46          return service.GetJob(u, jobId);
47        });
48        return Json(job, JsonRequestBehavior.AllowGet);
49      }*/
50
51      [HttpGet]
52      public ActionResult RunList(string jobId) {
53        var runs = ControllerService.withControllerService<IList<Run>>((service) => {
54          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
55          return service.GetJobResults(u, jobId);
56        });
57        return Content(AlgorithmConverter.ConvertRunsToJson(runs).ToString(), "application/json", System.Text.Encoding.UTF8);
58      }
59    }
60}
Note: See TracBrowser for help on using the repository browser.