Skip to content

Commit 0852b69

Browse files
odeimaizmatusdrobuliak66
authored andcommitted
✨ Ask for wallet upon study creation and Hide Tiers by default (#4956)
1 parent 03f57d8 commit 0852b69

File tree

20 files changed

+404
-378
lines changed

20 files changed

+404
-378
lines changed

services/static-webserver/client/source/class/osparc/Application.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,6 @@ qx.Class.define("osparc.Application", {
330330

331331
__loadMainPage: async function(studyId = null) {
332332
// logged in
333-
334-
const walletsEnabled = osparc.desktop.credits.Utils.areWalletsEnabled();
335-
if (osparc.product.Utils.shouldHaveWalletsEnabled() && !walletsEnabled) {
336-
const infoLabel = this.tr("Credits information is not ready.<br>Please contact us by email:<br>");
337-
const supportEmail = osparc.store.VendorInfo.getInstance().getSupportEmail();
338-
osparc.FlashMessenger.getInstance().logAs(infoLabel + supportEmail, "ERROR");
339-
this.logout();
340-
}
341-
342333
const profile = await osparc.data.Resources.getOne("profile");
343334
if (profile) {
344335
this.__connectWebSocket();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
305305
throw new Error("Abstract method called!");
306306
},
307307

308-
_startStudyById: function(studyId, openCB, cancelCB) {
308+
_startStudyById: function(studyId, openCB, cancelCB, isStudyCreation = false) {
309309
if (!this._checkLoggedIn()) {
310310
return;
311311
}
@@ -326,8 +326,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
326326
};
327327
osparc.data.Resources.fetch("studies", "getWallet", params)
328328
.then(wallet => {
329-
if (wallet === null || osparc.desktop.credits.Utils.getWallet(wallet["walletId"]) === null) {
330-
// pop up study options only if it has no wallet assigned or user has no access to it
329+
if (isStudyCreation || wallet === null || osparc.desktop.credits.Utils.getWallet(wallet["walletId"]) === null) {
330+
// pop up study options if the study was just created or if it has no wallet assigned or user has no access to it
331331
const resourceSelector = new osparc.study.StudyOptions(studyId);
332332
const win = osparc.study.StudyOptions.popUpInWindow(resourceSelector);
333333
resourceSelector.addListener("startStudy", () => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
135135
};
136136
osparc.data.Resources.fetch("studies", "delete", params, studyId);
137137
};
138-
this._startStudyById(studyId, openCB, cancelCB);
138+
const isStudyCreation = true;
139+
this._startStudyById(studyId, openCB, cancelCB, isStudyCreation);
139140
})
140141
.catch(err => {
141142
this._hideLoadingPage();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
795795
};
796796
osparc.data.Resources.fetch("studies", "delete", params2, studyData["uuid"]);
797797
};
798-
this._startStudyById(studyData["uuid"], openCB, cancelCB);
798+
const isStudyCreation = true;
799+
this._startStudyById(studyData["uuid"], openCB, cancelCB, isStudyCreation);
799800
})
800801
.catch(err => {
801802
this._hideLoadingPage();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", {
148148
};
149149
osparc.data.Resources.fetch("studies", "delete", params, studyId);
150150
};
151-
this._startStudyById(studyId, openCB, cancelCB);
151+
const isStudyCreation = true;
152+
this._startStudyById(studyId, openCB, cancelCB, isStudyCreation);
152153
})
153154
.catch(err => {
154155
this._hideLoadingPage();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
235235

236236
__getSidePanelsNewWidth: function(collapsing, sidePanels, collapsibleView) {
237237
let sidePanelsNewWidth = null;
238-
const sidePanelsWidth = sidePanels.getBounds().width;
238+
const sidePanelsWidth = (sidePanels.getBounds() && ("width" in sidePanels.getBounds())) ? sidePanels.getBounds().width : 250;
239239
if (collapsing) {
240240
const content = collapsibleView.getChildControl("scroll-content");
241-
sidePanelsNewWidth = sidePanelsWidth - content.getBounds().width;
241+
sidePanelsNewWidth = (content.getBounds() && ("width" in content.getBounds())) ? sidePanelsWidth - content.getBounds().width : 150;
242242
} else if ("precollapseWidth" in collapsibleView) {
243243
sidePanelsNewWidth = sidePanelsWidth + (collapsibleView.precollapseWidth - osparc.widget.CollapsibleViewLight.CARET_WIDTH);
244244
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ qx.Class.define("osparc.desktop.credits.Utils", {
6969
return parseInt(credits);
7070
},
7171

72-
createWalletSelector: function(accessRight = "read", emptySelection = false) {
72+
createWalletSelector: function(accessRight = "read") {
7373
const store = osparc.store.Store.getInstance();
7474

7575
const walletSelector = new qx.ui.form.SelectBox();
@@ -78,11 +78,6 @@ qx.Class.define("osparc.desktop.credits.Utils", {
7878
selectBox.removeAll();
7979

8080
const wallets = store.getWallets();
81-
if (emptySelection) {
82-
const sbItem = new qx.ui.form.ListItem(qx.locale.Manager.tr("Select Credit Account"));
83-
sbItem.walletId = null;
84-
selectBox.add(sbItem);
85-
}
8681
wallets.forEach(wallet => {
8782
const found = wallet.getMyAccessRights();
8883
if (found && found[accessRight]) {

services/static-webserver/client/source/class/osparc/editor/HtmlEditor.js

Lines changed: 7 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -16,80 +16,25 @@
1616
************************************************************************ */
1717

1818
qx.Class.define("osparc.editor.HtmlEditor", {
19-
extend: qx.ui.core.Widget,
19+
extend: osparc.editor.TextEditor,
2020

2121
/**
2222
* @param initText {String} Initialization text
2323
*/
2424
construct: function(initText = "") {
25-
this.base(arguments);
25+
this.base(arguments, initText);
2626

27-
this._setLayout(new qx.ui.layout.VBox(2));
28-
29-
this.getChildControl("text-area");
30-
this.getChildControl("preview");
31-
if (initText) {
32-
this.setText(initText);
33-
}
34-
35-
this.__addButtons();
36-
},
37-
38-
events: {
39-
"textChanged": "qx.event.type.Data",
40-
"cancel": "qx.event.type.Event"
41-
},
42-
43-
properties: {
44-
text: {
45-
check: "String",
46-
event: "changeText",
47-
init: "",
48-
nullable: true
49-
}
27+
this.getChildControl("preview-html");
28+
this.getChildControl("subtitle").set({
29+
value: this.tr("Supports HTML")
30+
});
5031
},
5132

5233
members: {
5334
_createChildControlImpl: function(id) {
5435
let control;
5536
switch (id) {
56-
case "tabs":
57-
control = new qx.ui.tabview.TabView().set({
58-
contentPadding: 0,
59-
barPosition: "top"
60-
});
61-
this._add(control, {
62-
flex: 1
63-
});
64-
break;
65-
case "text-area": {
66-
control = new qx.ui.form.TextArea().set({
67-
allowGrowX: true
68-
});
69-
control.addListener("appear", () => {
70-
if (control.getValue()) {
71-
control.setTextSelection(0, control.getValue().length);
72-
}
73-
}, this);
74-
this.bind("text", control, "value");
75-
const tabs = this.getChildControl("tabs");
76-
const writePage = new qx.ui.tabview.Page(this.tr("Write")).set({
77-
layout: new qx.ui.layout.VBox(5)
78-
});
79-
writePage.getChildControl("button").getChildControl("label").set({
80-
font: "text-13"
81-
});
82-
writePage.add(control, {
83-
flex: 1
84-
});
85-
const subtitle = this.getChildControl("subtitle").set({
86-
value: this.tr("Supports HTML")
87-
});
88-
writePage.add(subtitle);
89-
tabs.add(writePage);
90-
break;
91-
}
92-
case "preview": {
37+
case "preview-html": {
9338
control = new qx.ui.embed.Html();
9439
const textArea = this.getChildControl("text-area");
9540
textArea.bind("value", control, "html");
@@ -108,44 +53,8 @@ qx.Class.define("osparc.editor.HtmlEditor", {
10853
tabs.add(previewPage);
10954
break;
11055
}
111-
case "subtitle":
112-
control = new qx.ui.basic.Label().set({
113-
font: "text-12"
114-
});
115-
this._add(control);
116-
break;
117-
case "buttons":
118-
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
119-
alignX: "right"
120-
}));
121-
this._add(control);
122-
break;
123-
case "cancel-button": {
124-
const buttons = this.getChildControl("buttons");
125-
control = new qx.ui.form.Button(this.tr("Cancel"));
126-
control.addListener("execute", () => {
127-
this.fireDataEvent("cancel");
128-
}, this);
129-
buttons.add(control);
130-
break;
131-
}
132-
case "accept-button": {
133-
const buttons = this.getChildControl("buttons");
134-
control = new qx.ui.form.Button(this.tr("Save"));
135-
control.addListener("execute", () => {
136-
const newText = this.getChildControl("text-area").getValue();
137-
this.fireDataEvent("textChanged", newText);
138-
}, this);
139-
buttons.add(control);
140-
break;
141-
}
14256
}
14357
return control || this.base(arguments, id);
144-
},
145-
146-
__addButtons: function() {
147-
this.getChildControl("cancel-button");
148-
this.getChildControl("accept-button");
14958
}
15059
}
15160
});

services/static-webserver/client/source/class/osparc/editor/MarkdownEditor.js

Lines changed: 7 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -21,80 +21,25 @@
2121
*/
2222

2323
qx.Class.define("osparc.editor.MarkdownEditor", {
24-
extend: qx.ui.core.Widget,
24+
extend: osparc.editor.TextEditor,
2525

2626
/**
2727
* @param initText {String} Initialization text
2828
*/
2929
construct: function(initText = "") {
30-
this.base(arguments);
30+
this.base(arguments, initText);
3131

32-
this._setLayout(new qx.ui.layout.VBox(2));
33-
34-
this.getChildControl("text-area");
35-
this.getChildControl("preview");
36-
if (initText) {
37-
this.setText(initText);
38-
}
39-
40-
this.__addButtons();
41-
},
42-
43-
events: {
44-
"textChanged": "qx.event.type.Data",
45-
"cancel": "qx.event.type.Event"
46-
},
47-
48-
properties: {
49-
text: {
50-
check: "String",
51-
event: "changeText",
52-
init: "",
53-
nullable: true
54-
}
32+
this.getChildControl("preview-markdown");
33+
this.getChildControl("subtitle").set({
34+
value: this.tr("Supports Markdown")
35+
});
5536
},
5637

5738
members: {
5839
_createChildControlImpl: function(id) {
5940
let control;
6041
switch (id) {
61-
case "tabs":
62-
control = new qx.ui.tabview.TabView().set({
63-
contentPadding: 0,
64-
barPosition: "top"
65-
});
66-
this._add(control, {
67-
flex: 1
68-
});
69-
break;
70-
case "text-area": {
71-
control = new qx.ui.form.TextArea().set({
72-
allowGrowX: true
73-
});
74-
control.addListener("appear", () => {
75-
if (control.getValue()) {
76-
control.setTextSelection(0, control.getValue().length);
77-
}
78-
}, this);
79-
this.bind("text", control, "value");
80-
const tabs = this.getChildControl("tabs");
81-
const writePage = new qx.ui.tabview.Page(this.tr("Write")).set({
82-
layout: new qx.ui.layout.VBox(5)
83-
});
84-
writePage.getChildControl("button").getChildControl("label").set({
85-
font: "text-13"
86-
});
87-
writePage.add(control, {
88-
flex: 1
89-
});
90-
const subtitle = this.getChildControl("subtitle").set({
91-
value: this.tr("Supports Markdown")
92-
});
93-
writePage.add(subtitle);
94-
tabs.add(writePage);
95-
break;
96-
}
97-
case "preview": {
42+
case "preview-markdown": {
9843
control = new osparc.ui.markdown.Markdown().set({
9944
padding: 3,
10045
noMargin: true
@@ -116,44 +61,8 @@ qx.Class.define("osparc.editor.MarkdownEditor", {
11661
tabs.add(previewPage);
11762
break;
11863
}
119-
case "subtitle":
120-
control = new qx.ui.basic.Label().set({
121-
font: "text-12"
122-
});
123-
this._add(control);
124-
break;
125-
case "buttons":
126-
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
127-
alignX: "right"
128-
}));
129-
this._add(control);
130-
break;
131-
case "cancel-button": {
132-
const buttons = this.getChildControl("buttons");
133-
control = new qx.ui.form.Button(this.tr("Cancel"));
134-
control.addListener("execute", () => {
135-
this.fireDataEvent("cancel");
136-
}, this);
137-
buttons.add(control);
138-
break;
139-
}
140-
case "accept-button": {
141-
const buttons = this.getChildControl("buttons");
142-
control = new qx.ui.form.Button(this.tr("Save"));
143-
control.addListener("execute", () => {
144-
const newText = this.getChildControl("text-area").getValue();
145-
this.fireDataEvent("textChanged", newText);
146-
}, this);
147-
buttons.add(control);
148-
break;
149-
}
15064
}
15165
return control || this.base(arguments, id);
152-
},
153-
154-
__addButtons: function() {
155-
this.getChildControl("cancel-button");
156-
this.getChildControl("accept-button");
15766
}
15867
}
15968
});

0 commit comments

Comments
 (0)