Skip to content

Commit 806c846

Browse files
authored
Team Black and more (#1729)
Nodes tree action buttons context dependant ITISFoundation/osparc-issues#261 - Add-new-node removed - Delete and Open buttons react to selection change Bugfixes - Do not create study from template if user has no access to all services - Reopen study when reloading page. Also fixes some issues with "Study is already open"
1 parent 39817ee commit 806c846

File tree

14 files changed

+248
-201
lines changed

14 files changed

+248
-201
lines changed

services/web/client/source/class/osparc/component/form/renderer/PropFormBase.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ qx.Class.define("osparc.component.form.renderer.PropFormBase", {
165165

166166
__createNewParameter: function(fieldKey) {
167167
const title = this.tr("Create new parameter");
168-
const subtitle = this.tr("Do not use whitespaces");
169-
const newParamName = new osparc.component.widget.Renamer(null, subtitle, title);
168+
const newParamName = new osparc.component.widget.Renamer(null, null, title);
170169
newParamName.addListener("labelChanged", e => {
171170
const study = osparc.store.Store.getInstance().getCurrentStudy();
172171
let newParameterLabel = e.getData()["newLabel"];

services/web/client/source/class/osparc/component/sweeper/Parameters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ qx.Class.define("osparc.component.sweeper.Parameters", {
5858
},
5959
"nSteps": {
6060
col: 4,
61-
label: qx.locale.Manager.tr("Steps")
61+
label: qx.locale.Manager.tr("#Steps")
6262
},
6363
"distribution": {
6464
col: 5,

services/web/client/source/class/osparc/component/sweeper/Sweeper.js

Lines changed: 74 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ qx.Class.define("osparc.component.sweeper.Sweeper", {
2121
construct: function(study) {
2222
this.base(arguments);
2323

24-
this._setLayout(new qx.ui.layout.VBox(5));
24+
this._setLayout(new qx.ui.layout.VBox(10));
2525

2626
if (study.getSweeper().getPrimaryStudyId()) {
2727
this.__buildSecondaryLayout(study);
@@ -38,6 +38,7 @@ qx.Class.define("osparc.component.sweeper.Sweeper", {
3838
members: {
3939
__primaryStudy: null,
4040
__parametersTable: null,
41+
__iterationsSection: null,
4142
__iterationsTable: null,
4243
__selectedIteration: null,
4344

@@ -49,51 +50,89 @@ qx.Class.define("osparc.component.sweeper.Sweeper", {
4950
const primaryStudyId = secondaryStudy.getSweeper().getPrimaryStudyId();
5051
this.fireDataEvent("iterationSelected", primaryStudyId);
5152
});
52-
this._addAt(newParamBtn, 0);
53+
this._add(newParamBtn);
5354
},
5455

5556
__buildPrimaryLayout: function() {
57+
const parametersSection = this.__buildParametersSection();
58+
this._add(parametersSection, {
59+
flex: 2
60+
});
61+
62+
const iterationsSection = this.__buildIterationsSection();
63+
this._add(iterationsSection, {
64+
flex: 3
65+
});
66+
},
67+
68+
__buildParametersSection: function() {
69+
const parametersSection = new qx.ui.groupbox.GroupBox(this.tr("Parameters")).set({
70+
layout: new qx.ui.layout.VBox(5)
71+
});
5672
const newParamBtn = this.__createNewParamBtn();
57-
this._addAt(newParamBtn, 0);
58-
const parametersTable = this.__parametersTable = this.__createParametersTable().set({
59-
minWidth: 400,
60-
maxHeight: 200
73+
parametersSection.add(newParamBtn);
74+
75+
const parametersTable = this.__parametersTable = new osparc.component.sweeper.Parameters(this.__primaryStudy);
76+
parametersSection.add(parametersTable, {
77+
flex: 1
6178
});
62-
this._addAt(parametersTable, 1);
79+
return parametersSection;
80+
},
6381

64-
this._addAt(new qx.ui.core.Spacer(null, 10), 2);
82+
__buildIterationsSection: function() {
83+
const iterationsSection = this.__iterationsSection = new qx.ui.groupbox.GroupBox(this.tr("Iterations")).set({
84+
layout: new qx.ui.layout.VBox(5)
85+
});
6586

6687
const iterationBtns = new qx.ui.container.Composite(new qx.ui.layout.HBox(10));
6788
const deleteIterationsBtn = this.__deleteIterationsBtn();
6889
iterationBtns.add(deleteIterationsBtn);
6990
const recreateIterationsBtn = this.__recreateIterationsBtn();
7091
iterationBtns.add(recreateIterationsBtn);
71-
this._addAt(iterationBtns, 3);
72-
const iterationsTable = this.__iterationsTable = this.__createIterationsTable().set({
73-
minWidth: 400,
74-
minHeight: 200,
75-
maxHeight: 400
76-
});
77-
this._addAt(iterationsTable, 4);
92+
iterationsSection.addAt(iterationBtns, 0);
93+
94+
this.__rebuildIterationsTable();
7895

7996
const openIterationsBtn = this.__openIterationsBtn = this.__createOpenIterationsBtn();
8097
openIterationsBtn.setEnabled(false);
81-
this._addAt(openIterationsBtn, 5);
98+
iterationsSection.addAt(openIterationsBtn, 2);
8299
openIterationsBtn.addListener("execute", () => {
83100
if (this.__selectedIteration) {
84101
this.fireDataEvent("iterationSelected", this.__selectedIteration);
85102
}
86103
});
104+
105+
return iterationsSection;
106+
},
107+
108+
__rebuildIterationsTable: function() {
109+
if (this.__iterationsTable) {
110+
this.__iterationsSection.remove(this.__iterationsTable);
111+
}
112+
113+
const iterationsTable = this.__iterationsTable = new osparc.component.sweeper.Iterations(this.__primaryStudy);
114+
iterationsTable.addListener("cellTap", e => {
115+
if (this.__openIterationsBtn) {
116+
this.__openIterationsBtn.setEnabled(true);
117+
}
118+
const selectedRow = e.getRow();
119+
this.__selectedIteration = iterationsTable.getRowData(selectedRow)["StudyId"];
120+
});
121+
122+
this.__iterationsSection.addAt(iterationsTable, 1, {
123+
flex: 1
124+
});
125+
126+
return iterationsTable;
87127
},
88128

89129
__createNewParamBtn: function() {
90-
const label = this.tr("Create new parameter");
130+
const label = this.tr("Create new Parameter");
91131
const newParamBtn = new qx.ui.form.Button(label).set({
92132
allowGrowX: false
93133
});
94134
newParamBtn.addListener("execute", () => {
95-
const subtitle = this.tr("Do not use whitespaces");
96-
const newParamName = new osparc.component.widget.Renamer(null, subtitle, label);
135+
const newParamName = new osparc.component.widget.Renamer(null, null, label);
97136
newParamName.addListener("labelChanged", e => {
98137
const primaryStudy = this.__primaryStudy;
99138
let newParameterLabel = e.getData()["newLabel"];
@@ -113,28 +152,19 @@ qx.Class.define("osparc.component.sweeper.Sweeper", {
113152
return newParamBtn;
114153
},
115154

116-
__createParametersTable: function() {
117-
const params = new osparc.component.sweeper.Parameters(this.__primaryStudy);
118-
return params;
119-
},
120-
121155
__deleteIterationsBtn: function() {
122156
const deleteIterationsBtn = new osparc.ui.form.FetchButton(this.tr("Delete Iterations")).set({
123157
alignX: "left",
124158
allowGrowX: false
125159
});
126160
deleteIterationsBtn.addListener("execute", () => {
127-
// recreate table
128-
if (this.__iterationsTable) {
129-
this._remove(this.__iterationsTable);
130-
}
131-
161+
deleteIterationsBtn.setFetching(true);
132162
this.__deleteIterations(deleteIterationsBtn)
133163
.then(() => {
134-
const paramCombinations = this.__iterationsTable = this.__createIterationsTable().set({
135-
maxHeight: 400
136-
});
137-
this._addAt(paramCombinations, 4);
164+
this.__rebuildIterationsTable();
165+
})
166+
.finally(() => {
167+
deleteIterationsBtn.setFetching(false);
138168
});
139169
}, this);
140170
return deleteIterationsBtn;
@@ -146,62 +176,43 @@ qx.Class.define("osparc.component.sweeper.Sweeper", {
146176
allowGrowX: false
147177
});
148178
recreateIterationsBtn.addListener("execute", () => {
149-
// recreate table
150-
if (this.__iterationsTable) {
151-
this._remove(this.__iterationsTable);
152-
}
153-
179+
recreateIterationsBtn.setFetching(true);
154180
this.__recreateIterations(recreateIterationsBtn)
155181
.then(() => {
156-
const paramCombinations = this.__iterationsTable = this.__createIterationsTable().set({
157-
maxHeight: 400
158-
});
159-
this._addAt(paramCombinations, 4);
182+
this.__rebuildIterationsTable();
183+
})
184+
.finally(() => {
185+
recreateIterationsBtn.setFetching(false);
160186
});
161187
}, this);
162188
return recreateIterationsBtn;
163189
},
164190

165-
__deleteIterations: function(deleteIterationsBtn) {
191+
__deleteIterations: function() {
166192
return new Promise((resolve, reject) => {
167-
deleteIterationsBtn.setFetching(true);
168193
this.__primaryStudy.getSweeper().removeSecondaryStudies()
169194
.then(() => {
170-
deleteIterationsBtn.setFetching(false);
171-
osparc.component.message.FlashMessenger.getInstance().logAs(this.tr("Iterations deleted"));
195+
const msg = this.tr("Iterations deleted");
196+
osparc.component.message.FlashMessenger.getInstance().logAs(msg);
172197
resolve();
173198
});
174199
});
175200
},
176201

177-
__recreateIterations: function(recreateIterationsBtn) {
202+
__recreateIterations: function() {
178203
return new Promise((resolve, reject) => {
179-
recreateIterationsBtn.setFetching(true);
180204
const primaryStudyData = this.__primaryStudy.serializeStudy();
181205
this.__primaryStudy.getSweeper().recreateIterations(primaryStudyData)
182206
.then(secondaryStudyIds => {
183-
recreateIterationsBtn.setFetching(false);
184-
const msg = secondaryStudyIds.length + this.tr(" iterations created");
207+
const msg = secondaryStudyIds.length + this.tr(" Iterations created");
185208
osparc.component.message.FlashMessenger.getInstance().logAs(msg);
186209
resolve();
187210
});
188211
});
189212
},
190213

191-
__createIterationsTable: function() {
192-
const iterations = new osparc.component.sweeper.Iterations(this.__primaryStudy);
193-
iterations.addListener("cellTap", e => {
194-
if (this.__openIterationsBtn) {
195-
this.__openIterationsBtn.setEnabled(true);
196-
}
197-
const selectedRow = e.getRow();
198-
this.__selectedIteration = iterations.getRowData(selectedRow)["StudyId"];
199-
});
200-
return iterations;
201-
},
202-
203214
__createOpenIterationsBtn: function() {
204-
const openIterationBtn = new qx.ui.form.Button(this.tr("Open iteration")).set({
215+
const openIterationBtn = new qx.ui.form.Button(this.tr("Open Iteration")).set({
205216
allowGrowX: false
206217
});
207218
return openIterationBtn;

services/web/client/source/class/osparc/component/widget/LogoOnOff.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,18 @@ qx.Class.define("osparc.component.widget.LogoOnOff", {
3838
construct: function() {
3939
this.base(arguments);
4040

41-
const width = 92;
42-
const height = 50;
43-
4441
const offLogo = new qx.ui.basic.Image("osparc/osparc-red.svg").set({
45-
width,
46-
height,
42+
width: 92,
43+
height: 41,
44+
paddingTop: 9,
4745
scale: true
4846
});
4947
this.add(offLogo);
5048

5149
const onLogo = new osparc.ui.basic.LogoWPlatform();
5250
onLogo.setSize({
53-
width,
54-
height
51+
width: 92,
52+
height: 50
5553
});
5654
onLogo.setFont("text-9");
5755
this.add(onLogo);

0 commit comments

Comments
 (0)