Skip to content

Shared project concurrency (frontend) #1591

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ae34618
write permissions needed to remove a user not delete permission
sanderegg Jun 17, 2020
2d8149b
adding group testing with more than 1 user
sanderegg Jun 19, 2020
61f9261
small fixes
sanderegg Jun 22, 2020
2922a55
fixing user in group patch endpoint
sanderegg Jun 22, 2020
890a9bc
fix patch users in group endpoint
sanderegg Jun 22, 2020
fd8f0d4
access_rights renamed to accessRights
sanderegg Jun 22, 2020
cec68fa
renamed access_rights to accessRights following openapi
sanderegg Jun 22, 2020
782d95d
fix rename access_rights to accessRights
sanderegg Jun 22, 2020
307d3c2
simplify tests
sanderegg Jun 22, 2020
b2b7641
refactor
sanderegg Jun 22, 2020
91da8b7
added test for opening a shared project 2 times
sanderegg Jun 22, 2020
b91cf46
moved helpers in a module
sanderegg Jun 23, 2020
74dd47f
simplify tests
sanderegg Jun 23, 2020
e0f0a5b
refactor
sanderegg Jun 23, 2020
40f27e0
ongoing tests
sanderegg Jun 23, 2020
09b6e11
missing import
sanderegg Jun 23, 2020
7b54a98
adding test for shared project concurrency
sanderegg Jun 23, 2020
df4c404
test ready for concurrency access
sanderegg Jun 23, 2020
3fceb21
after user 1 closes the project user 2 shall be able to open
sanderegg Jun 23, 2020
5d90377
prevent opening of same project by 2 users
sanderegg Jun 23, 2020
c579d75
typos
sanderegg Jun 23, 2020
93f336a
wrong syntax
sanderegg Jun 23, 2020
003dac7
typo
sanderegg Jun 23, 2020
d36b081
fixed test
sanderegg Jun 23, 2020
d14811e
added endpoint to return state of a project
sanderegg Jun 23, 2020
17e6c6f
adding state endpoint
sanderegg Jun 23, 2020
ddcccda
fixed endpoint behaviour
sanderegg Jun 23, 2020
2dc23c3
Merge branch 'master' into is/shared_project_concurrency2
sanderegg Jun 24, 2020
84f181b
refactor
sanderegg Jun 24, 2020
fdd540b
mypy
sanderegg Jun 24, 2020
b2b48d0
locked property added
odeimaiz Jun 24, 2020
d896c62
Show lock when locked
odeimaiz Jun 24, 2020
1c61e5b
cleanup
sanderegg Jun 24, 2020
ea66b70
now check project is locked
sanderegg Jun 24, 2020
88893ac
add error status to throwing Error object
odeimaiz Jun 24, 2020
3ea0480
openStudy callback logic moved to StudyEditor
odeimaiz Jun 24, 2020
6f27b93
back to dashboard if study is locked
odeimaiz Jun 24, 2020
0b9e9ff
state resource added
odeimaiz Jun 24, 2020
46de9a0
init study and template arrays
odeimaiz Jun 24, 2020
7eed0f3
getStudiesWState added
odeimaiz Jun 25, 2020
e72b708
minor
odeimaiz Jun 25, 2020
ad11621
getStudyWState added to Store
odeimaiz Jun 25, 2020
9c19449
minor
odeimaiz Jun 25, 2020
b841aa4
minor
odeimaiz Jun 25, 2020
a4a62c8
use cache if available
odeimaiz Jun 25, 2020
80e94d1
optimize calls to backend
odeimaiz Jun 25, 2020
b6246be
minor
odeimaiz Jun 25, 2020
1c7b4f3
minor
odeimaiz Jun 25, 2020
f4640f1
deepCloneStudyObject added
odeimaiz Jun 25, 2020
ba6ad5b
minor fix
odeimaiz Jun 25, 2020
0a5760f
minor
odeimaiz Jun 25, 2020
ffb92a2
aesthetic and logic improvements
odeimaiz Jun 25, 2020
80e958a
added ProjectState model
sanderegg Jun 26, 2020
094f457
added projectStateUpdated event
sanderegg Jun 26, 2020
0861b42
user is automatically enters room upon successful login
sanderegg Jun 26, 2020
7126a9c
use projectState class
sanderegg Jun 26, 2020
15feca3
move notification to project_api
sanderegg Jun 26, 2020
74843db
notify users on closing project
sanderegg Jun 26, 2020
bea0945
ensure resource is removed
sanderegg Jun 26, 2020
dc6b74a
add recipe for mypy
sanderegg Jun 26, 2020
54c5923
fix open a project by same user
sanderegg Jun 26, 2020
55ab98c
lint
sanderegg Jun 26, 2020
61219a5
for now ignore missing imports
sanderegg Jun 26, 2020
60179cb
Merge branch 'master' into is/shared_project_concurrency2
sanderegg Jun 28, 2020
049eb49
Merge branch 'is/shared_project_concurrency2' of https://github.com/s…
odeimaiz Jun 29, 2020
eebcf74
Merge branch 'master' into sanderegg-is/shared_project_concurrency2
odeimaiz Jul 1, 2020
20eefda
bad merge
odeimaiz Jul 1, 2020
03fb754
listen projectStateUpdated socket event
odeimaiz Jul 1, 2020
86a8ce4
new state object
odeimaiz Jul 2, 2020
caca98d
minor
odeimaiz Jul 2, 2020
776db3a
minor
odeimaiz Jul 2, 2020
f196851
skip system-test-e2e
odeimaiz Jul 2, 2020
314dfcf
fixme added
odeimaiz Jul 2, 2020
a366f75
Merge branch 'master' into sanderegg-is/shared_project_concurrency2
odeimaiz Jul 2, 2020
f3a3654
minor
odeimaiz Jul 2, 2020
38241ad
minor fixes
odeimaiz Jul 2, 2020
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 @@ -33,7 +33,7 @@ qx.Class.define("osparc.component.export.Permissions", {
construct: function(studyData) {
this.base(arguments);

this.__studyData = osparc.utils.Utils.deepCloneObject(studyData);
this.__studyData = osparc.data.model.Study.deepCloneStudyObject(studyData);

this._setLayout(new qx.ui.layout.VBox(15));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ qx.Class.define("osparc.component.export.SaveAsTemplate", {
this._setLayout(new qx.ui.layout.VBox(5));

this.__studyId = studyId;
this.__formData = osparc.utils.Utils.deepCloneObject(studyData);
this.__formData = osparc.data.model.Study.deepCloneStudyObject(studyData);

this.__buildLayout();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ qx.Class.define("osparc.dashboard.ExploreBrowser", {
__initResources: function() {
this.__showLoadingPage(this.tr("Discovering Templates and Apps"));

this.__templateStudies = [];
this.__services = [];
const servicesTags = this.__getTags();
const store = osparc.store.Store.getInstance();
const servicesPromise = store.getServicesDAGs(true);
Expand Down
80 changes: 41 additions & 39 deletions services/web/client/source/class/osparc/dashboard/StudyBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
}
},

__reloadUserStudy: function(studyId) {
const params = {
url: {
projectId: studyId
}
};
osparc.data.Resources.getOne("studies", params)
__reloadUserStudy: function(studyId, reload) {
osparc.store.Store.getInstance().getStudyWState(studyId, reload)
.then(studyData => {
this.__resetStudyItem(studyData);
})
Expand All @@ -111,7 +106,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
*/
reloadUserStudies: function() {
if (osparc.data.Permissions.getInstance().canDo("studies.user.read")) {
osparc.data.Resources.get("studies")
osparc.store.Store.getInstance().getStudiesWState()
.then(studies => {
this.__resetStudyList(studies);
this.resetSelection();
Expand All @@ -127,14 +122,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
__initResources: function() {
this.__showLoadingPage(this.tr("Loading Studies"));

const servicesTags = this.__getTags();
this.__userStudies = [];
const resourcePromises = [];
const store = osparc.store.Store.getInstance();
const servicesPromise = store.getServicesDAGs(true);

Promise.all([
servicesTags,
servicesPromise
])
resourcePromises.push(store.getVisibleMembers());
resourcePromises.push(store.getServicesDAGs(true));
if (osparc.data.Permissions.getInstance().canDo("study.tag")) {
resourcePromises.push(osparc.data.Resources.get("tags"));
}
Promise.all(resourcePromises)
.then(() => {
this.__hideLoadingPage();
this.__createStudiesLayout();
Expand All @@ -144,7 +140,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
if (loadStudyId) {
this.__getStudyAndStart(loadStudyId);
}
});
})
.catch(console.error);
},

__reloadResources: function() {
Expand All @@ -171,18 +168,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
});
},

__getTags: function() {
return new Promise((resolve, reject) => {
if (osparc.data.Permissions.getInstance().canDo("study.tag")) {
osparc.data.Resources.get("tags")
.catch(console.error)
.finally(() => resolve());
} else {
resolve();
}
});
},

__createStudiesLayout: function() {
const studyFilters = this.__studyFilters = new osparc.component.filter.group.StudyFilterGroup("studyBrowser").set({
paddingTop: 5
Expand Down Expand Up @@ -244,12 +229,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__getStudyAndStart: function(loadStudyId) {
const params = {
url: {
projectId: loadStudyId
}
};
osparc.data.Resources.getOne("studies", params)
osparc.store.Store.getStudyWState(loadStudyId, true)
.then(studyData => {
this.__startStudy(studyData);
})
Expand Down Expand Up @@ -282,6 +262,23 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__attachEventHandlers: function() {
// Listen to socket
const socket = osparc.wrapper.WebSocket.getInstance();
// callback for incoming logs
const slotName = "projectStateUpdated";
socket.removeSlot(slotName);
socket.on(slotName, function(jsonString) {
const data = JSON.parse(jsonString);
if (data) {
const studyId = data["project_uuid"];
const state = ("data" in data) ? data["data"] : {};
const studyItem = this.__userStudyContainer.getChildren().find(card => (card instanceof osparc.dashboard.StudyBrowserButtonItem) && (card.getUuid() === studyId));
if (studyItem) {
studyItem.setState(state);
}
}
}, this);

const textfield = this.__studyFilters.getTextFilter().getChildControl("textfield");
textfield.addListener("appear", () => {
textfield.focus();
Expand Down Expand Up @@ -347,10 +344,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
__resetStudyItem: function(studyData) {
const userStudyList = this.__userStudies;
const index = userStudyList.findIndex(userStudy => userStudy["uuid"] === studyData["uuid"]);
if (index !== -1) {
this.__userStudies[index] = studyData;
this.__resetStudyList(userStudyList);
if (index === -1) {
userStudyList.push(studyData);
} else {
userStudyList[index] = studyData;
}
this.__resetStudyList(userStudyList);
},

__resetStudyList: function(userStudyList) {
Expand Down Expand Up @@ -400,13 +399,16 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
accessRights: study.accessRights ? study.accessRights : null,
lastChangeDate: study.lastChangeDate ? new Date(study.lastChangeDate) : null,
icon: study.thumbnail || defaultThumbnail,
state: study.state ? study.state : {},
tags
});
const menu = this.__getStudyItemMenu(item, study);
item.setMenu(menu);
item.subscribeToFilterGroup("studyBrowser");
item.addListener("execute", () => {
this.__itemClicked(item);
if (!item.isLocked()) {
this.__itemClicked(item);
}
}, this);

return item;
Expand Down Expand Up @@ -469,7 +471,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const permissionsView = new osparc.component.export.Permissions(studyData);
permissionsView.addListener("updateStudy", e => {
const studyId = e.getData();
this.__reloadUserStudy(studyId);
this.__reloadUserStudy(studyId, true);
}, this);
const window = permissionsView.createWindow();
permissionsView.addListener("finished", e => {
Expand Down
Loading