Skip to content

Commit dd6dfe9

Browse files
committed
do not use cached templates
1 parent 045dcf1 commit dd6dfe9

File tree

1 file changed

+25
-3
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+25
-3
lines changed

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

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,28 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
746746
},
747747

748748
__addTIPPlusButton: function() {
749+
const mode = this._resourcesContainer.getMode();
750+
const title = this.tr("New Plan");
751+
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title) : new osparc.dashboard.ListButtonNew(title);
752+
newStudyBtn.setCardKey("new-study");
753+
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
754+
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
755+
this._resourcesContainer.addNonResourceCard(newStudyBtn);
756+
newStudyBtn.setEnabled(false);
757+
758+
osparc.utils.Utils.fetchJSON("/resource/osparc/new_studies.json")
759+
.then(newStudiesData => {
760+
const product = osparc.product.Utils.getProductName()
761+
if (product in newStudiesData) {
762+
newStudyBtn.setEnabled(true);
763+
764+
newStudyBtn.addListener("execute", () => {
765+
newStudyBtn.setValue(false);
766+
// do not use cached templates
767+
osparc.data.Resources.get("templates", {}, false)
768+
.then(templates => {
769+
console.log("templates", templates);
770+
if (templates) {
749771
const newStudies = new osparc.dashboard.NewStudies(newStudiesData[product]);
750772
newStudies.addListener("templatesLoaded", () => {
751773
newStudies.setGroupBy("category");
@@ -764,9 +786,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
764786
});
765787
osparc.utils.Utils.setIdToWidget(win, "newStudiesWindow");
766788
});
767-
});
768-
}
769-
});
789+
}
790+
});
791+
});
770792
}
771793
});
772794
},

0 commit comments

Comments
 (0)