Skip to content

Commit 10a55a6

Browse files
committed
refactor
1 parent 753b0cd commit 10a55a6

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

services/static-webserver/client/source/class/osparc/share/CollaboratorsStudy.js

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -235,32 +235,7 @@ qx.Class.define("osparc.share.CollaboratorsStudy", {
235235
if (gids.length === 0) {
236236
return;
237237
}
238-
239-
const promises = [];
240-
gids.forEach(gid => {
241-
const params = {
242-
url: {
243-
"studyId": this._serializedDataCopy["uuid"],
244-
"gid": gid
245-
}
246-
};
247-
promises.push(osparc.data.Resources.fetch("studies", "checkShareePermissions", params));
248-
});
249-
Promise.all(promises)
250-
.then(values => {
251-
const noAccessible = values.filter(value => value["accessible"] === false);
252-
if (noAccessible.length) {
253-
const shareePermissions = new osparc.share.ShareePermissions(noAccessible);
254-
const win = osparc.ui.window.Window.popUpInWindow(shareePermissions, this.tr("Sharee permissions"), 500, 500, "@FontAwesome5Solid/exclamation-triangle/14").set({
255-
clickAwayClose: false,
256-
resizable: true,
257-
showClose: true
258-
});
259-
win.getChildControl("icon").set({
260-
textColor: "warning-yellow"
261-
});
262-
}
263-
});
238+
osparc.share.ShareePermissions.checkShareePermissions(this._serializedDataCopy["uuid"], gids);
264239
}
265240
}
266241
});

services/static-webserver/client/source/class/osparc/share/ShareePermissions.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,37 @@ qx.Class.define("osparc.share.ShareePermissions", {
1616
this.__populateLayout(shareesData);
1717
},
1818

19+
statics: {
20+
checkShareePermissions: function(studyId, gids) {
21+
const promises = [];
22+
gids.forEach(gid => {
23+
const params = {
24+
url: {
25+
studyId,
26+
gid,
27+
}
28+
};
29+
promises.push(osparc.data.Resources.fetch("studies", "checkShareePermissions", params));
30+
});
31+
Promise.all(promises)
32+
.then(values => {
33+
const noAccessible = values.filter(value => value["accessible"] === false);
34+
if (noAccessible.length) {
35+
const shareePermissions = new osparc.share.ShareePermissions(noAccessible);
36+
const caption = qx.locale.Manager.tr("Sharee permissions");
37+
const win = osparc.ui.window.Window.popUpInWindow(shareePermissions, caption, 500, 500, "@FontAwesome5Solid/exclamation-triangle/14").set({
38+
clickAwayClose: false,
39+
resizable: true,
40+
showClose: true
41+
});
42+
win.getChildControl("icon").set({
43+
textColor: "warning-yellow"
44+
});
45+
}
46+
});
47+
},
48+
},
49+
1950
members: {
2051
__populateLayout: function(shareesData) {
2152
const text = this.tr("The following users/groups will not be able to open the shared study, because they don't have access to some services. Please contact the service owner(s) to give permission.");

0 commit comments

Comments
 (0)