Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow saving a non-opened project #2225

Merged
merged 21 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
78bdea4
LinkButton supports icon
odeimaiz Jan 14, 2021
87c32cf
Revert "LinkButton supports icon"
odeimaiz Jan 14, 2021
1adee71
Merge branch 'master' of github.com:odeimaiz/osparc-simcore
odeimaiz Jan 20, 2021
99fbf9c
Merge branch 'master' of github.com:odeimaiz/osparc-simcore
odeimaiz Mar 2, 2021
8bc0e76
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 3, 2021
d09f38a
git pushMerge remote-tracking branch 'upstream/master'
odeimaiz Mar 3, 2021
7107463
git pushMerge remote-tracking branch 'upstream/master'
odeimaiz Mar 4, 2021
b6f0fec
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 10, 2021
28906cd
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 15, 2021
9a02228
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 16, 2021
7b35dcc
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 18, 2021
ccef602
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 19, 2021
ce74606
Merge remote-tracking branch 'upstream/master'
odeimaiz Mar 22, 2021
7ce909e
renaming
odeimaiz Mar 22, 2021
134eb32
Update StudyEditor.js
odeimaiz Mar 22, 2021
2b00119
Update StudyEditor.js
odeimaiz Mar 22, 2021
447d5fd
Merge branch 'master' into fix/active-study-reconnect
odeimaiz Mar 22, 2021
fafa78b
@sanderegg Display message when study is no longer active
odeimaiz Mar 22, 2021
d38b045
Merge branch 'master' into fix/active-study-reconnect
odeimaiz Mar 23, 2021
1de1025
Merge branch 'master' into fix/active-study-reconnect
odeimaiz Mar 23, 2021
8d769b7
Merge branch 'master' into fix/active-study-reconnect
odeimaiz Mar 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ qx.Class.define("osparc.desktop.MainPage", {
studyEditor.setPageContext("workbench");
}

this.__studyEditor.addListener("studyIsLocked", () => {
this.__studyEditor.addListener("forceBackToDashboard", () => {
this.__showDashboard();
}, this);
},
Expand Down
28 changes: 25 additions & 3 deletions services/web/client/source/class/osparc/desktop/StudyEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
},

events: {
"studyIsLocked": "qx.event.type.Event",
"forceBackToDashboard": "qx.event.type.Event",
"startStudy": "qx.event.type.Data"
},

Expand Down Expand Up @@ -149,12 +149,31 @@ qx.Class.define("osparc.desktop.StudyEditor", {
const portKey = data["portKey"];
this.__updatePipelineAndRetrieve(node, portKey);
}, this);

const socket = osparc.wrapper.WebSocket.getInstance();
socket.addListener("connect", () => {
const params = {
url: {
tabId: osparc.utils.Utils.getClientSessionID()
}
};
osparc.data.Resources.fetch("studies", "getActive", params)
.then(studyData => {
if (studyData === null) {
// This might happen when the socket connection is lost and the study gets closed
this.fireEvent("forceBackToDashboard");
}
})
.catch(() => {
this.fireEvent("forceBackToDashboard");
});
});
})
.catch(err => {
if ("status" in err && err["status"] == 423) { // Locked
const msg = study.getName() + this.tr(" is already opened");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
this.fireEvent("studyIsLocked");
this.fireEvent("forceBackToDashboard");
} else {
console.error(err);
}
Expand Down Expand Up @@ -352,11 +371,14 @@ qx.Class.define("osparc.desktop.StudyEditor", {
},

__startAutoSaveTimer: function() {
let diffPatcher = osparc.wrapper.JsonDiffPatch.getInstance();
const diffPatcher = osparc.wrapper.JsonDiffPatch.getInstance();
// Save every 3 seconds
const interval = 3000;
let timer = this.__autoSaveTimer = new qx.event.Timer(interval);
timer.addListener("interval", () => {
if (!osparc.wrapper.WebSocket.getInstance().isConnected()) {
return;
}
const newObj = this.getStudy().serialize();
const delta = diffPatcher.diff(this.__lastSavedStudy, newObj);
if (delta) {
Expand Down