-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 [Frontend] Enh: User Account UI #8361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
27a37f9
cleanup
odeimaiz 3d8c7b7
disabled danger-button is not dangerous
odeimaiz 31464c7
tabbed window
odeimaiz 6fac73c
pass info
odeimaiz d17d93f
cleanup
odeimaiz 15a3f7f
isDateLike
odeimaiz 17bae48
minor
odeimaiz 2a5dfb1
Merge branch 'master' into enh/search-by-gid
odeimaiz 3b3b5ff
Update services/static-webserver/client/source/class/osparc/utils/Uti…
odeimaiz 830d8ab
handle error
odeimaiz 9f45d00
Merge branch 'enh/search-by-gid' of github.com:odeimaiz/osparc-simcor…
odeimaiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
services/static-webserver/client/source/class/osparc/user/UserAccount.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /* ************************************************************************ | ||
|
|
||
| osparc - the simcore frontend | ||
|
|
||
| https://osparc.io | ||
|
|
||
| Copyright: | ||
| 2025 IT'IS Foundation, https://itis.swiss | ||
|
|
||
| License: | ||
| MIT: https://opensource.org/licenses/MIT | ||
|
|
||
| Authors: | ||
| * Odei Maiz (odeimaiz) | ||
|
|
||
| ************************************************************************ */ | ||
|
|
||
| qx.Class.define("osparc.user.UserAccount", { | ||
| extend: osparc.ui.window.TabbedView, | ||
|
|
||
| construct: function(userGroupId) { | ||
| this.base(arguments); | ||
|
|
||
| this.set({ | ||
| padding: 10, | ||
| }); | ||
|
|
||
| this.getChildControl("thumbnail"); | ||
| const profilePage = this.getChildControl("profile-page"); | ||
| const extras = this.getChildControl("extras-page"); | ||
| this.bind("user", profilePage, "user"); | ||
| this.bind("extras", extras, "extras"); | ||
|
|
||
| this.setUserGroupId(userGroupId); | ||
| }, | ||
|
|
||
| properties: { | ||
| userGroupId: { | ||
| check: "Number", | ||
| init: null, | ||
| nullable: false, | ||
| apply: "__applyUserGroupId", | ||
| }, | ||
|
|
||
| user: { | ||
| check: "osparc.data.model.User", | ||
| init: null, | ||
| nullable: false, | ||
| event: "changeUser", | ||
| }, | ||
|
|
||
| extras: { | ||
| check: "Object", | ||
| init: null, | ||
| nullable: false, | ||
| event: "changeExtras", | ||
| }, | ||
| }, | ||
|
|
||
| events: { | ||
| "updateCaption": "qx.event.type.Data", | ||
| "closeWindow": "qx.event.type.Event", | ||
| }, | ||
|
|
||
| statics: { | ||
| THUMBNAIL_SIZE: 90, | ||
| }, | ||
|
|
||
| members: { | ||
| _createChildControlImpl: function(id) { | ||
| let control; | ||
| switch (id) { | ||
| case "thumbnail": | ||
| control = new osparc.ui.basic.Thumbnail(null, this.self().THUMBNAIL_SIZE, this.self().THUMBNAIL_SIZE).set({ | ||
| width: this.self().THUMBNAIL_SIZE, | ||
| height: this.self().THUMBNAIL_SIZE, | ||
| marginBottom: 10, | ||
| }); | ||
| control.getChildControl("image").set({ | ||
| anonymous: true, | ||
| decorator: "rounded", | ||
| }); | ||
| this.addWidgetToTabs(control); | ||
| break; | ||
| case "profile-page": | ||
| control = new osparc.user.UserProfile(); | ||
| this.addTab("Profile", "", control); | ||
| break; | ||
| case "extras-page": | ||
| control = new osparc.user.UserExtras(); | ||
| this.addTab("Extras", "", control); | ||
| break; | ||
| } | ||
| return control || this.base(arguments, id); | ||
| }, | ||
|
|
||
| __applyUserGroupId: function(userGroupId) { | ||
| const params = { | ||
| url: { | ||
| gId: userGroupId | ||
| } | ||
| }; | ||
| osparc.data.Resources.fetch("poUsers", "searchByGroupId", params) | ||
| .then(usersData => { | ||
| if (usersData.length === 1) { | ||
| const userData = usersData[0]; | ||
|
|
||
| const user = new osparc.data.model.User(userData); | ||
| user.setContactData(userData); | ||
| // remove the displayed properties from the contact info | ||
| Object.keys(qx.util.PropertyUtil.getProperties(osparc.data.model.User)).forEach(prop => delete userData[prop]); | ||
| const extras = osparc.utils.Utils.convertKeysToTitles(userData); | ||
|
|
||
| this.fireDataEvent("updateCaption", user.getUserName()); | ||
| this.getChildControl("thumbnail").setSource(user.createThumbnail(this.self().THUMBNAIL_SIZE)); | ||
| this.setUser(user); | ||
| this.setExtras(extras); | ||
| } | ||
| }) | ||
| .catch(err => { | ||
| osparc.FlashMessenger.logError(err); | ||
| console.error(err); | ||
| this.fireEvent("closeWindow"); | ||
| }); | ||
| }, | ||
| } | ||
| }); |
46 changes: 46 additions & 0 deletions
46
services/static-webserver/client/source/class/osparc/user/UserAccountWindow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* ************************************************************************ | ||
|
|
||
| osparc - the simcore frontend | ||
|
|
||
| https://osparc.io | ||
|
|
||
| Copyright: | ||
| 2025 IT'IS Foundation, https://itis.swiss | ||
|
|
||
| License: | ||
| MIT: https://opensource.org/licenses/MIT | ||
|
|
||
| Authors: | ||
| * Odei Maiz (odeimaiz) | ||
|
|
||
| ************************************************************************ */ | ||
|
|
||
| qx.Class.define("osparc.user.UserAccountWindow", { | ||
| extend: osparc.ui.window.TabbedWindow, | ||
|
|
||
| construct: function(userGroupId) { | ||
| this.base(arguments, "user-account-"+userGroupId, this.tr("User Account")); | ||
|
|
||
| this.set({ | ||
| width: osparc.user.UserAccountWindow.WIDTH, | ||
| height: osparc.user.UserAccountWindow.HEIGHT, | ||
| }); | ||
|
|
||
| const userAccount = new osparc.user.UserAccount(userGroupId); | ||
| userAccount.addListener("updateCaption", e => this.setCaption(e.getData())); | ||
| userAccount.addListener("closeWindow", () => this.close(), this); | ||
| this._setTabbedView(userAccount); | ||
| }, | ||
|
|
||
| statics: { | ||
| WIDTH: 500, | ||
| HEIGHT: 500, | ||
|
|
||
| openWindow: function(userGroupId) { | ||
| const userAccountWindow = new osparc.user.UserAccountWindow(userGroupId); | ||
| userAccountWindow.center(); | ||
| userAccountWindow.open(); | ||
| return userAccountWindow; | ||
| }, | ||
| }, | ||
| }); |
58 changes: 58 additions & 0 deletions
58
services/static-webserver/client/source/class/osparc/user/UserExtras.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* ************************************************************************ | ||
|
|
||
| osparc - the simcore frontend | ||
|
|
||
| https://osparc.io | ||
|
|
||
| Copyright: | ||
| 2025 IT'IS Foundation, https://itis.swiss | ||
|
|
||
| License: | ||
| MIT: https://opensource.org/licenses/MIT | ||
|
|
||
| Authors: | ||
| * Odei Maiz (odeimaiz) | ||
|
|
||
| ************************************************************************ */ | ||
|
|
||
| qx.Class.define("osparc.user.UserExtras", { | ||
| extend: qx.ui.core.Widget, | ||
|
|
||
| construct: function() { | ||
| this.base(arguments); | ||
|
|
||
| this._setLayout(new qx.ui.layout.VBox(10)); | ||
| }, | ||
|
|
||
| properties: { | ||
| extras: { | ||
| check: "Object", | ||
| init: null, | ||
| nullable: true, | ||
| event: "changeExtras", | ||
| apply: "__applyExtras", | ||
| } | ||
| }, | ||
|
|
||
| members: { | ||
| __applyExtras: function(extras) { | ||
| if (!extras) { | ||
| return; | ||
| } | ||
|
|
||
| for (const key in extras) { | ||
| const value = extras[key]; | ||
| if (osparc.utils.Utils.isDateLike(value)) { | ||
| extras[key] = osparc.utils.Utils.formatDateAndTime(new Date(value)); | ||
| } | ||
| } | ||
|
|
||
| const jsonViewer = new osparc.widget.JsonFormatterWidget(extras); | ||
| const scroll = new qx.ui.container.Scroll(); | ||
| scroll.add(jsonViewer); | ||
| this._add(scroll, { | ||
| flex: 1 | ||
| }); | ||
| }, | ||
| } | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.