Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/13 13:40:43 (11 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/Content
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.controller.js

    r9324 r9395  
    11var OAAS_CONTROLLER = (function (my, Backbone, OAAS_VIEW, OAAS_MODEL, _, $) {
     2    my.JobVisualExtensionListener = function (model, element) {
     3        var extension = new OAAS_MODEL.VisualExtension({ id: model.get('algorithmName') });
     4        extension.fetch({ cache: true, success: function () {
     5            //eval extension.js -> execute addVisualExtension(model, element):
     6            var js = extension.get('ScenarioJs');
     7            if (js != null) {
     8                (function (model, element) {
     9                    addExtension = undefined;
     10                    eval(js);
     11                    if (addExtension)
     12                        addExtension(model, element);
     13                } (model, element));
     14            }
     15        }
     16        });
     17    },
    218    my.JobPageController = function () {
    319        this.create = function () {
     
    2339                    var div = $('<div/>').appendTo($('#jobDetails'));
    2440                    var rv = new OAAS_VIEW.ResultView({ model: runList, el: div });
     41                    listener.listenTo(rv, 'renderVisualExtension', my.JobVisualExtensionListener);
    2542                    rv.render();
    2643                    var av = new OAAS_VIEW.AccordionView({ el: div });
     
    3047            });
    3148
     49
     50
    3251            jobList.poll();
    3352        }
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.model.js

    r9362 r9395  
    7777    });
    7878
     79    my.VisualExtension = Backbone.Model.extend({
     80        defaults: {
     81            id: null,
     82            js: null
     83        },
     84        url: function () {
     85            return '/Job/VisualExtension?scenarioId=' + this.get('id');
     86        }
     87    });
     88
    7989    return my;
    8090} (OAAS_MODEL || {}, Backbone));
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.view.js

    r9350 r9395  
    9090                $('<h3></h3>').text(this.model.models[i].get('name')).appendTo(this.$el);
    9191                var rev = new my.ResultEntryView({ model: this.model.models[i], el: this.$el });
    92                 rev.render();
    93             }
     92                this.listenTo(rev, 'renderVisualExtension', this.renderVisualExtension);
     93                rev.render();                         
     94            }           
     95        },
     96        renderVisualExtension: function(model, element) {
     97            // propagate to client listener
     98            this.trigger('renderVisualExtension', model, element);
    9499        }
    95100    });
     
    161166            var results = this.model.get('results');
    162167            for (var i = 0; i < results.length; i++) {
    163                 this.renderModelEntry(results[i], i, body, 'results');
    164             }
     168                this.renderModelEntry(results[i], i, body, 'results');               
     169            }
     170            // get the visual extension, execute it!
     171            this.trigger('renderVisualExtension', this.model, body);
    165172
    166173            var inputs = this.model.get('params');
Note: See TracChangeset for help on using the changeset viewer.