Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
},

__addFromTemplateButton: function(buttonConfig) {
osparc.store.Templates.getTemplates()
.then(templates => {
osparc.store.Templates.getTutorials()
.then(tutorials => {
const menuButton = this.self().createMenuButton(null, buttonConfig["title"]);
osparc.utils.Utils.setIdToWidget(menuButton, buttonConfig["idToWidget"]);
// disable it until found in templates store
menuButton.setEnabled(false);

let templateMetadata = templates.find(t => t.name === buttonConfig["expectedTemplateLabel"]);
let templateMetadata = tutorials.find(t => t.name === buttonConfig["expectedTemplateLabel"]);
if (templateMetadata) {
menuButton.setEnabled(true);
menuButton.addListener("tap", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ qx.Class.define("osparc.dashboard.NewStudies", {
});
this._add(this.__flatList);

osparc.store.Templates.getTemplates()
.then(templates => {
osparc.store.Templates.getTutorials()
.then(tutorials => {
this.__newStudies = newButtonsInfo.filter(newButtonInfo => {
if (newButtonInfo.showDisabled) {
return true;
}
return templates.find(t => t.name === newButtonInfo.expectedTemplateLabel);
return tutorials.find(t => t.name === newButtonInfo.expectedTemplateLabel);
});

this.setGroupBy("category");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
newPlansBtn.setEnabled(true);

newPlansBtn.addListener("tap", () => {
osparc.store.Templates.getTemplates()
.then(templates => {
if (templates) {
osparc.store.Templates.getTutorials()
.then(tutorials => {
if (tutorials) {
const newStudies = new osparc.dashboard.NewStudies(newStudiesConfig);
const winTitle = this.tr("New Plan");
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, osparc.dashboard.NewStudies.WIDTH+40, 300).set({
Expand All @@ -950,7 +950,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
newStudies.addListener("newStudyClicked", e => {
win.close();
const templateInfo = e.getData();
const templateData = templates.find(t => t.name === templateInfo.expectedTemplateLabel);
const templateData = tutorials.find(t => t.name === templateInfo.expectedTemplateLabel);
if (templateData) {
this.__newPlanBtnClicked(templateData, templateInfo.newStudyLabel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
}
this._resourcesInitialized = true;

osparc.store.Templates.getTemplates()
osparc.store.Templates.getTutorials()
.then(() => {
this._resourcesList = [];
this.getChildControl("resources-layout");
Expand All @@ -48,7 +48,7 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {

reloadResources: function(useCache = true) {
if (osparc.data.Permissions.getInstance().canDo("studies.templates.read")) {
this.__reloadTemplates(useCache);
this.__reloadTutorials(useCache);
} else {
this.__setResourcesToList([]);
}
Expand Down Expand Up @@ -81,14 +81,14 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
}
},

__reloadTemplates: function(useCache) {
__reloadTutorials: function(useCache) {
this.__tasksToCards();

if (useCache) {
osparc.store.Templates.getTemplates()
osparc.store.Templates.getTutorials()
.then(templates => this.__setResourcesToList(templates));
} else {
osparc.store.Templates.getTemplates(useCache)
osparc.store.Templates.getTutorials(useCache)
.then(templates => this.__setResourcesToList(templates))
.catch(() => this.__setResourcesToList([]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ qx.Class.define("osparc.desktop.organizations.ServicesList", {
}, item, id);
},
configureItem: item => {
item.subscribeToFilterGroup("organizationTemplatesList");
item.subscribeToFilterGroup("organizationServicesList");
item.addListener("openMoreInfo", e => {
const serviceKey = e.getData()["key"];
const serviceVersion = e.getData()["version"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", {
this._setLayout(new qx.ui.layout.VBox(10));

this._add(this.__createIntroText());
this._add(this.__getTemplatesFilter());
this._add(this.__getTemplatesList(), {
this._add(this.__getTutorialsFilter());
this._add(this.__getTutorialsList(), {
flex: 1
});
},

members: {
__currentOrg: null,
__templatesModel: null,
__tutorialsModel: null,

setCurrentOrg: function(orgModel) {
if (orgModel === null) {
return;
}
this.__currentOrg = orgModel;
this.__reloadOrgTemplates();
this.__reloadOrgTutorials();
},

__createIntroText: function() {
const msg = this.tr("This is the list of ") + osparc.product.Utils.getTemplateAlias({plural: true}) + this.tr(" shared with this Organization");
const msg = this.tr("This is the list of Tutorials shared with this Organization");
const intro = new qx.ui.basic.Label().set({
value: msg,
alignX: "left",
Expand All @@ -53,21 +53,21 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", {
return intro;
},

__getTemplatesFilter: function() {
const filter = new osparc.filter.TextFilter("text", "organizationTemplatesList").set({
__getTutorialsFilter: function() {
const filter = new osparc.filter.TextFilter("text", "organizationTutorialsList").set({
allowStretchX: true,
margin: [0, 10, 5, 10]
});
return filter;
},

__getTemplatesList: function() {
__getTutorialsList: function() {
const templatesUIList = new qx.ui.form.List().set({
decorator: "no-border",
spacing: 3
});

const templatesModel = this.__templatesModel = new qx.data.Array();
const templatesModel = this.__tutorialsModel = new qx.data.Array();
const templatesCtrl = new qx.data.controller.List(templatesModel, templatesUIList, "name");
templatesCtrl.setDelegate({
createItem: () => new osparc.desktop.organizations.SharedResourceListItem("template"),
Expand All @@ -83,7 +83,7 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", {
}, item, id);
},
configureItem: item => {
item.subscribeToFilterGroup("organizationTemplatesList");
item.subscribeToFilterGroup("organizationTutorialsList");
item.addListener("openMoreInfo", e => {
const templateId = e.getData()["key"];
osparc.store.Templates.getTemplate(templateId)
Expand All @@ -103,19 +103,19 @@ qx.Class.define("osparc.desktop.organizations.TemplatesList", {
return templatesUIList;
},

__reloadOrgTemplates: function() {
const templatesModel = this.__templatesModel;
__reloadOrgTutorials: function() {
const templatesModel = this.__tutorialsModel;
templatesModel.removeAll();

const orgModel = this.__currentOrg;
if (orgModel === null) {
return;
}

osparc.store.Templates.getTemplates()
.then(templates => {
osparc.store.Templates.getTutorials()
.then(tutorials => {
const groupId = orgModel.getGroupId();
const orgTemplates = templates.filter(template => groupId in template["accessRights"]);
const orgTemplates = tutorials.filter(template => groupId in template["accessRights"]);
orgTemplates.forEach(orgTemplate => {
const orgTemplateCopy = osparc.utils.Utils.deepCloneObject(orgTemplate);
orgTemplateCopy["orgId"] = groupId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ qx.Class.define("osparc.notification.NotificationUI", {
case "TEMPLATE_SHARED":
icon.setSource("@FontAwesome5Solid/copy/14");
if (resourceId) {
const template = osparc.store.Store.getInstance().getTemplate(resourceId);
const template = osparc.store.Templates.getTemplate(resourceId);
if (template) {
const templateAlias = osparc.product.Utils.getTemplateAlias({
firstUpperCase: true
Expand Down
Loading