Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/StatusController.cs @ 9227

Last change on this file since 9227 was 9215, checked in by fschoepp, 12 years ago

#1888:

  • Janitor is now working as expected in Windows Azure
  • Added basic support for experiments (draggable experiments)
  • Added methods to save/read experiments from TableStorage
  • The job status can now be retrieved by using the GetTasks/GetTaskData methods
  • Added a class to convert JSON-objects to Algorithm instances
  • Web page: Added experiment button to navigation
File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.Web.Mvc;
6using HeuristicLab.Services.Optimization.Web.Models;
7using HeuristicLab.Services.Optimization.Web.Helpers;
8using System.Web.Security;
9using HeuristicLab.Services.Optimization.ControllerService.Model;
10
11namespace HeuristicLab.Services.Optimization.Web.Controllers
12{
13  public class StatusController : Controller {
14    private ControllerServiceHelper ControllerService {
15      get {
16        var helper = new ControllerServiceHelper(Session["pw"] as string);
17        if (!helper.Valid) {
18          Response.Redirect("/Account/Logon?ReturnUrl=%2fStatus");
19        }
20        return helper;
21      }
22    }
23
24    //
25    // GET: /Status/
26
27    public ActionResult Index() {
28      var statModel = ControllerService.withControllerService<StatusModel>((service) => {
29        var model = new StatusModel();
30        User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
31        model.Jobs = service.GetJobs(u).ToList();
32        return model;
33      });
34      return View(statModel);
35    }
36
37    [HttpGet]
38    public JsonResult GetTasks(string jobId) {     
39      var job = ControllerService.withControllerService<Job>((service) => {       
40        User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };       
41        return service.GetTasks(u, jobId);
42      });
43
44      return Json(job, JsonRequestBehavior.AllowGet);
45    }
46
47    [HttpGet]
48    public JsonResult GetTaskData(string jobId, string taskId) {
49      var t1 = ControllerService.withControllerService<Task>((service) => {
50        User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
51        return service.GetTaskData(u, jobId, taskId);
52      });
53      return Json(t1, JsonRequestBehavior.AllowGet);
54    }
55  }
56}
Note: See TracBrowser for help on using the repository browser.