- Timestamp:
- 04/24/13 13:40:43 (12 years ago)
- 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 1 1 var 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 }, 2 18 my.JobPageController = function () { 3 19 this.create = function () { … … 23 39 var div = $('<div/>').appendTo($('#jobDetails')); 24 40 var rv = new OAAS_VIEW.ResultView({ model: runList, el: div }); 41 listener.listenTo(rv, 'renderVisualExtension', my.JobVisualExtensionListener); 25 42 rv.render(); 26 43 var av = new OAAS_VIEW.AccordionView({ el: div }); … … 30 47 }); 31 48 49 50 32 51 jobList.poll(); 33 52 } -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.model.js
r9362 r9395 77 77 }); 78 78 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 79 89 return my; 80 90 } (OAAS_MODEL || {}, Backbone)); -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.view.js
r9350 r9395 90 90 $('<h3></h3>').text(this.model.models[i].get('name')).appendTo(this.$el); 91 91 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); 94 99 } 95 100 }); … … 161 166 var results = this.model.get('results'); 162 167 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); 165 172 166 173 var inputs = this.model.get('params');
Note: See TracChangeset
for help on using the changeset viewer.