Skip to content

Commit 084d291

Browse files
committed
more tutorials
1 parent 2a5379a commit 084d291

File tree

9 files changed

+41
-20
lines changed

9 files changed

+41
-20
lines changed

services/static-webserver/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
4040
events: {
4141
"updateStudy": "qx.event.type.Data",
4242
"updateTemplate": "qx.event.type.Data",
43+
"updateTutorial": "qx.event.type.Data",
4344
"updateService": "qx.event.type.Data",
4445
"updateHypertool": "qx.event.type.Data",
4546
"publishTemplate": "qx.event.type.Data",

services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
287287
}
288288
resourcesContainer.addListener("updateStudy", e => this._updateStudyData(e.getData()));
289289
resourcesContainer.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
290+
resourcesContainer.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
290291
resourcesContainer.addListener("updateService", e => this._updateServiceData(e.getData()));
291292
resourcesContainer.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
292293
resourcesContainer.addListener("publishTemplate", e => this.fireDataEvent("publishTemplate", e.getData()));
@@ -693,6 +694,10 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
693694
}
694695
},
695696

697+
updateTutorialData: function(tutorialData) {
698+
throw new Error("Abstract method called!");
699+
},
700+
696701
_updateServiceData: function(serviceData) {
697702
throw new Error("Abstract method called!");
698703
},
@@ -933,6 +938,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
933938
const win = osparc.dashboard.ResourceDetails.popUpInWindow(resourceDetails);
934939
resourceDetails.addListener("updateStudy", e => this._updateStudyData(e.getData()));
935940
resourceDetails.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
941+
resourceDetails.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
936942
resourceDetails.addListener("updateService", e => this._updateServiceData(e.getData()));
937943
resourceDetails.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
938944
resourceDetails.addListener("publishTemplate", e => {

services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
390390
case "template":
391391
this.fireDataEvent("updateTemplate", updatedData);
392392
break;
393+
case "tutorial":
394+
this.fireDataEvent("updateTutorial", updatedData);
395+
break;
393396
case "hypertool":
394397
this.fireDataEvent("updateHypertool", updatedData);
395398
break;

services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
8888
.catch(() => this.__setResourcesToList([]));
8989
},
9090

91-
_updateTemplateData: function(templateData) {
91+
_updateTutorialData: function(templateData) {
9292
templateData["resourceType"] = "tutorial";
9393
this.base(arguments, templateData);
9494
},
@@ -221,7 +221,7 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
221221
}
222222
}
223223
Promise.all(templatePromises)
224-
.then(() => this._updateTemplateData(uniqueTemplateData))
224+
.then(() => this._updateTutorialData(uniqueTemplateData))
225225
.catch(err => {
226226
osparc.FlashMessenger.logError(err);
227227
});

