|
| 1 | +/* ************************************************************************ |
| 2 | +
|
| 3 | + osparc - the simcore frontend |
| 4 | +
|
| 5 | + https://osparc.io |
| 6 | +
|
| 7 | + Copyright: |
| 8 | + 2025 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 | +qx.Class.define("osparc.ui.message.FlashMessageOEC", { |
| 19 | + extend: osparc.ui.message.FlashMessage, |
| 20 | + |
| 21 | + /** |
| 22 | + * Constructor for the FlashMessage. |
| 23 | + * |
| 24 | + * @param {String} message Message that the user will read. |
| 25 | + * @param {Number} duration |
| 26 | + * @param {String} supportId |
| 27 | + */ |
| 28 | + construct: function(message, duration, supportId) { |
| 29 | + this.base(arguments, message, "ERROR", duration*2); |
| 30 | + |
| 31 | + const oecAtom = this.getChildControl("oec-atom"); |
| 32 | + this.bind("supportId", oecAtom, "label"); |
| 33 | + this.setSupportId(supportId); |
| 34 | + }, |
| 35 | + |
| 36 | + properties: { |
| 37 | + supportId: { |
| 38 | + check: "String", |
| 39 | + nullable: true, |
| 40 | + event: "changeSupportId", |
| 41 | + }, |
| 42 | + }, |
| 43 | + |
| 44 | + members: { |
| 45 | + _createChildControlImpl: function(id) { |
| 46 | + let control; |
| 47 | + switch (id) { |
| 48 | + case "oec-atom": |
| 49 | + control = new qx.ui.basic.Atom().set({ |
| 50 | + icon: "@FontAwesome5Solid/copy/10", |
| 51 | + iconPosition: "right", |
| 52 | + gap: 8, |
| 53 | + cursor: "pointer", |
| 54 | + alignX: "center", |
| 55 | + allowGrowX: false, |
| 56 | + }); |
| 57 | + control.addListener("tap", () => { |
| 58 | + const currentStudy = osparc.store.Store.getInstance().getCurrentStudy(); |
| 59 | + const dataToClipboard = { |
| 60 | + message: this.getMessage(), |
| 61 | + supportId: this.getSupportId(), |
| 62 | + timestamp: new Date().toString(), |
| 63 | + url: window.location.href, |
| 64 | + releaseTag: osparc.utils.Utils.getReleaseTag(), |
| 65 | + studyId: currentStudy ? currentStudy.getUuid() : "", |
| 66 | + } |
| 67 | + osparc.utils.Utils.copyTextToClipboard(osparc.utils.Utils.prettifyJson(dataToClipboard)); |
| 68 | + }); |
| 69 | + this.addWidget(control); |
| 70 | + break; |
| 71 | + } |
| 72 | + return control || this.base(arguments, id); |
| 73 | + }, |
| 74 | + } |
| 75 | +}); |
0 commit comments