-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1118 from StochSS/presentation-system
Presentation System
- Loading branch information
Showing
40 changed files
with
1,863 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
StochSS is a platform for simulating biochemical systems | ||
Copyright (C) 2019-2021 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'); | ||
let path = require('path'); | ||
let domReady = require('domready'); | ||
let bootstrap = require('bootstrap'); | ||
//support files | ||
let app = require("../app"); | ||
//models | ||
let Job = require("../models/job"); | ||
//views | ||
let PageView = require('./base'); | ||
let ModelView = require('../views/model-viewer'); | ||
let ResultsView = require('../views/workflow-results'); | ||
let SettingsView = require('../views/settings-viewer'); | ||
//templates | ||
let template = require('../templates/pages/jobPresentation.pug'); | ||
|
||
import bootstrapStyles from '../styles/bootstrap.css'; | ||
import styles from '../styles/styles.css'; | ||
import fontawesomeStyles from '@fortawesome/fontawesome-free/css/svg-with-js.min.css' | ||
|
||
let JobPresentationPage = PageView.extend({ | ||
template: template, | ||
initialize: function () { | ||
PageView.prototype.initialize.apply(this, arguments); | ||
console.log("TODO: get the path to the job from the url") | ||
// let urlParams = new URLSearchParams(window.location.search) | ||
// this.model = new Job({ | ||
// directory: urlParams.get("path") | ||
// }); | ||
console.log("TODO: get job from file system using the app.getXHR function") | ||
// let self = this; | ||
// let queryStr = "?path=" + this.model.directory; | ||
// let endpoint = path.join(); | ||
// app.getXHR(endpoint, { | ||
// success: function (err, response, body) { | ||
// self.model.set(body); | ||
// self.model.type = body.titleType; | ||
// self.renderSubviews(); | ||
// } | ||
// }); | ||
console.log("TODO: generate the open link and store in this.open") | ||
}, | ||
renderSubviews: function () { | ||
PageView.prototype.render.apply(this, arguments); | ||
this.renderResultsContainer(); | ||
this.renderSettingsContainer(); | ||
this.renderModelContainer(); | ||
}, | ||
renderModelContainer: function () { | ||
let modelView = new ModelView({ | ||
model: this.model.model, | ||
mode: "presentation" | ||
}); | ||
app.registerRenderSubview(this, modelView, "job-model"); | ||
}, | ||
renderResultsContainer: function () { | ||
let resultsView = new ResultsView({ | ||
model: this.model, | ||
mode: "presentation" | ||
}); | ||
app.registerRenderSubview(this, resultsView, "job-results"); | ||
}, | ||
renderSettingsContainer: function () { | ||
let settingsView = new SettingsView({ | ||
model: this.model.settings, | ||
mode: "presentation" | ||
}); | ||
app.registerRenderSubview(this, settingsView, "job-settings"); | ||
} | ||
}); | ||
|
||
domReady(() => { | ||
let p = new JobPresentationPage({ | ||
el: document.body | ||
}); | ||
p.render(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
StochSS is a platform for simulating biochemical systems | ||
Copyright (C) 2019-2021 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'); | ||
let path = require('path'); | ||
let domReady = require('domready'); | ||
let bootstrap = require('bootstrap'); | ||
//support files | ||
let app = require('../app'); | ||
//models | ||
let Model = require('../models/model'); | ||
//views | ||
let PageView = require('./base'); | ||
let ModelView = require('../model-view/model-view'); | ||
//templates | ||
let template = require('../templates/pages/modelPresentation.pug'); | ||
|
||
import bootstrapStyles from '../styles/bootstrap.css'; | ||
import styles from '../styles/styles.css'; | ||
import fontawesomeStyles from '@fortawesome/fontawesome-free/css/svg-with-js.min.css' | ||
|
||
let ModelPresentationPage = PageView.extend({ | ||
template: template, | ||
initialize: function (attrs, options) { | ||
PageView.prototype.initialize.apply(this, arguments); | ||
let urlParams = new URLSearchParams(window.location.search); | ||
let owner = urlParams.get("owner"); | ||
let file = urlParams.get("file"); | ||
this.model = new Model({ | ||
directory: file, | ||
for: "presentation" | ||
}); | ||
let self = this; | ||
let queryStr = "?file=" + this.model.directory + "&owner=" + owner; | ||
let endpoint = "api/file/json-data" + queryStr; | ||
app.getXHR(endpoint, { | ||
success: function (err, response, body) { | ||
self.model.set(body); | ||
self.renderSubviews(); | ||
} | ||
}); | ||
let downloadStart = "https://live.stochss.org/stochss/download_presentation"; | ||
this.downloadLink = downloadStart + "/" + owner + "/" + file; | ||
this.openLink = "https://open.stochss.org?open=" + this.downloadLink; | ||
}, | ||
renderSubviews: function () { | ||
PageView.prototype.render.apply(this, arguments); | ||
this.renderModelView(); | ||
}, | ||
renderModelView: function () { | ||
let modelView = ModelView({ | ||
model: this.model, | ||
readOnly: true | ||
}); | ||
app.registerRenderSubview(this, modelView, "model-view"); | ||
} | ||
}); | ||
|
||
domReady(() => { | ||
let p = new ModelPresentationPage({ | ||
el: document.body | ||
}); | ||
p.render(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
StochSS is a platform for simulating biochemical systems | ||
Copyright (C) 2019-2021 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'); | ||
let path = require('path'); | ||
let domReady = require('domready'); | ||
let bootstrap = require('bootstrap'); | ||
//support files | ||
let app = require('../app'); | ||
//views | ||
let PageView = require('./base'); | ||
//templates | ||
let template = require('../templates/pages/notebookPresentation.pug'); | ||
|
||
import bootstrapStyles from '../styles/bootstrap.css'; | ||
import styles from '../styles/styles.css'; | ||
import fontawesomeStyles from '@fortawesome/fontawesome-free/css/svg-with-js.min.css' | ||
|
||
let NotebookPresentationPage = PageView.extend({ | ||
template: template, | ||
initialize: function (attrs, options) { | ||
PageView.prototype.initialize.apply(this, arguments); | ||
let urlParams = new URLSearchParams(window.location.search); | ||
let owner = urlParams.get("owner"); | ||
let file = urlParams.get("file"); | ||
let self = this; | ||
let queryStr = "?owner=" + owner + "&file=" + file; | ||
let endpoint = "api/notebook/load" + queryStr; | ||
app.getXHR(endpoint, { | ||
success: function (err, response, body) { | ||
self.name = body.file.split('/').pop().split('.ipynb')[0]; | ||
self.renderSubviews(body.html); | ||
} | ||
}); | ||
let downloadStart = "https://live.stochss.org/stochss/notebook/download_presentation"; | ||
this.downloadLink = downloadStart + "/" + owner + "/" + file; | ||
this.openLink = "https://open.stochss.org?open=" + this.downloadLink; | ||
}, | ||
renderSubviews: function (html) { | ||
PageView.prototype.render.apply(this, arguments); | ||
let iframe = document.getElementById('notebook'); | ||
let iframedoc = iframe.document; | ||
if (iframe.contentDocument) { | ||
iframedoc = iframe.contentDocument; | ||
}else if (iframe.contentWindow) { | ||
iframedoc = iframe.contentWindow.document; | ||
} | ||
if (iframedoc) { | ||
iframedoc.write(html); | ||
iframedoc.close(); | ||
} | ||
} | ||
}); | ||
|
||
domReady(() => { | ||
let p = new NotebookPresentationPage({ | ||
el: document.body | ||
}); | ||
p.render(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.