Skip to content

Commit 9fffac8

Browse files
committed
uuidToShort
1 parent 01953cf commit 9fffac8

File tree

2 files changed

+48
-28
lines changed

2 files changed

+48
-28
lines changed

services/static-webserver/client/source/class/osparc/support/ConversationPage.js

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,49 +88,65 @@ qx.Class.define("osparc.support.ConversationPage", {
8888
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(2));
8989
this.getChildControl("conversation-header-center-layout").addAt(control, 1);
9090
break;
91-
case "open-project-button":
92-
control = new qx.ui.form.Button().set({
93-
maxWidth: 26,
91+
case "buttons-layout":
92+
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
93+
alignY: "middle",
94+
})).set({
9495
maxHeight: 24,
96+
});
97+
this.getChildControl("conversation-header-layout").addAt(control, 2);
98+
break;
99+
case "rename-conversation-button": {
100+
control = new qx.ui.form.Button().set({
101+
icon: "@FontAwesome5Solid/i-cursor/12",
102+
toolTipText: this.tr("Rename"),
95103
alignX: "center",
96104
alignY: "middle",
105+
});
106+
control.addListener("execute", () => this.__renameConversation());
107+
this.getChildControl("buttons-layout").addAt(control, 0);
108+
break;
109+
}
110+
case "open-project-button":
111+
control = new qx.ui.form.Button().set({
97112
icon: "@FontAwesome5Solid/external-link-alt/12",
113+
alignX: "center",
114+
alignY: "middle",
98115
});
99116
control.addListener("execute", () => this.__openProjectDetails());
100-
this.getChildControl("conversation-header-layout").addAt(control, 2);
117+
this.getChildControl("buttons-layout").addAt(control, 1);
101118
break;
102-
case "set-appointment-button": {
119+
case "copy-ticket-id-button": {
103120
control = new qx.ui.form.Button().set({
104-
maxWidth: 26,
105-
maxHeight: 24,
106-
padding: [0, 6],
121+
icon: "@FontAwesome5Solid/copy/12",
122+
toolTipText: this.tr("Copy ID"),
107123
alignX: "center",
108124
alignY: "middle",
109-
icon: "@FontAwesome5Solid/clock/12",
110125
});
111126
control.addListener("execute", () => this.__openAppointmentDetails());
112-
this.getChildControl("conversation-header-layout").addAt(control, 3);
127+
this.getChildControl("buttons-layout").addAt(control, 2);
113128
break;
114129
}
115-
case "conversation-options": {
116-
control = new qx.ui.form.MenuButton().set({
117-
maxWidth: 24,
118-
maxHeight: 24,
130+
case "open-ticket-link-button": {
131+
control = new qx.ui.form.Button().set({
132+
icon: "@FontAwesome5Solid/link/12",
133+
toolTipText: this.tr("Open Ticket"),
119134
alignX: "center",
120135
alignY: "middle",
121-
icon: "@FontAwesome5Solid/ellipsis-v/12",
122-
});
123-
const menu = new qx.ui.menu.Menu().set({
124-
position: "bottom-right",
125136
});
126-
control.setMenu(menu);
127-
const renameButton = new qx.ui.menu.Button().set({
128-
label: this.tr("Rename"),
129-
icon: "@FontAwesome5Solid/i-cursor/10"
137+
control.addListener("execute", () => this.__openAppointmentDetails());
138+
this.getChildControl("buttons-layout").addAt(control, 3);
139+
break;
140+
}
141+
case "set-appointment-button": {
142+
control = new qx.ui.form.Button().set({
143+
icon: "@FontAwesome5Solid/clock/12",
144+
toolTipText: this.tr("Set Appointment"),
145+
alignX: "center",
146+
alignY: "middle",
130147
});
131-
renameButton.addListener("execute", () => this.__renameConversation());
132-
menu.add(renameButton);
133-
this.getChildControl("conversation-header-layout").addAt(control, 4);
148+
control.addListener("execute", () => this.__openAppointmentDetails());
149+
this.getChildControl("buttons-layout").addAt(control, 4);
134150
break;
135151
}
136152
case "conversation-content":
@@ -190,11 +206,11 @@ qx.Class.define("osparc.support.ConversationPage", {
190206
extraContextLayout.removeAll();
191207
const extraContext = conversation.getExtraContext();
192208
if (extraContext && Object.keys(extraContext).length) {
193-
const ticketIdLabel = createExtraContextLabel(`Ticket ID: ${conversation.getConversationId()}`);
209+
const ticketIdLabel = createExtraContextLabel(`Ticket ID: ${osparc.utils.Utils.uuidToShort(conversation.getConversationId())}`);
194210
extraContextLayout.add(ticketIdLabel);
195211
const contextProjectId = conversation.getContextProjectId();
196212
if (contextProjectId && amISupporter) {
197-
const projectIdLabel = createExtraContextLabel(`Project ID: ${contextProjectId}`);
213+
const projectIdLabel = createExtraContextLabel(`Project ID: ${osparc.utils.Utils.uuidToShort(contextProjectId)}`);
198214
extraContextLayout.add(projectIdLabel);
199215
}
200216
/*
@@ -230,7 +246,7 @@ qx.Class.define("osparc.support.ConversationPage", {
230246
openProjectButton.exclude();
231247
}
232248

233-
const options = this.getChildControl("conversation-options");
249+
const options = this.getChildControl("rename-conversation-button");
234250
if (conversation) {
235251
options.show();
236252
} else {

services/static-webserver/client/source/class/osparc/utils/Utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,10 @@ qx.Class.define("osparc.utils.Utils", {
778778
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
779779
},
780780

781+
uuidToShort: function() {
782+
return this.uuidV4().split("-")[0];
783+
},
784+
781785
isInZ43: function() {
782786
return window.location.hostname.includes("speag");
783787
},

0 commit comments

Comments
 (0)