Skip to content

Commit 3ecd9de

Browse files
authored
✨ [Frontend] Event-driven PATCH trigger (#8154)
1 parent c2de0e1 commit 3ecd9de

File tree

23 files changed

+531
-397
lines changed

23 files changed

+531
-397
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
812812

813813
this.setBlocked(projectLocked ? "IN_USE" : false);
814814
if (projectLocked) {
815-
this.__showBlockedCardFromStatus("IN_USE", state["shareState"]);
815+
this.__showBlockedCardFromStatus("IN_USE", state);
816816
}
817817

818818
if (pipelineState) {
@@ -896,20 +896,20 @@ qx.Class.define("osparc.dashboard.CardBase", {
896896
avatarGroup.setUserGroupIds(currentUserGroupIds);
897897
},
898898

899-
__showBlockedCardFromStatus: function(reason, shareState) {
899+
__showBlockedCardFromStatus: function(reason, state) {
900900
switch (reason) {
901901
case "IN_USE":
902-
this.__blockedInUse(shareState);
902+
this.__blockedInUse(state);
903903
break;
904904
case "IN_DEBT":
905905
this.__blockedInDebt();
906906
break;
907907
}
908908
},
909909

910-
__blockedInUse: function(shareState) {
911-
const status = shareState["status"];
912-
const currentUserGroupIds = shareState["currentUserGroupids"];
910+
__blockedInUse: function(state) {
911+
const projectStatus = osparc.study.Utils.state.getProjectStatus(state);
912+
const currentUserGroupIds = osparc.study.Utils.state.getCurrentGroupIds(state);
913913
const usersStore = osparc.store.Users.getInstance();
914914
const userPromises = currentUserGroupIds.map(userGroupId => usersStore.getUser(userGroupId));
915915
const usernames = [];
@@ -925,7 +925,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
925925
console.error("Failed to fetch user data for avatars:", error);
926926
})
927927
.finally(() => {
928-
switch (status) {
928+
switch (projectStatus) {
929929
case "CLOSING":
930930
image = "@FontAwesome5Solid/key/";
931931
toolTip += this.tr("Closing...");

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
8181
this.__resourceModel["resourceType"] = resourceData["resourceType"];
8282
this.__addPages();
8383
}
84-
if (resourceData["functionClass"] === osparc.data.model.Function.FUNCTION_CLASS.PROJECT) {
84+
// use latestResourceData, resourceData doesn't have the functionClass nor the templateId
85+
if (latestResourceData["functionClass"] === osparc.data.model.Function.FUNCTION_CLASS.PROJECT) {
8586
// this is only required for functions that have a template linked
86-
osparc.store.Templates.fetchTemplate(resourceData["templateId"])
87+
osparc.store.Templates.fetchTemplate(latestResourceData["templateId"])
8788
.then(templateData => {
8889
// prefetch function's underlying template's services metadata
8990
osparc.store.Services.getStudyServicesMetadata(templateData)
@@ -592,7 +593,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
592593
page.setEnabled(enabled);
593594

594595
const lazyLoadContent = () => {
595-
const resourceModel = osparc.utils.Resources.isFunction(this.__resourceData) ? this.__resourceModel.getTemplate() : this.__resourceData;
596+
const resourceModel = osparc.utils.Resources.isFunction(this.__resourceData) ? this.__resourceModel.getTemplate() : this.__resourceModel;
596597
const preview = new osparc.study.StudyPreview(resourceModel);
597598
page.addToContent(preview);
598599
this.__widgets.push(preview);

0 commit comments

Comments
 (0)