Skip to content

Commit

Permalink
Merge pull request #1111 from StochSS/develop
Browse files Browse the repository at this point in the history
2.3.2 Release
  • Loading branch information
BryanRumsey authored Jun 1, 2021
2 parents cb3a544 + 02fa237 commit 4312a0e
Show file tree
Hide file tree
Showing 64 changed files with 2,249 additions and 97,027 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ stochss-model-editor.html
stochss-workflow-manager.html
stochss-workflow-selection.html
stochss-project-manager.html
multiple-plots-page.html
stochss-domain-editor.html
stochss-loading-page.html
stochss-project-browser.html
stochss-quick-start.html
stochss-user-home.html
*.swp
*.swo
package-lock.json
Expand Down
2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @website https://github.com/stochss/stochss
# =============================================================================

__version__ = '2.3'
__version__ = '2.3.2'
__title__ = 'StochSS'
__description__ = 'StochSS is an integrated development environment (IDE) \
for simulation of biochemical networks.'
Expand Down
9 changes: 9 additions & 0 deletions client/pages/domain-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,19 +669,28 @@ let DomainEditor = PageView.extend({
let projBC = $(this.queryByHook("grandparent-breadcrumb"));
projBC.text(breadData.project.name);
projBC.prop("href", breadData.project.href);
$(this.queryByHook("return-to-project")).prop("href", breadData.project.href);
let mdlBC = $(this.queryByHook("parent-two-breadcrumb"));
mdlBC.text(breadData.model.name);
mdlBC.prop("href", breadData.model.href);
$(this.queryByHook("return-to-model")).prop("href", breadData.model.href);
}else if(breadData.model || breadData.project) {
$(this.queryByHook("one-parent-breadcrumb-links")).css("display", "block");
let breadcrumb = $(this.queryByHook("parent-one-breadcrumb"));
if(breadData.project) {
breadcrumb.text(breadData.project.name)
breadcrumb.prop("href", breadData.project.href);
$(this.queryByHook("return-to-project")).prop("href", breadData.project.href);
$(this.queryByHook("return-to-model")).css("display", "none");
}else {
breadcrumb.text(breadData.model.name)
breadcrumb.prop("href", breadData.model.href);
$(this.queryByHook("return-to-project")).css("display", "none");
$(this.queryByHook("return-to-model")).prop("href", breadData.model.href);
}
}else{
$(this.queryByHook("return-to-model")).css("display", "none");
$(this.queryByHook("return-to-project")).css("display", "none");
}
this.renderDomainProperties();
this.renderDomainLimitations();
Expand Down
121 changes: 89 additions & 32 deletions client/pages/file-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ let FileBrowser = PageView.extend({
'click [data-hook=file-browser-help]' : function () {
let modal = $(modals.operationInfoModalHtml('file-browser')).modal();
},
'click [data-hook=empty-trash]' : 'emptyTrash'
},
initialize: function (attrs, options) {
PageView.prototype.initialize.apply(this, arguments)
Expand Down Expand Up @@ -78,7 +79,10 @@ let FileBrowser = PageView.extend({
if(op === 'move_node' && more && more.ref && more.ref.type && !(more.ref.type == 'folder' || more.ref.type == 'root')){
return false
}
if(op === 'move_node' && more && more.ref && more.ref.type && more.ref.type === 'folder'){
if(op === 'move_node' && more && more.ref && more.ref.original && path.dirname(more.ref.original._path).split("/").includes("trash")){
return false
}
if(op === 'move_node' && more && more.ref && more.ref.type && more.ref.type === 'folder' && more.ref.text !== "trash"){
if(!more.ref.state.loaded){
return false
}
Expand Down Expand Up @@ -110,6 +114,11 @@ let FileBrowser = PageView.extend({
node.original._path = path.join(newDir, file);
if(node.type === "folder") {
$('#models-jstree').jstree().refresh_node(node);
}else if(newDir.endsWith("trash")) {
$(self.queryByHook('empty-trash')).prop('disabled', false);
$('#models-jstree').jstree().refresh_node(par);
}else if(oldPath.split("/").includes("trash")) {
$('#models-jstree').jstree().refresh_node(par);
}
},
error: function (err, response, body) {
Expand Down Expand Up @@ -639,16 +648,9 @@ let FileBrowser = PageView.extend({
var endpoint = path.join(app.getApiPath(), "project/new-project")+"?path="+projectPath
app.getXHR(endpoint, {
success: function (err, response, body) {
if(o){//directory was created with context menu option
var node = $('#models-jstree').jstree().get_node(o);
if(node.type === "root"){
self.refreshJSTree();
}else{
$('#models-jstree').jstree().refresh_node(node);
}
}else{//directory was created with create directory button
self.refreshJSTree();
}
let queryStr = "?path=" + body.path;
let endpoint = path.join(app.getBasePath(), 'stochss/project/manager') + queryStr;
window.location.href = endpoint;
},
error: function (err, response, body) {
let errorModel = $(modals.newProjectOrWorkflowGroupErrorHtml(body.Reason, body.Message)).modal();
Expand Down Expand Up @@ -770,7 +772,6 @@ let FileBrowser = PageView.extend({
if(o && o.original && o.original.type !== "root"){
parentPath = o.original._path
}
console.log(parentPath)
if(isModel) {
let ext = isSpatial ? ".smdl" : ".mdl"
let modelName = o && o.type === "project" ? input.value.trim().split("/").pop() + ext : input.value.trim() + ext;
Expand Down Expand Up @@ -860,6 +861,43 @@ let FileBrowser = PageView.extend({
}
});
},
moveToTrash: function (o) {
if(document.querySelector('#moveToTrashConfirmModal')) {
document.querySelector('#moveToTrashConfirmModal').remove();
}
let self = this;
let modal = $(modals.moveToTrashConfirmHtml("model")).modal();
let yesBtn = document.querySelector('#moveToTrashConfirmModal .yes-modal-btn');
yesBtn.addEventListener('click', function (e) {
modal.modal('hide');
let queryStr = "?srcPath=" + o.original._path + "&dstPath=" + path.join("trash", o.text)
let endpoint = path.join(app.getApiPath(), "file/move") + queryStr
app.getXHR(endpoint, {
always: function (err, response, body) {
$(self.queryByHook('empty-trash')).prop('disabled', false);
$('#models-jstree').jstree().refresh();
}
});
});
},
emptyTrash: function (e) {
if(document.querySelector("#emptyTrashConfirmModal")) {
document.querySelector("#emptyTrashConfirmModal").remove()
}
let self = this;
let modal = $(modals.emptyTrashConfirmHtml()).modal();
let yesBtn = document.querySelector('#emptyTrashConfirmModal .yes-modal-btn');
yesBtn.addEventListener('click', function (e) {
modal.modal('hide');
let endpoint = path.join(app.getApiPath(), "file/empty-trash") + "?path=trash";
app.getXHR(endpoint, {
success: function (err, response, body) {
self.refreshJSTree();
$(self.queryByHook('empty-trash')).prop('disabled', true);
}
});
});
},
setupJstree: function () {
var self = this;
$.jstree.defaults.contextmenu.items = (o, cb) => {
Expand Down Expand Up @@ -905,6 +943,17 @@ let FileBrowser = PageView.extend({
self.duplicateFileOrDirectory(o, null)
}
},
"MoveToTrash" : {
"label" : "Move To Trash",
"_disabled" : false,
"separator_before" : false,
"separator_after" : false,
"action" : function (data) {
self.moveToTrash(o);
}
}
}
let delete_node = {
"Delete" : {
"label" : "Delete",
"_disabled" : false,
Expand Down Expand Up @@ -1268,6 +1317,12 @@ let FileBrowser = PageView.extend({
if (o.type === 'root'){
return folder
}
if (o.text === "trash") {
return {"Refresh": folder.Refresh}
}
if (o.original._path.split("/")[0] === "trash") {
return delete_node
}
if (o.type === 'folder') {
return $.extend(folder, common)
}
Expand Down Expand Up @@ -1326,26 +1381,28 @@ let FileBrowser = PageView.extend({
var file = e.target.text
var node = $('#models-jstree').jstree().get_node(e.target)
var _path = node.original._path;
if(file.endsWith('.mdl') || file.endsWith('.smdl')){
window.location.href = path.join(app.getBasePath(), "stochss/models/edit")+"?path="+_path;
}else if(file.endsWith('.ipynb')){
var notebookPath = path.join(app.getBasePath(), "notebooks", _path)
window.open(notebookPath, '_blank')
}else if(file.endsWith('.sbml')){
var openPath = path.join(app.getBasePath(), "edit", _path)
window.open(openPath, '_blank')
}else if(file.endsWith('.proj')){
window.location.href = path.join(app.getBasePath(), "stochss/project/manager")+"?path="+_path;
}else if(file.endsWith('.wkfl')){
window.location.href = path.join(app.getBasePath(), "stochss/workflow/edit")+"?path="+_path+"&type=none";
}else if(file.endsWith('.domn')) {
let queryStr = "?domainPath=" + _path
window.location.href = path.join(app.getBasePath(), "stochss/domain/edit") + queryStr
}else if(node.type === "folder" && $('#models-jstree').jstree().is_open(node) && $('#models-jstree').jstree().is_loaded(node)){
$('#models-jstree').jstree().refresh_node(node)
}else if(node.type === "other"){
var openPath = path.join(app.getBasePath(), "view", _path);
window.open(openPath, "_blank");
if(!(_path.split("/")[0] === "trash")) {
if(file.endsWith('.mdl') || file.endsWith('.smdl')){
window.location.href = path.join(app.getBasePath(), "stochss/models/edit")+"?path="+_path;
}else if(file.endsWith('.ipynb')){
var notebookPath = path.join(app.getBasePath(), "notebooks", _path)
window.open(notebookPath, '_blank')
}else if(file.endsWith('.sbml')){
var openPath = path.join(app.getBasePath(), "edit", _path)
window.open(openPath, '_blank')
}else if(file.endsWith('.proj')){
window.location.href = path.join(app.getBasePath(), "stochss/project/manager")+"?path="+_path;
}else if(file.endsWith('.wkfl')){
window.location.href = path.join(app.getBasePath(), "stochss/workflow/edit")+"?path="+_path+"&type=none";
}else if(file.endsWith('.domn')) {
let queryStr = "?domainPath=" + _path
window.location.href = path.join(app.getBasePath(), "stochss/domain/edit") + queryStr
}else if(node.type === "folder" && $('#models-jstree').jstree().is_open(node) && $('#models-jstree').jstree().is_loaded(node)){
$('#models-jstree').jstree().refresh_node(node)
}else if(node.type === "other"){
var openPath = path.join(app.getBasePath(), "view", _path);
window.open(openPath, "_blank");
}
}
});
}
Expand Down
61 changes: 61 additions & 0 deletions client/pages/multiple-plots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
StochSS is a platform for simulating biochemical systems
Copyright (C) 2019-2020 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 path = require('path');
//support files
let app = require('../app');
let Plotly = require('../lib/plotly');
//views
var PageView = require('../pages/base');
//templates
let template = require("../templates/pages/multiplePlots.pug");

import initPage from './page.js';

let ModelEditor = PageView.extend({
template: template,
initialize: function (attrs, options) {
PageView.prototype.initialize.apply(this, arguments);
let urlParams = new URLSearchParams(window.location.search);
this.workflow = urlParams.get("wkfl");
this.job = urlParams.get("job");
this.path = urlParams.get("path");
this.data = urlParams.get("data");
},
render: function (attrs, options) {
PageView.prototype.render.apply(this, arguments);
let queryStr = "?path=" + this.path + "&data=" + this.data;
let endpoint = path.join(app.getApiPath(), "workflow/plot-results") + queryStr;
let self = this;
app.getXHR(endpoint, {
success: function (err, response, body) {
self.plotFigure(body);
},
error: function (err, response, body) {
console.log(body)
}
});
},
plotFigure: function (figure) {
let el = this.queryByHook("figures");
let config = {"responsive":true};
Plotly.newPlot(el, figure, config);
}
});

initPage(ModelEditor);
2 changes: 1 addition & 1 deletion client/pages/project-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ let ProjectManager = PageView.extend({
let yesBtn = document.querySelector('#emptyTrashConfirmModal .yes-modal-btn');
yesBtn.addEventListener('click', function (e) {
modal.modal('hide');
let endpoint = path.join(app.getApiPath(), "project/empty-trash")+"?path="+path.join(self.model.directory, "trash");
let endpoint = path.join(app.getApiPath(), "file/empty-trash")+"?path="+path.join(self.model.directory, "trash");
app.getXHR(endpoint, {
success: function (err, response, body) {
$(self.queryByHook('empty-project-trash')).prop('disabled', true);
Expand Down
2 changes: 2 additions & 0 deletions client/templates/includes/gillespyResultsEnsemble.pug
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ div#workflow-results.card.card-body

button.btn.btn-primary.box-shadow(data-hook="trajectories-edit-plot" data-target="edit-plot" disabled) Edit Plot

button.btn.btn-primary.box-shadow(data-hook="multiple-plots", data-type="mltplplt" disabled) Multiple Plots

button.btn.btn-primary.box-shadow(
data-hook="trajectories-download-png-custom"
data-target="download-png-custom"
Expand Down
2 changes: 2 additions & 0 deletions client/templates/includes/parameterScanResults.pug
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ div#workflow-results.card.card-body

button.btn.btn-primary.box-shadow(data-hook="ts-psweep-edit-plot" data-target="edit-plot" disabled) Edit Plot

button.btn.btn-primary.box-shadow(data-hook="multiple-plots" data-type="ts-psweep-mp" style="display: none;" disabled) Multiple Plots

button.btn.btn-primary.box-shadow(
data-hook="ts-psweep-download-png-custom"
data-target="download-png-custom"
Expand Down
2 changes: 2 additions & 0 deletions client/templates/includes/parameterSweepResults.pug
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ div#workflow-results.card.card-body

button.btn.btn-primary.box-shadow(data-hook="ts-psweep-edit-plot" data-target="edit-plot" disabled) Edit Plot

button.btn.btn-primary.box-shadow(data-hook="multiple-plots" data-type="ts-psweep-mp" style="display: none;" disabled) Multiple Plots

button.btn.btn-primary.box-shadow(
data-hook="ts-psweep-download-png-custom"
data-target="download-png-custom"
Expand Down
4 changes: 4 additions & 0 deletions client/templates/pages/domainEditor.pug
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ section.page
li.dropdown-item(data-hook="save-to-model") to Model
li.dropdown-item(data-hook="save-to-file") to File (.domn)

a.btn.btn-primary.box-shadow.text-break(role="button" data-hook="return-to-project") Return to Project

a.btn.btn-primary.box-shadow.text-break(role="button" data-hook="return-to-model") Return to Model

div.mdl-edit-btn.saving-status.inline(data-hook="sd-in-progress")

div.spinner-grow.mr-2
Expand Down
4 changes: 3 additions & 1 deletion client/templates/pages/fileBrowser.pug
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ section.page

button.btn.btn-primary.box-shadow(id="options-for-node" data-hook="options-for-node" disabled) Actions

button.btn.btn-primary.inline.box-shadow(id="refresh-jstree" data-hook="refresh-jstree") Refresh
button.btn.btn-primary.inline.box-shadow(id="refresh-jstree" data-hook="refresh-jstree") Refresh

button.btn.btn-primary.inline.box-shadow(id="empty-trash" data-hook="empty-trash") Empty Trash
11 changes: 11 additions & 0 deletions client/templates/pages/multiplePlots.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
section.page

h3="Workflow: "+this.workflow

h4="Job: "+this.job

div.card.card-body

h5 Plot Trajectories: Multiple Graphs

div(data-hook="figures")
Loading

0 comments on commit 4312a0e

Please sign in to comment.