Skip to content

Commit

Permalink
Merge branch 'master' into improve-folder-db-4
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 13, 2024
2 parents 4007ece + e6e2c70 commit 63b0443
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
break;
case "tis":
case "tiplite":
this.__addTIPPlusButtons();
this.__addTIPPlusButton();
break;
case "s4l":
case "s4lacad":
Expand All @@ -770,24 +770,27 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
this._resourcesContainer.addNonResourceCard(newStudyBtn);
},

__addTIPPlusButtons: function() {
osparc.data.Resources.get("templates")
.then(templates => {
if (templates) {
osparc.utils.Utils.fetchJSON("/resource/osparc/new_studies.json")
.then(newStudiesData => {
const product = osparc.product.Utils.getProductName()
if (product in newStudiesData) {
const mode = this._resourcesContainer.getMode();
const title = this.tr("New Plan");
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title) : new osparc.dashboard.ListButtonNew(title);
newStudyBtn.setCardKey("new-study");
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
this._resourcesContainer.addNonResourceCard(newStudyBtn);
newStudyBtn.addListener("execute", () => {
newStudyBtn.setValue(false);
__addTIPPlusButton: function() {
const mode = this._resourcesContainer.getMode();
const title = this.tr("New Plan");
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title) : new osparc.dashboard.ListButtonNew(title);
newStudyBtn.setCardKey("new-study");
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
this._resourcesContainer.addNonResourceCard(newStudyBtn);
newStudyBtn.setEnabled(false);

osparc.utils.Utils.fetchJSON("/resource/osparc/new_studies.json")
.then(newStudiesData => {
const product = osparc.product.Utils.getProductName()
if (product in newStudiesData) {
newStudyBtn.setEnabled(true);

newStudyBtn.addListener("execute", () => {
newStudyBtn.setValue(false);
osparc.data.Resources.get("templates")
.then(templates => {
if (templates) {
const newStudies = new osparc.dashboard.NewStudies(newStudiesData[product]);
newStudies.addListener("templatesLoaded", () => {
newStudies.setGroupBy("category");
Expand All @@ -806,9 +809,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
});
osparc.utils.Utils.setIdToWidget(win, "newStudiesWindow");
});
});
}
});
}
});
});
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ qx.Class.define("osparc.info.StudyLarge", {
studyData["resourceType"] = this.__isTemplate ? "template" : "study";
this.fireDataEvent("updateStudy", studyData);
qx.event.message.Bus.getInstance().dispatchByName("updateStudy", studyData);
if (this.__isTemplate) {
// reload templates
osparc.data.Resources.get("templates", {}, false)
}
})
.catch(err => {
console.error(err);
Expand Down

0 comments on commit 63b0443

Please sign in to comment.