|
| 1 | +/* |
| 2 | + * oSPARC - The SIMCORE frontend - https://osparc.io |
| 3 | + * Copyright: 2025 IT'IS Foundation - https://itis.swiss |
| 4 | + * License: MIT - https://opensource.org/licenses/MIT |
| 5 | + * Authors: Odei Maiz (odeimaiz) |
| 6 | + */ |
| 7 | + |
| 8 | +qx.Class.define("osparc.share.RequestServiceAccess", { |
| 9 | + extend: qx.ui.core.Widget, |
| 10 | + |
| 11 | + construct: function(cantReadServicesData) { |
| 12 | + this.base(arguments); |
| 13 | + |
| 14 | + this._setLayout(new qx.ui.layout.VBox(25)); |
| 15 | + |
| 16 | + this.__populateLayout(cantReadServicesData); |
| 17 | + }, |
| 18 | + |
| 19 | + statics: { |
| 20 | + openRequestAccess: function(cantReadServicesData) { |
| 21 | + const requestServiceAccess = new osparc.share.RequestServiceAccess(cantReadServicesData); |
| 22 | + const caption = qx.locale.Manager.tr("Request Apps Access"); |
| 23 | + osparc.ui.window.Window.popUpInWindow(requestServiceAccess, caption, 500, 500).set({ |
| 24 | + clickAwayClose: false, |
| 25 | + resizable: true, |
| 26 | + showClose: true |
| 27 | + }); |
| 28 | + } |
| 29 | + }, |
| 30 | + |
| 31 | + members: { |
| 32 | + __populateLayout: function(cantReadServicesData) { |
| 33 | + const text = this.tr("In order to open the Project, the following users/groups need to give you access to some apps. Please contact the app owner(s):"); |
| 34 | + this._add(new qx.ui.basic.Label().set({ |
| 35 | + value: text, |
| 36 | + font: "text-14", |
| 37 | + rich: true, |
| 38 | + wrap: true |
| 39 | + })); |
| 40 | + |
| 41 | + const grid = new qx.ui.layout.Grid(20, 10); |
| 42 | + grid.setColumnAlign(0, "center", "middle"); |
| 43 | + grid.setColumnAlign(1, "center", "middle"); |
| 44 | + const layout = new qx.ui.container.Composite(grid); |
| 45 | + this._add(layout); |
| 46 | + |
| 47 | + // Header |
| 48 | + layout.add(new qx.ui.basic.Label(this.tr("Owner"), { |
| 49 | + row: idx+1, |
| 50 | + column: 0 |
| 51 | + })); |
| 52 | + layout.add(new qx.ui.basic.Label(this.tr("App"), { |
| 53 | + row: idx+1, |
| 54 | + column: 1 |
| 55 | + })); |
| 56 | + |
| 57 | + cantReadServicesData.forEach((cantReadServiceData, idx) => { |
| 58 | + const group = osparc.store.Groups.getInstance().getGroup(cantReadServiceData["owner"]); |
| 59 | + if (group) { |
| 60 | + layout.add(new qx.ui.basic.Label(group.getLabel()), { |
| 61 | + row: idx+1, |
| 62 | + column: 0 |
| 63 | + }); |
| 64 | + const appLabel = new qx.ui.basic.Label().set({ |
| 65 | + value: `${cantReadServiceData["key"]} : ${osparc.service.Utils.extractVersionDisplay(cantReadServiceData["release"])}`, |
| 66 | + }); |
| 67 | + layout.add(appLabel, { |
| 68 | + row: i, |
| 69 | + column: 1 |
| 70 | + }); |
| 71 | + } |
| 72 | + }); |
| 73 | + } |
| 74 | + } |
| 75 | +}); |
0 commit comments