Skip to content

Commit cc7ca45

Browse files
authored
One more feedback option (#1761)
1 parent c152a66 commit cc7ca45

File tree

3 files changed

+151
-28
lines changed

3 files changed

+151
-28
lines changed

services/web/client/source/class/osparc/desktop/NavigationBar.js

Lines changed: 84 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ qx.Class.define("osparc.desktop.NavigationBar", {
6969
},
7070

7171
statics: {
72-
FEEDBACK_FORM_URL: "https://docs.google.com/forms/d/e/1FAIpQLSe232bTigsM2zV97Kjp2OhCenl6o9gNGcDFt2kO_dfkIjtQAQ/viewform?usp=sf_link",
72+
FEEDBACK_GFORM_URL: "https://docs.google.com/forms/d/e/1FAIpQLSe232bTigsM2zV97Kjp2OhCenl6o9gNGcDFt2kO_dfkIjtQAQ/viewform?usp=sf_link",
7373
BUTTON_OPTIONS: {
7474
font: "title-14",
7575
allowGrowY: false,
@@ -103,10 +103,7 @@ qx.Class.define("osparc.desktop.NavigationBar", {
103103
flex: 1
104104
});
105105

106-
if (osparc.utils.Utils.isInZ43()) {
107-
this.getChildControl("z43-manual");
108-
}
109-
this.getChildControl("user-manual");
106+
this.getChildControl("manual");
110107
this.getChildControl("feedback");
111108
this.getChildControl("theme-switch");
112109
this.getChildControl("user-menu");
@@ -141,23 +138,18 @@ qx.Class.define("osparc.desktop.NavigationBar", {
141138
}));
142139
this._add(control);
143140
break;
144-
case "z43-manual":
145-
control = new osparc.ui.form.LinkButton(this.tr("Z43 manual"), "https://itisfoundation.github.io/osparc-manual-z43").set({
146-
appearance: "link-button",
147-
font: "text-14"
148-
});
149-
this._add(control);
150-
break;
151-
case "user-manual":
152-
control = new osparc.ui.form.LinkButton(this.tr("User manual"), "https://docs.osparc.io").set({
153-
appearance: "link-button",
141+
case "manual":
142+
control = this.__createManualMenuBtn();
143+
control.set({
144+
...this.self().BUTTON_OPTIONS,
154145
font: "text-14"
155146
});
156147
this._add(control);
157148
break;
158149
case "feedback":
159-
control = new osparc.ui.form.LinkButton(this.tr("Give us feedback"), this.self().FEEDBACK_FORM_URL).set({
160-
appearance: "link-button",
150+
control = this.__createFeedbackMenuBtn();
151+
control.set({
152+
...this.self().BUTTON_OPTIONS,
161153
font: "text-14"
162154
});
163155
this._add(control);
@@ -241,6 +233,62 @@ qx.Class.define("osparc.desktop.NavigationBar", {
241233
}
242234
},
243235

236+
__createManualMenuBtn: function() {
237+
const manuals = [
238+
[this.tr("User manual"), "https://docs.osparc.io"]
239+
];
240+
if (osparc.utils.Utils.isInZ43()) {
241+
manuals.push([this.tr("Z43 manual"), "https://itisfoundation.github.io/osparc-manual-z43"]);
242+
}
243+
244+
let control = null;
245+
if (manuals.length > 1) {
246+
const menu = new qx.ui.menu.Menu().set({
247+
font: "text-14"
248+
});
249+
250+
manuals.forEach(manual => {
251+
const manualBtn = new qx.ui.menu.Button(manual[0]);
252+
manualBtn.addListener("execute", () => {
253+
window.open(manual[1]);
254+
}, this);
255+
menu.add(manualBtn);
256+
});
257+
258+
control = new qx.ui.form.MenuButton(this.tr("Manuals"), null, menu);
259+
} else {
260+
const manual = manuals[0];
261+
control = new osparc.ui.form.LinkButton(manual[0], manual[1]).set({
262+
appearance: "link-button",
263+
font: "text-14"
264+
});
265+
}
266+
return control;
267+
},
268+
269+
__createFeedbackMenuBtn: function() {
270+
const menu = new qx.ui.menu.Menu().set({
271+
font: "text-14"
272+
});
273+
274+
const newGHIssueBtn = new qx.ui.menu.Button(this.tr("Issue in GitHub"));
275+
newGHIssueBtn.addListener("execute", this.__openGithubIssueInfoDialog, this);
276+
menu.add(newGHIssueBtn);
277+
278+
if (osparc.utils.Utils.isInZ43()) {
279+
const newFogbugzIssueBtn = new qx.ui.menu.Button(this.tr("Issue in Fogbugz"));
280+
newFogbugzIssueBtn.addListener("execute", this.__openFogbugzIssueInfoDialog, this);
281+
menu.add(newFogbugzIssueBtn);
282+
}
283+
284+
const feedbackAnonBtn = new qx.ui.menu.Button(this.tr("Anonymous feedback"));
285+
feedbackAnonBtn.addListener("execute", () => window.open(this.self().FEEDBACK_GFORM_URL));
286+
menu.add(feedbackAnonBtn);
287+
288+
const feedbackBtn = new qx.ui.form.MenuButton(this.tr("Give us feedback"), null, menu);
289+
return feedbackBtn;
290+
},
291+
244292
__createUserMenuBtn: function() {
245293
const menu = new qx.ui.menu.Menu().set({
246294
font: "text-14"
@@ -261,12 +309,6 @@ qx.Class.define("osparc.desktop.NavigationBar", {
261309
helpBtn.addListener("execute", () => window.open("https://docs.osparc.io"));
262310
osparc.utils.Utils.setIdToWidget(helpBtn, "userMenuHelpBtn");
263311
menu.add(helpBtn);
264-
265-
const newIssueBtn = new qx.ui.menu.Button(this.tr("Open issue in GitHub"));
266-
newIssueBtn.addListener("execute", this.__openIssueInfoDialog, this);
267-
osparc.utils.Utils.setIdToWidget(newIssueBtn, "userMenuGithubBtn");
268-
menu.add(newIssueBtn);
269-
270312
const aboutBtn = new qx.ui.menu.Button(this.tr("About"));
271313
aboutBtn.addListener("execute", () => osparc.About.getInstance().open());
272314
osparc.utils.Utils.setIdToWidget(aboutBtn, "userMenuAboutBtn");
@@ -317,13 +359,13 @@ qx.Class.define("osparc.desktop.NavigationBar", {
317359
activityWindow.open();
318360
},
319361

320-
__openIssueInfoDialog: function() {
362+
__openGithubIssueInfoDialog: function() {
321363
const issueConfirmationWindow = new osparc.ui.window.Dialog("Information", null,
322364
this.tr("To create an issue in GitHub, you must have an account in GitHub and be already logged-in.")
323365
);
324366
const contBtn = new qx.ui.toolbar.Button(this.tr("Continue"), "@FontAwesome5Solid/external-link-alt/12");
325367
contBtn.addListener("execute", () => {
326-
window.open(osparc.component.widget.NewGHIssue.getNewIssueUrl());
368+
window.open(osparc.utils.NewGHIssue.getNewIssueUrl());
327369
issueConfirmationWindow.close();
328370
}, this);
329371
const loginBtn = new qx.ui.toolbar.Button(this.tr("Log in in GitHub"), "@FontAwesome5Solid/external-link-alt/12");
@@ -334,6 +376,23 @@ qx.Class.define("osparc.desktop.NavigationBar", {
334376
issueConfirmationWindow.open();
335377
},
336378

379+
__openFogbugzIssueInfoDialog: function() {
380+
const issueConfirmationWindow = new osparc.ui.window.Dialog("Information", null,
381+
this.tr("To create an issue in Fogbugz, you must have an account in Fogbugz and be already logged-in.")
382+
);
383+
const contBtn = new qx.ui.toolbar.Button(this.tr("Continue"), "@FontAwesome5Solid/external-link-alt/12");
384+
contBtn.addListener("execute", () => {
385+
window.open(osparc.utils.NewFogbugzIssue.getNewIssueUrl());
386+
issueConfirmationWindow.close();
387+
}, this);
388+
const loginBtn = new qx.ui.toolbar.Button(this.tr("Log in in Fogbugz"), "@FontAwesome5Solid/external-link-alt/12");
389+
loginBtn.addListener("execute", () => window.open("https://z43.manuscript.com/login"), this);
390+
issueConfirmationWindow.addButton(contBtn);
391+
issueConfirmationWindow.addButton(loginBtn);
392+
issueConfirmationWindow.addCancelButton();
393+
issueConfirmationWindow.open();
394+
},
395+
337396
_applyStudy: function(study) {
338397
if (study) {
339398
study.bind("name", this.__studyTitle, "value");
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* ************************************************************************
2+
3+
osparc - the simcore frontend
4+
5+
https://osparc.io
6+
7+
Copyright:
8+
2020 IT'IS Foundation, https://itis.swiss
9+
10+
License:
11+
MIT: https://opensource.org/licenses/MIT
12+
13+
Authors:
14+
* Odei Maiz (odeimaiz)
15+
16+
************************************************************************ */
17+
18+
/**
19+
* Here is a little example of how to use the widget.
20+
*
21+
* <pre class='javascript'>
22+
* const url = osparc.utils.NewFogbugzIssue.getNewIssueUrl();
23+
* window.open(url);
24+
* </pre>
25+
*/
26+
27+
qx.Class.define("osparc.utils.NewFogbugzIssue", {
28+
type: "static",
29+
30+
statics: {
31+
getNewIssueUrl: function() {
32+
const temp = osparc.utils.NewFogbugzIssue.getTemplate();
33+
let env = "```json\n";
34+
env += JSON.stringify(osparc.utils.LibVersions.getEnvLibs(), null, 2);
35+
env += "\n```";
36+
const body = encodeURIComponent(temp+env);
37+
let url = "https://z43.fogbugz.com/f/cases/new";
38+
url += "?command=new";
39+
url += "&ixProject=45";
40+
url += "&sEvent=" + body;
41+
return url;
42+
},
43+
44+
getTemplate: function() {
45+
return `
46+
## Long story short
47+
<!-- Please describe your review or bug you found. -->
48+
49+
## Expected behaviour
50+
<!-- What is the behaviour you expect? -->
51+
52+
## Actual behaviour
53+
<!-- What's actually happening? -->
54+
55+
## Steps to reproduce
56+
<!-- Please describe steps to reproduce the issue. -->
57+
58+
Note: your environment was attached but will not be displayed
59+
<!--
60+
## Your environment
61+
`;
62+
}
63+
}
64+
});

services/web/client/source/class/osparc/component/widget/NewGHIssue.js renamed to services/web/client/source/class/osparc/utils/NewGHIssue.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
* Here is a little example of how to use the widget.
2020
*
2121
* <pre class='javascript'>
22-
* const url = osparc.component.widget.NewGHIssue.getNewIssueUrl();
22+
* const url = osparc.utils.NewGHIssue.getNewIssueUrl();
2323
* window.open(url);
2424
* </pre>
2525
*/
2626

27-
qx.Class.define("osparc.component.widget.NewGHIssue", {
27+
qx.Class.define("osparc.utils.NewGHIssue", {
2828
type: "static",
2929

3030
statics: {
3131
getNewIssueUrl: function() {
32-
const temp = osparc.component.widget.NewGHIssue.getTemplate();
32+
const temp = osparc.utils.NewGHIssue.getTemplate();
3333
let env = "```json\n";
3434
env += JSON.stringify(osparc.utils.LibVersions.getEnvLibs(), null, 2);
3535
env += "\n```";

0 commit comments

Comments
 (0)