-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathjob-view.js
More file actions
94 lines (89 loc) · 3.18 KB
/
Copy pathjob-view.js
File metadata and controls
94 lines (89 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
StochSS is a platform for simulating biochemical systems
Copyright (C) 2019-2023 StochSS developers.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
let $ = require('jquery')
//support files
let app = require('../app');
//views
let View = require('ampersand-view');
let LogsView = require('./views/job-logs-view');
let ModelView = require('../model-view/model-view');
let ResultsView = require('./views/job-results-view');
let SettingsView = require('../settings-view/settings-view');
//templates
let template = require('./jobView.pug');
module.exports = View.extend({
template: template,
events: {
'click [data-hook=collapse-review-settings]' : 'changeCollapseButtonText',
'click [data-hook=collapse-model]' : 'changeCollapseButtonText'
},
initialize: function (attrs, options) {
View.prototype.initialize.apply(this, arguments);
this.readOnly = Boolean(attrs.readOnly) ? attrs.readOnly : false;
this.wkflName = attrs.wkflName;
this.titleType = attrs.titleType;
this.newFormat = attrs.newFormat;
this.settingsHeader = this.readOnly ? "Settings" : "Review Settings";
this.modelHeader = (this.readOnly ? "Model: " : "Review Model: ") + this.model.model.name;
this.domainPlot = attrs.domainPlot;
},
render: function (attrs, options) {
View.prototype.render.apply(this, arguments);
if(this.model.status === "complete") {
this.renderResultsView();
}
if(!this.readOnly && this.model.status !== "running") {
this.renderLogsView();
}
this.renderSettingsView();
this.renderModelView();
},
changeCollapseButtonText: function (e) {
app.changeCollapseButtonText(this, e);
},
renderLogsView: function () {
let logsView = new LogsView({
logs: this.model.logs
});
app.registerRenderSubview(this, logsView, "job-info-container");
},
renderModelView: function () {
let modelView = new ModelView({
model: this.model.model,
domainPlot: this.domainPlot,
readOnly: true
});
app.registerRenderSubview(this, modelView, "model-viewer-container");
},
renderResultsView: function () {
let resultsView = new ResultsView({
model: this.model,
readOnly: this.readOnly,
wkflName: this.wkflName,
titleType: this.titleType
});
app.registerRenderSubview(this, resultsView, "job-results-container");
},
renderSettingsView: function () {
let settingsView = new SettingsView({
model: this.model.settings,
newFormat: this.newFormat,
readOnly: true,
stochssModel: this.model.model,
type: this.titleType
});
app.registerRenderSubview(this, settingsView, "settings-viewer-container");
}
});