Skip to content

Commit

Permalink
✨ [Frontend] Tester Center (#6745)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 19, 2024
1 parent 8d03d2a commit 3d01610
Show file tree
Hide file tree
Showing 12 changed files with 349 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ qx.Class.define("osparc.data.Permissions", {
"study.nodestree.uuid.read",
"study.filestree.uuid.read",
"study.logger.debug.read",
"statics.read"
],
"product_owner": [
"user.invitation.generate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ qx.Class.define("osparc.desktop.preferences.Preferences", {
if (osparc.product.Utils.showClusters()) {
this.__addClustersPage();
}
if (osparc.data.Permissions.getInstance().canDo("statics.read")) {
this.__addTestersPage();
}
},

members: {
Expand Down Expand Up @@ -85,12 +82,5 @@ qx.Class.define("osparc.desktop.preferences.Preferences", {
.catch(err => console.error(err));
}
},

__addTestersPage: function() {
const title = this.tr("Tester");
const iconSrc = "@FontAwesome5Solid/user-md/24";
const testerPage = new osparc.desktop.preferences.pages.TesterPage();
this.addTab(title, iconSrc, testerPage);
}
}
});

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,6 @@ qx.Class.define("osparc.file.FolderViewer", {
return control || this.base(arguments, id);
},

__getEmptyEntry: function() {
const items = [];
if (this.getMode() === "list") {
items.push([
"",
this.tr("Empty folder"),
"",
"",
""
]);
} else if (this.getMode() === "icons") {
items.push(this.self().getItemButton().set({
label: this.tr("Empty folder")
}));
}
return items;
},

__convertEntries: function(content) {
const items = [];
if (this.getMode() === "list") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ qx.Class.define("osparc.navigation.UserMenu", {
control.addListener("execute", () => osparc.po.POCenterWindow.openWindow(), this);
this.add(control);
break;
case "tester-center":
control = new qx.ui.menu.Button(this.tr("Tester Center"));
control.addListener("execute", () => osparc.tester.TesterCenterWindow.openWindow(), this);
this.add(control);
break;
case "billing-center":
control = new qx.ui.menu.Button(this.tr("Billing Center"));
osparc.utils.Utils.setIdToWidget(control, "userMenuBillingCenterBtn");
Expand Down Expand Up @@ -157,6 +162,9 @@ qx.Class.define("osparc.navigation.UserMenu", {
if (osparc.data.Permissions.getInstance().isProductOwner()) {
this.getChildControl("po-center");
}
if (osparc.data.Permissions.getInstance().isTester()) {
this.getChildControl("tester-center");
}
if (osparc.desktop.credits.Utils.areWalletsEnabled()) {
this.getChildControl("billing-center");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

qx.Class.define("osparc.tester.Statics", {
extend: osparc.po.BaseView,

members: {
_createChildControlImpl: function(id) {
let control;
switch (id) {
case "statics-container":
control = osparc.ui.window.TabbedView.createSectionBox(this.tr("Statics"));
this._add(control, {
flex: 1
});
break;
case "statics-content": {
const statics = osparc.store.Store.getInstance().get("statics");
const form = new qx.ui.form.Form();
for (let [key, value] of Object.entries(statics)) {
const textField = new qx.ui.form.TextField().set({
value: typeof value === "object" ? JSON.stringify(value) : value.toString(),
readOnly: true
});
form.add(textField, key, null, key);
}
const renderer = new qx.ui.form.renderer.Single(form);
control = new qx.ui.container.Scroll(renderer);
this.getChildControl("statics-container").add(control);
break;
}
case "local-storage-container":
control = osparc.ui.window.TabbedView.createSectionBox(this.tr("Local Storage"));
this._add(control);
break;
case "local-storage-content": {
const items = {
...window.localStorage
};
const form = new qx.ui.form.Form();
for (let [key, value] of Object.entries(items)) {
const textField = new qx.ui.form.TextField().set({
value: typeof value === "object" ? JSON.stringify(value) : value.toString(),
readOnly: true
});
form.add(textField, key, null, key);
}
control = new qx.ui.form.renderer.Single(form);
this.getChildControl("local-storage-container").add(control);
break;
}
}
return control || this.base(arguments, id);
},

_buildLayout: function() {
this.getChildControl("statics-content");
this.getChildControl("local-storage-content");
},
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

qx.Class.define("osparc.tester.TesterCenter", {
extend: osparc.ui.window.TabbedView,

construct: function() {
this.base(arguments);

const miniProfile = osparc.desktop.account.MyAccount.createMiniProfileView().set({
paddingRight: 10
});
this.addWidgetOnTopOfTheTabs(miniProfile);

this.__addSocketMessagesPage();
this.__addStaticsPage();
},

members: {
__addSocketMessagesPage: function() {
const title = this.tr("Socket Messages");
const iconSrc = "@FontAwesome5Solid/exchange-alt/22";
const maintenance = new osparc.tester.WebSocketMessages();
this.addTab(title, iconSrc, maintenance);
},

__addStaticsPage: function() {
const title = this.tr("Statics");
const iconSrc = "@FontAwesome5Solid/wrench/22";
const maintenance = new osparc.tester.Statics();
this.addTab(title, iconSrc, maintenance);
},
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

qx.Class.define("osparc.tester.TesterCenterWindow", {
extend: osparc.ui.window.TabbedWindow,

construct: function() {
this.base(arguments, "tester-center", this.tr("Tester Center"));

const width = 800;
const maxHeight = 800;
this.set({
width,
maxHeight,
});

const testerCenter = new osparc.tester.TesterCenter();
this._setTabbedView(testerCenter);
},

statics: {
openWindow: function() {
const accountWindow = new osparc.tester.TesterCenterWindow();
accountWindow.center();
accountWindow.open();
return accountWindow;
}
}
});
Loading

0 comments on commit 3d01610

Please sign in to comment.