Skip to content

Commit 3c0909d

Browse files
odeimaizpcrespov
andauthored
🎨 [Frontend] Request Account form for oSPARC 🚨 (#6217)
Co-authored-by: Pedro Crespo-Valero <[email protected]>
1 parent 857dda9 commit 3c0909d

File tree

9 files changed

+212
-104
lines changed

9 files changed

+212
-104
lines changed

packages/postgres-database/src/simcore_postgres_database/models/products.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ class Vendor(TypedDict, total=False):
3232
"""
3333

3434
name: str # e.g. IT'IS Foundation
35-
copyright: str
36-
url: str
35+
address: str # e.g. Zeughausstrasse 43, 8004 Zurich, Switzerland
36+
copyright: str # copyright message
37+
38+
url: str # vendor website
3739
license_url: str # Which are the license terms? (if applies)
40+
3841
invitation_url: str # How to request a trial invitation? (if applies)
39-
has_landing_page: bool # Landing page enabled
40-
address: str # e.g. Zeughausstrasse 43, 8004 Zurich, Switzerland
42+
invitation_form: bool # If True, it takes precendence over invitation_url and asks the FE to show the form (if defined)
43+
44+
has_landing_page: bool # Is Landing page enabled
45+
4146
release_notes_url_template: str # a template url where `{vtag}` will be replaced, eg: "http://example.com/{vtag}.md"
4247

4348

packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def random_product(
234234
url=fake.url(),
235235
license_url=fake.url(),
236236
invitation_url=fake.url(),
237+
invitation_form=fake.boolean(),
237238
has_landing_page=fake.boolean(),
238239
address=fake.address().replace("\n", ". "),
239240
),

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,20 +518,16 @@ qx.Class.define("osparc.Application", {
518518
case "s4ldesktop":
519519
case "s4ldesktopacad":
520520
view = new osparc.auth.LoginPageS4L();
521-
this.__loadView(view);
522521
break;
523522
case "tis":
524523
view = new osparc.auth.LoginPageTI();
525-
this.__loadView(view);
526524
break;
527525
default: {
528526
view = new osparc.auth.LoginPageOsparc();
529-
this.__loadView(view, {
530-
top: "15%"
531-
});
532527
break;
533528
}
534529
}
530+
this.__loadView(view);
535531
view.addListener("done", () => this.__restart(), this);
536532
},
537533

services/static-webserver/client/source/class/osparc/auth/LoginPage.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ qx.Class.define("osparc.auth.LoginPage", {
210210

211211
const login = this.getChildControl("login-view");
212212
const registration = this.getChildControl("registration-view");
213-
const config = osparc.store.Store.getInstance().get("config");
214213
let requestAccount = null;
215-
if (config["invitation_required"] && osparc.desktop.credits.Utils.areWalletsEnabled()) {
214+
if (osparc.product.Utils.getCreateAccountAction() === "REQUEST_ACCOUNT_FORM") {
216215
requestAccount = this.getChildControl("request-account");
217216
}
218217
const verifyPhoneNumber = this.getChildControl("verify-phone-number-view");

services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,18 @@ qx.Class.define("osparc.auth.ui.LoginView", {
8989
const grp = new qx.ui.container.Composite(new qx.ui.layout.HBox(20));
9090

9191
const createAccountBtn = new osparc.ui.form.LinkButton(this.tr("Create Account"));
92-
const config = osparc.store.Store.getInstance().get("config");
93-
if (config["invitation_required"]) {
92+
const createAccountAction = osparc.product.Utils.getCreateAccountAction();
93+
if (["REQUEST_ACCOUNT_FORM", "REQUEST_ACCOUNT_INSTRUCTIONS"].includes(createAccountAction)) {
9494
createAccountBtn.setLabel(this.tr("Request Account"));
9595
}
9696
createAccountBtn.addListener("execute", () => {
9797
createAccountBtn.setEnabled(false);
98-
if (config["invitation_required"]) {
99-
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
100-
this.fireEvent("toRequestAccount");
101-
} else {
102-
osparc.store.Support.openInvitationRequiredDialog();
103-
}
104-
} else {
98+
if (createAccountAction === "REGISTER") {
10599
this.fireEvent("toRegister");
100+
} else if (createAccountAction === "REQUEST_ACCOUNT_FORM") {
101+
this.fireEvent("toRequestAccount");
102+
} else if (createAccountAction === "REQUEST_ACCOUNT_FORM") {
103+
osparc.store.Support.openInvitationRequiredDialog();
106104
}
107105
createAccountBtn.setEnabled(true);
108106
}, this);

services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js

Lines changed: 169 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
5959
switch (osparc.product.Utils.getProductName()) {
6060
case "s4l":
6161
case "tis":
62+
case "osparc":
6263
this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email");
6364
break;
6465
case "s4lacad":
@@ -84,6 +85,9 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
8485
case "tis":
8586
this._form.add(organization, this.tr("Organization"), null, "organization");
8687
break;
88+
case "osparc":
89+
this._form.add(organization, this.tr("Research Group/Organization"), null, "organization");
90+
break;
8791
}
8892

8993

@@ -127,84 +131,156 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
127131
this._form.add(country, this.tr("Country"), null, "country");
128132

129133

130-
if (
131-
osparc.product.Utils.isProduct("s4l") ||
132-
osparc.product.Utils.isProduct("s4lacad") ||
133-
osparc.product.Utils.isProduct("s4ldesktopacad")
134-
) {
135-
const application = new qx.ui.form.SelectBox();
136-
[{
137-
id: "Antenna_Design_for_Wireless_Communication",
138-
label: "Antenna Design for Wireless Communication"
139-
}, {
140-
id: "Bioelectronics,_Electroceuticals_and_Neuroprosthetics",
141-
label: "Bioelectronics, Electroceuticals & Neuroprosthetics"
142-
}, {
143-
id: "Safety_and_Efficacy_Assessment",
144-
label: "Safety & Efficacy Assessment"
145-
}, {
146-
id: "Exposure_and_Compliance",
147-
label: "Exposure & Compliance"
148-
}, {
149-
id: "Focused_Ultrasound",
150-
label: "Focused Ultrasound"
151-
}, {
152-
id: "In_Silico_Trials",
153-
label: "In <i>Silico</i> Trials"
154-
}, {
155-
id: "Implant_Design",
156-
label: "Implant Design"
157-
}, {
158-
id: "Magnetic_Resonance_Imaging",
159-
label: "Magnetic Resonance Imaging"
160-
}, {
161-
id: "Neurostimulation",
162-
label: "Neurostimulation"
163-
}, {
164-
id: "Personalized_Medicine",
165-
label: "Personalized Medicine"
166-
}, {
167-
id: "Thermal_Therapies",
168-
label: "Thermal Therapies"
169-
}, {
170-
id: "Wireless_Power_Transfer_Systems",
171-
label: "Wireless Power Transfer Systems"
172-
}, {
173-
id: "Vascular_Flow_and_Perfusion",
174-
label: "Vascular Flow & Perfusion"
175-
}].forEach(appData => {
176-
const lItem = new qx.ui.form.ListItem(appData.label, null, appData.id).set({
177-
rich: true
134+
switch (osparc.product.Utils.getProductName()) {
135+
case "s4l":
136+
case "s4lacad":
137+
case "s4ldesktopacad": {
138+
const application = new qx.ui.form.SelectBox();
139+
[{
140+
id: "Antenna_Design_for_Wireless_Communication",
141+
label: "Antenna Design for Wireless Communication"
142+
}, {
143+
id: "Bioelectronics,_Electroceuticals_and_Neuroprosthetics",
144+
label: "Bioelectronics, Electroceuticals & Neuroprosthetics"
145+
}, {
146+
id: "Safety_and_Efficacy_Assessment",
147+
label: "Safety & Efficacy Assessment"
148+
}, {
149+
id: "Exposure_and_Compliance",
150+
label: "Exposure & Compliance"
151+
}, {
152+
id: "Focused_Ultrasound",
153+
label: "Focused Ultrasound"
154+
}, {
155+
id: "In_Silico_Trials",
156+
label: "In <i>Silico</i> Trials"
157+
}, {
158+
id: "Implant_Design",
159+
label: "Implant Design"
160+
}, {
161+
id: "Magnetic_Resonance_Imaging",
162+
label: "Magnetic Resonance Imaging"
163+
}, {
164+
id: "Neurostimulation",
165+
label: "Neurostimulation"
166+
}, {
167+
id: "Personalized_Medicine",
168+
label: "Personalized Medicine"
169+
}, {
170+
id: "Thermal_Therapies",
171+
label: "Thermal Therapies"
172+
}, {
173+
id: "Wireless_Power_Transfer_Systems",
174+
label: "Wireless Power Transfer Systems"
175+
}, {
176+
id: "Vascular_Flow_and_Perfusion",
177+
label: "Vascular Flow & Perfusion"
178+
}].forEach(appData => {
179+
const lItem = new qx.ui.form.ListItem(appData.label, null, appData.id).set({
180+
rich: true
181+
});
182+
application.add(lItem);
178183
});
179-
application.add(lItem);
180-
});
181-
doubleSpaced.push(application);
182-
this._form.add(application, this.tr("Application"), null, "application");
183-
184+
doubleSpaced.push(application);
185+
this._form.add(application, this.tr("Application"), null, "application");
184186

185-
const description = new qx.ui.form.TextField();
186-
doubleSpaced.push(description);
187-
this._form.add(description, this.tr("Description"), null, "description");
187+
const description = new qx.ui.form.TextField();
188+
doubleSpaced.push(description);
189+
this._form.add(description, this.tr("Description"), null, "description");
190+
break;
191+
}
192+
case "osparc": {
193+
const application = new qx.ui.form.SelectBox();
194+
[{
195+
id: "other",
196+
label: "Other"
197+
}, {
198+
id: "Reuse_Existing_Services_And_Models",
199+
label: "Reuse Existing Services And Models"
200+
}, {
201+
id: "Data_Analysis",
202+
label: "Data Analysis"
203+
}, {
204+
id: "Personalized_Medicine",
205+
label: "Personalized Medicine"
206+
}, {
207+
id: "Neurostimulation",
208+
label: "Neurostimulation"
209+
}, {
210+
id: "Safety_And_Efficacy_Assessment",
211+
label: "Safety & Efficacy Assessment"
212+
}, {
213+
id: "Device_Design_And_Optimization",
214+
label: "Device Design & Optimization"
215+
}, {
216+
id: "Magnetic_Resonance_Imaging",
217+
label: "Magnetic Resonance Imaging"
218+
}, {
219+
id: "Bioelectromagnetics",
220+
label: "Bioelectromagnetics"
221+
}, {
222+
id: "In_Silico_Trials",
223+
label: "In Silico Trials"
224+
}, {
225+
id: "Image_based_Modeling",
226+
label: "Image-based Modeling"
227+
}].forEach(appData => {
228+
const lItem = new qx.ui.form.ListItem(appData.label, null, appData.id).set({
229+
rich: true
230+
});
231+
application.add(lItem);
232+
});
233+
doubleSpaced.push(application);
234+
this._form.add(application, this.tr("Application"), null, "application");
235+
break;
236+
}
188237
}
189238

190239

191240
const hear = new qx.ui.form.SelectBox();
192-
[{
193-
id: "Search_Engine",
194-
label: "Search Engine"
195-
}, {
196-
id: "Conference",
197-
label: "Conference"
198-
}, {
199-
id: "Publication",
200-
label: "Publication"
201-
}, {
202-
id: "Social_Media",
203-
label: "Social Media"
204-
}, {
205-
id: "Other",
206-
label: "Other"
207-
}].forEach(hearData => {
241+
let hearOptions = [];
242+
switch (osparc.product.Utils.getProductName()) {
243+
case "osparc":
244+
hearOptions = [{
245+
id: "Other",
246+
label: "Other"
247+
}, {
248+
id: "SPARC_Portal_Or_Event",
249+
label: "SPARC Portal Or Event"
250+
}, {
251+
id: "Search_Engine",
252+
label: "Search Engine"
253+
}, {
254+
id: "Conference",
255+
label: "Conference"
256+
}, {
257+
id: "Publication",
258+
label: "Publication"
259+
}, {
260+
id: "Social_Media",
261+
label: "Social Media"
262+
}];
263+
break;
264+
default:
265+
hearOptions = [{
266+
id: "Search_Engine",
267+
label: "Search Engine"
268+
}, {
269+
id: "Conference",
270+
label: "Conference"
271+
}, {
272+
id: "Publication",
273+
label: "Publication"
274+
}, {
275+
id: "Social_Media",
276+
label: "Social Media"
277+
}, {
278+
id: "Other",
279+
label: "Other"
280+
}];
281+
break;
282+
}
283+
hearOptions.forEach(hearData => {
208284
const lItem = new qx.ui.form.ListItem(hearData.label, null, hearData.id);
209285
hear.add(lItem);
210286
});
@@ -214,11 +290,17 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
214290

215291
// accept links
216292
// Privacy Policy link
217-
let ppLink = osparc.CookiePolicy.getS4LPrivacyPolicyLink("our privacy policy");
218-
if (osparc.product.Utils.isProduct("tis")) {
219-
ppLink = osparc.CookiePolicy.getITISPrivacyPolicyLink("our privacy policy");
293+
let ppLink = "";
294+
switch (osparc.product.Utils.getProductName()) {
295+
case "osparc":
296+
case "tis":
297+
ppLink = osparc.CookiePolicy.getITISPrivacyPolicyLink("our privacy policy");
298+
break;
299+
default:
300+
ppLink = osparc.CookiePolicy.getS4LPrivacyPolicyLink("our privacy policy");
301+
break;
220302
}
221-
const ppText = this.tr("I acknowledge that data will be processed in accordance with ") + ppLink;
303+
const ppText = this.tr("I acknowledge that data will be processed in accordance to ") + ppLink;
222304
const privacyPolicy = new qx.ui.form.CheckBox().set({
223305
required: true,
224306
value: false
@@ -227,14 +309,17 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
227309
this._form.add(privacyPolicy, ppText, null, "privacyPolicy")
228310

229311
// Eula link
230-
const eulaLink = osparc.CookiePolicy.getZMTEULALink("end users license agreement (EULA)");
231-
const eulaText = "I accept the " + eulaLink + " and I will use the product in accordance with it";
232-
const eula = new qx.ui.form.CheckBox().set({
233-
required: true,
234-
value: false
235-
});
236-
doubleSpaced.push(eula);
237-
this._form.add(eula, eulaText, null, "eula");
312+
if (osparc.product.Utils.getProductName() !== "osparc") {
313+
const eulaLink = osparc.CookiePolicy.getZMTEULALink("end users license agreement (EULA)");
314+
const eulaText = "I accept the " + eulaLink + " and I will use the product in accordance with it";
315+
const eula = new qx.ui.form.CheckBox().set({
316+
required: true,
317+
value: false
318+
});
319+
doubleSpaced.push(eula);
320+
this._form.add(eula, eulaText, null, "eula");
321+
}
322+
238323

239324
const content = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
240325
const formRenderer = new osparc.ui.form.renderer.DoubleV(this._form, doubleSpaced);

0 commit comments

Comments
 (0)