services/static-webserver/client/source/class/osparc/desktop/organizations/TutorialsList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ qx.Class.define("osparc.desktop.organizations.TutorialsList", {
8989
osparc.store.Templates.getTutorial(templateId)
9090
.then(templateData => {
9191
if (templateData) {
92-
templateData["resourceType"] = "template";
92+
templateData["resourceType"] = "tutorial";
9393
const resourceDetails = new osparc.dashboard.ResourceDetails(templateData).set({
9494
showOpenButton: false
9595
});

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ qx.Class.define("osparc.product.Utils", {
147147
return this.getStudyAlias(options);
148148
case "template":
149149
return this.getTemplateAlias(options);
150+
case "tutorial":
151+
return this.getTutorialAlias(options);
150152
case "service":
151153
// return this.getServiceAlias(options);
152154
// Do not use this alias anymore, use "app" instead

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ qx.Class.define("osparc.share.Collaborators", {
194194
switch (this._resourceType) {
195195
case "study":
196196
case "template":
197+
case "tutorial":
197198
case "hypertool":
198199
canIShare = osparc.data.model.Study.canIWrite(this._serializedDataCopy["accessRights"]);
199200
break;
@@ -219,6 +220,7 @@ qx.Class.define("osparc.share.Collaborators", {
219220
switch (this._resourceType) {
220221
case "study":
221222
case "template":
223+
case "tutorial":
222224
case "hypertool":
223225
fullOptions = osparc.data.model.Study.canIDelete(this._serializedDataCopy["accessRights"]);
224226
break;
@@ -240,6 +242,7 @@ qx.Class.define("osparc.share.Collaborators", {
240242
switch (this._resourceType) {
241243
case "study":
242244
case "template":
245+
case "tutorial":
243246
case "hypertool":
244247
rolesLayout = osparc.data.Roles.createRolesStudyInfo();
245248
break;
@@ -345,7 +348,7 @@ qx.Class.define("osparc.share.Collaborators", {
345348
item.addListener("removeMember", e => {
346349
const orgMember = e.getData();
347350
if (
348-
["study", "template", "hypertool"].includes(this._resourceType) &&
351+
["study", "template", "tutorial", "hypertool"].includes(this._resourceType) &&
349352
!osparc.share.CollaboratorsStudy.canCollaboratorBeRemoved(this._serializedDataCopy, orgMember["gid"])
350353
) {
351354
let msg = this.tr("Collaborator can't be removed:");
@@ -373,7 +376,7 @@ qx.Class.define("osparc.share.Collaborators", {
373376
__getLeaveStudyButton: function() {
374377
const myGid = osparc.auth.Data.getInstance().getGroupId();
375378
if (
376-
["study", "template", "hypertool"].includes(this._resourceType) &&
379+
["study", "template", "tutorial", "hypertool"].includes(this._resourceType) &&
377380
osparc.share.CollaboratorsStudy.canCollaboratorBeRemoved(this._serializedDataCopy, myGid)
378381
) {
379382
const leaveText = this.tr("Leave") + " " + osparc.product.Utils.getStudyAlias({

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ qx.Class.define("osparc.share.CollaboratorsStudy", {
8888
if (!newAccessRights) {
8989
newAccessRights = this._resourceType === "study" ? writeAccessRole.accessRights : readAccessRole.accessRights;
9090
}
91-
const resourceAlias = this._resourceType === "template" ?
92-
osparc.product.Utils.getTemplateAlias({firstUpperCase: true}) :
93-
osparc.product.Utils.getStudyAlias({firstUpperCase: true});
91+
const resourceAlias = osparc.product.Utils.resourceTypeToAlias(this._resourceType, {firstUpperCase: true});
9492
const newCollaborators = {};
9593
gids.forEach(gid => {
9694
newCollaborators[gid] = newAccessRights;

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,26 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
244244
let showProductEveryone = false;
245245
if (this.__showOrganizations === false) {
246246
showProductEveryone = false;
247-
} else if (this.__resourceData && this.__resourceData["resourceType"] === "study") {
248-
// studies can't be shared with ProductEveryone
249-
showProductEveryone = false;
250-
} else if (this.__resourceData && this.__resourceData["resourceType"] === "template") {
251-
// only users with permissions can share templates with ProductEveryone
252-
showProductEveryone = osparc.data.Permissions.getInstance().canDo("study.everyone.share");
253-
} else if (this.__resourceData && this.__resourceData["resourceType"] === "service") {
254-
// all users can share services with ProductEveryone
255-
showProductEveryone = true;
256-
} else if (this.__resourceData && this.__resourceData["resourceType"] === "hypertool") {
257-
// all users can share hypertool with ProductEveryone
258-
showProductEveryone = true;
247+
} else if (this.__resourceData) {
248+
switch (this.__resourceData["resourceType"]) {
249+
case "study":
250+
// studies can't be shared with ProductEveryone
251+
showProductEveryone = false;
252+
break;
253+
case "template":
254+
case "tutorial":
255+
// only users with permissions can share templates with ProductEveryone
256+
showProductEveryone = osparc.data.Permissions.getInstance().canDo("study.everyone.share");
257+
break;
258+
case "service":
259+
// all users can share services with ProductEveryone
260+
showProductEveryone = true;
261+
break;
262+
case "hypertool":
263+
// all users can share hypertool with ProductEveryone
264+
showProductEveryone = true;
265+
break;
266+
}
259267
}
260268
return showProductEveryone;
261269
},

0 commit comments

Comments
 (0)