Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/13 13:40:43 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Added visual extensions (dynamic JavaScript) which will be used to render additional result parameters specific to scenarios (e. g. create a graphical representation of a TSP).
  • Added relationship between jobs and experiments (otherwise, it's not possible to get the job's experiment).
  • Updated Admin page to allow removal/addition of visual extensions.
  • Added back-end logic to store/retrieve/delete visual extensions.
  • Added visual extension functionality to the JavaScript views/controllers (job.*.js).
  • Added tsp.js which is a visual extension for the "Genetic Algorithm - TSP" scenario. It adds a graphical representation of the TSP (just like the C# version does) to the results.
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/AdminController.cs

    r9215 r9395  
    3434        public ActionResult Index()
    3535        {
    36           var names = ControllerService.withControllerService<IEnumerable<string>>((service) => {           
     36          var names = ControllerService.withControllerService<IEnumerable<ScenarioModel>>((service) => {           
    3737            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
    38             return service.GetOptimizationScenarioNames();
     38            var scenModel = new List<ScenarioModel>();
     39            var scenarios = service.GetOptimizationScenarioNames();
     40            foreach (var scenario in scenarios) {
     41              scenModel.Add(new ScenarioModel() { Exists = service.ExistsVisualExtension(scenario), Scenario = scenario });             
     42            }
     43            return scenModel;
    3944          });
    4045          return View(names);
     
    6570        }
    6671
     72        [HttpPost]
     73        public ActionResult AddVisualExtension(UploadVisualExtension extension) {         
     74          StreamReader reader = new StreamReader(extension.ScenarioJs.InputStream);
     75          string scenarioJs = reader.ReadToEnd();
     76
     77          var ok = ControllerService.withControllerService<bool>((service) => {
     78            OptimizationModel model = new OptimizationModel();
     79            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
     80            return service.AddVisualExtension(extension.ScenarioId, scenarioJs);
     81          });
     82          return RedirectToAction("Index");
     83        }
     84
     85        [HttpPost]
     86        public ActionResult DeleteVisualExtension(UploadVisualExtension extension) {
     87          var ok = ControllerService.withControllerService<bool>((service) => {
     88            OptimizationModel model = new OptimizationModel();
     89            User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
     90            return service.DeleteVisualExtension(extension.ScenarioId);
     91          });
     92          return RedirectToAction("Index");
     93        }
     94
    6795        public ActionResult DeleteScenario(string id) {
    6896          ControllerService.withControllerService<bool>((service) => {           
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/JobController.cs

    r9362 r9395  
    5959
    6060      [HttpGet]
    61       public ActionResult VisualExtension(string algorithmId) {
    62         var script = ControllerService.withControllerService<string>((service) => {
     61      public JsonResult VisualExtension(string scenarioId) {
     62        var extension = ControllerService.withControllerService<VisualExtension>((service) => {
    6363          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
    64           return service.GetVisualExtension(algorithmId);
     64          return service.GetVisualExtension(scenarioId);
    6565        });
    66         return Content(script, "text/javascript", System.Text.Encoding.UTF8);
     66        return Json(extension, JsonRequestBehavior.AllowGet);
    6767      }
    6868    }
Note: See TracChangeset for help on using the changeset viewer.