@tuki-io/tuki-widgets 0.0.219-dev.57 → 0.0.219-dev.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/workspaces/src/services/workspaces.service.mjs +64 -23
- package/esm2020/workspaces/src/workspaces.component.mjs +4 -4
- package/fesm2015/tuki-io-tuki-widgets-workspaces.mjs +57 -21
- package/fesm2015/tuki-io-tuki-widgets-workspaces.mjs.map +1 -1
- package/fesm2020/tuki-io-tuki-widgets-workspaces.mjs +66 -25
- package/fesm2020/tuki-io-tuki-widgets-workspaces.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -241,6 +241,29 @@ function toStatus(provisioningStatus) {
|
|
|
241
241
|
}
|
|
242
242
|
return provisioningStatus.toLowerCase() === 'active' ? 'active' : 'inactive';
|
|
243
243
|
}
|
|
244
|
+
function toWorkspaceDevices(item, index) {
|
|
245
|
+
if (item.workspaceDevices?.length) {
|
|
246
|
+
return item.workspaceDevices.map(workspaceDevice => ({
|
|
247
|
+
id: workspaceDevice.deviceId,
|
|
248
|
+
kind: 'device',
|
|
249
|
+
label: workspaceDevice.model || workspaceDevice.mac,
|
|
250
|
+
model: workspaceDevice.model,
|
|
251
|
+
mac: workspaceDevice.mac,
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
const device = item.device;
|
|
255
|
+
if (!device) {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
const model = device.deviceType || device.userDeviceType || undefined;
|
|
259
|
+
return [{
|
|
260
|
+
id: device.pkid || device.webexUUID || device.name || `device-${index}`,
|
|
261
|
+
kind: 'device',
|
|
262
|
+
label: model || device.name || 'Unnamed device',
|
|
263
|
+
model,
|
|
264
|
+
mac: /^SEP/i.test(device.name || '') ? device.name.slice(3) : undefined,
|
|
265
|
+
}];
|
|
266
|
+
}
|
|
244
267
|
function toWorkspace(item, index, isCucm) {
|
|
245
268
|
const device = item.device;
|
|
246
269
|
const firstDirectoryNumber = device.associatedDNs?.[0]?.directoryNumber ?? '';
|
|
@@ -251,13 +274,7 @@ function toWorkspace(item, index, isCucm) {
|
|
|
251
274
|
capacity: null,
|
|
252
275
|
location: item.site?.name || device.siteName || device.location || '',
|
|
253
276
|
siteId: item.site?.id ?? null,
|
|
254
|
-
devices: (item
|
|
255
|
-
id: workspaceDevice.deviceId,
|
|
256
|
-
kind: 'device',
|
|
257
|
-
label: workspaceDevice.model || workspaceDevice.mac,
|
|
258
|
-
model: workspaceDevice.model,
|
|
259
|
-
mac: workspaceDevice.mac,
|
|
260
|
-
})),
|
|
277
|
+
devices: toWorkspaceDevices(item, index),
|
|
261
278
|
scheduling: 'Not set',
|
|
262
279
|
callingLicense: firstDirectoryNumber,
|
|
263
280
|
provisioningType: 'On-premises',
|
|
@@ -276,20 +293,43 @@ function mergeDevices(a, b) {
|
|
|
276
293
|
webexUUID: b.webexUUID ?? a.webexUUID,
|
|
277
294
|
};
|
|
278
295
|
}
|
|
279
|
-
function
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
function toMacKey(value) {
|
|
297
|
+
return value ? withoutSep(value).replace(/[^0-9A-F]/g, '') : '';
|
|
298
|
+
}
|
|
299
|
+
function mergeCucmAndWebexWorkspaces(cucmWorkspaces, webexItems, webexWorkspaces) {
|
|
300
|
+
const result = [...cucmWorkspaces];
|
|
301
|
+
const cucmIndexByMac = new Map();
|
|
302
|
+
cucmWorkspaces.forEach((workspace, index) => {
|
|
303
|
+
const key = toMacKey(workspace.device.name);
|
|
304
|
+
if (key && !cucmIndexByMac.has(key)) {
|
|
305
|
+
cucmIndexByMac.set(key, index);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
webexWorkspaces.forEach((webexWorkspace, webexIndex) => {
|
|
309
|
+
const matchedMac = (webexItems[webexIndex].workspaceDevices || [])
|
|
310
|
+
.map(workspaceDevice => toMacKey(workspaceDevice.mac))
|
|
311
|
+
.find(key => key && cucmIndexByMac.has(key));
|
|
312
|
+
if (!matchedMac) {
|
|
313
|
+
result.push(webexWorkspace);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const cucmIndex = cucmIndexByMac.get(matchedMac);
|
|
317
|
+
cucmIndexByMac.delete(matchedMac);
|
|
318
|
+
const cucmWorkspace = result[cucmIndex];
|
|
319
|
+
result[cucmIndex] = {
|
|
320
|
+
...cucmWorkspace,
|
|
321
|
+
...webexWorkspace,
|
|
322
|
+
displayName: cucmWorkspace.displayName,
|
|
323
|
+
device: {
|
|
324
|
+
...mergeDevices(cucmWorkspace.device, webexWorkspace.device),
|
|
325
|
+
name: cucmWorkspace.device.name,
|
|
326
|
+
newName: cucmWorkspace.device.newName,
|
|
327
|
+
},
|
|
288
328
|
isHybrid: true,
|
|
289
|
-
cucmDeviceName:
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return
|
|
329
|
+
cucmDeviceName: cucmWorkspace.cucmDeviceName,
|
|
330
|
+
};
|
|
331
|
+
});
|
|
332
|
+
return result;
|
|
293
333
|
}
|
|
294
334
|
const FETCH_ALL_SIZE = 9999;
|
|
295
335
|
class WorkspacesService {
|
|
@@ -315,9 +355,10 @@ class WorkspacesService {
|
|
|
315
355
|
return forkJoin([cucm$, webex$]).pipe(map(([cucmResponse, webexResponse]) => {
|
|
316
356
|
const cucmParsed = parseResponse(cucmResponse);
|
|
317
357
|
const webexParsed = parseResponse(webexResponse);
|
|
358
|
+
const webexItems = webexParsed?.pageData || [];
|
|
318
359
|
const cucmWorkspaces = (cucmParsed?.pageData || []).map((item, index) => toWorkspace(item, index, true));
|
|
319
|
-
const webexWorkspaces =
|
|
320
|
-
const workspaces =
|
|
360
|
+
const webexWorkspaces = webexItems.map((item, index) => toWorkspace(item, index, false));
|
|
361
|
+
const workspaces = mergeCucmAndWebexWorkspaces(cucmWorkspaces, webexItems, webexWorkspaces);
|
|
321
362
|
return {
|
|
322
363
|
workspaces,
|
|
323
364
|
total: workspaces.length,
|
|
@@ -987,9 +1028,9 @@ class WorkspacesComponent {
|
|
|
987
1028
|
onMoveToMT(workspace) {
|
|
988
1029
|
const dialogRef = this.dialog.open(WorkspaceConfirmDialogComponent, {
|
|
989
1030
|
data: {
|
|
990
|
-
title: `Upgrade workspace ${workspace.displayName} to
|
|
991
|
-
message: `<p>Upgrading this workspace will prepare it for migration to
|
|
992
|
-
<p>During this process, the workspace configuration will be copied to the
|
|
1031
|
+
title: `Upgrade workspace ${workspace.displayName} to Webex Calling?`,
|
|
1032
|
+
message: `<p>Upgrading this workspace will prepare it for migration to Webex Calling.</p>
|
|
1033
|
+
<p>During this process, the workspace configuration will be copied to the Webex Calling environment.
|
|
993
1034
|
The workspace will remain active on the current system until the Activate step is completed.</p>
|
|
994
1035
|
<p>Do you want to continue?</p>`,
|
|
995
1036
|
confirmButtonText: 'Yes, upgrade',
|