@digital-ai/dot-components 2.3.1 → 2.3.2
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/CHANGE_LOG.md +16 -2
- package/index.esm.js +46 -24
- package/index.umd.js +66 -40
- package/lib/components/app-switcher/AppSwitcher.d.ts +2 -1
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.2](https://www.npmjs.com/package/@digital-ai/dot-components) (02/23/2023)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.3.1...2.3.2)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- S-89896: Still trying to get SQ off its \(non-\)duplicate obsession [\#1388](https://github.com/digital-ai/dot-components/pull/1388) ([jmcnally](https://github.com/jmcnally))
|
|
10
|
+
- S-89896: Sort app types alphabetically [\#1384](https://github.com/digital-ai/dot-components/pull/1384) ([jmcnally](https://github.com/jmcnally))
|
|
11
|
+
- S-89896: Handle non-product apps in their own group [\#1381](https://github.com/digital-ai/dot-components/pull/1381) ([jmcnally](https://github.com/jmcnally))
|
|
12
|
+
|
|
3
13
|
## [2.3.1](https://www.npmjs.com/package/@digital-ai/dot-components) (02/15/2023)
|
|
4
14
|
|
|
5
15
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.3.0...2.3.1)
|
|
@@ -226,6 +236,7 @@
|
|
|
226
236
|
**Fixed bugs:**
|
|
227
237
|
|
|
228
238
|
- S-86692: component cleanup [\#1238](https://github.com/digital-ai/dot-components/pull/1238) ([CWSites](https://github.com/CWSites))
|
|
239
|
+
- S-84151: fix e2e tests for Release 2.0 [\#1146](https://github.com/digital-ai/dot-components/pull/1146) ([CWSites](https://github.com/CWSites))
|
|
229
240
|
|
|
230
241
|
**Misc:**
|
|
231
242
|
|
|
@@ -277,7 +288,6 @@
|
|
|
277
288
|
|
|
278
289
|
**Fixed bugs:**
|
|
279
290
|
|
|
280
|
-
- D-20378: update input margin to account for helper text [\#1212](https://github.com/digital-ai/dot-components/pull/1212) ([CWSites](https://github.com/CWSites))
|
|
281
291
|
- D-21918: Update `DotAlertBanner` to match Figma [\#1208](https://github.com/digital-ai/dot-components/pull/1208) ([CWSites](https://github.com/CWSites))
|
|
282
292
|
|
|
283
293
|
## [1.19.1](https://www.npmjs.com/package/@digital-ai/dot-components) (07/18/2022)
|
|
@@ -289,6 +299,7 @@
|
|
|
289
299
|
- D-22029: `DotAutocomplete`: fix id attribute on input [\#1217](https://github.com/digital-ai/dot-components/pull/1217) ([angel-git](https://github.com/angel-git))
|
|
290
300
|
- D-20693: `DotSidebar` updates to match Figma [\#1214](https://github.com/digital-ai/dot-components/pull/1214) ([CWSites](https://github.com/CWSites))
|
|
291
301
|
- D-20329: add href to application logo [\#1213](https://github.com/digital-ai/dot-components/pull/1213) ([CWSites](https://github.com/CWSites))
|
|
302
|
+
- D-20378: update input margin to account for helper text [\#1212](https://github.com/digital-ai/dot-components/pull/1212) ([CWSites](https://github.com/CWSites))
|
|
292
303
|
- D-20404: update table border color [\#1211](https://github.com/digital-ai/dot-components/pull/1211) ([CWSites](https://github.com/CWSites))
|
|
293
304
|
- D-21972: Adds props for custom tooltip position in ListItemProps [\#1207](https://github.com/digital-ai/dot-components/pull/1207) ([s-zimm](https://github.com/s-zimm))
|
|
294
305
|
|
|
@@ -586,6 +597,10 @@
|
|
|
586
597
|
- D-19722: `Table`: Fix Storybook issues by refactoring Table's story. [\#974](https://github.com/digital-ai/dot-components/pull/974) ([dmiletic85](https://github.com/dmiletic85))
|
|
587
598
|
- D-19713: Do not show alert banner close button if onClose not provided [\#973](https://github.com/digital-ai/dot-components/pull/973) ([selsemore](https://github.com/selsemore))
|
|
588
599
|
|
|
600
|
+
**Misc:**
|
|
601
|
+
|
|
602
|
+
- S-76846: update to webpack 5 [\#940](https://github.com/digital-ai/dot-components/pull/940) ([CWSites](https://github.com/CWSites))
|
|
603
|
+
|
|
589
604
|
## [1.7.0](https://www.npmjs.com/package/@digital-ai/dot-components) (01/28/2022)
|
|
590
605
|
|
|
591
606
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/1.6.2...1.7.0)
|
|
@@ -629,7 +644,6 @@
|
|
|
629
644
|
|
|
630
645
|
**Misc:**
|
|
631
646
|
|
|
632
|
-
- S-76846: update to webpack 5 [\#940](https://github.com/digital-ai/dot-components/pull/940) ([CWSites](https://github.com/CWSites))
|
|
633
647
|
- S-76846: storybook updates `develop` [\#935](https://github.com/digital-ai/dot-components/pull/935) ([CWSites](https://github.com/CWSites))
|
|
634
648
|
|
|
635
649
|
## [1.6.1](https://www.npmjs.com/package/@digital-ai/dot-components) (01/10/2022)
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useState, useEffect, useRef, useMemo, useContext, createContext, forwardRef, Fragment as Fragment$1, createElement
|
|
3
|
+
import { useState, useEffect, useRef, useMemo, useContext, createContext, useCallback, forwardRef, Fragment as Fragment$1, createElement } from 'react';
|
|
4
4
|
import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, AccordionActions, InputAdornment, InputLabel, TextField, Toolbar, Alert, Fade, Avatar, IconButton, Link, Drawer, Button, darken, List, ListItem, CircularProgress, Popper, MenuList, MenuItem, Paper, ClickAwayListener, ListItemIcon, Collapse, ListSubheader, Divider, ListItemText, Badge, useMediaQuery, Autocomplete, Chip, AvatarGroup, Breadcrumbs, ToggleButtonGroup, ToggleButton, Card, CardContent, CardHeader, FormControlLabel, Checkbox, FormControl, FormGroup, FormLabel, FormHelperText, Dialog, DialogContent, DialogActions, useTheme as useTheme$1, RadioGroup, Radio, Switch, Skeleton, Snackbar, ButtonGroup, TablePagination, TableContainer, TableCell, TableRow, TableBody, TableSortLabel, TableHead, Table, Tabs, Tab, LinearProgress } from '@mui/material';
|
|
5
5
|
import styled, { css, createGlobalStyle, ThemeProvider as ThemeProvider$1, keyframes } from 'styled-components';
|
|
6
6
|
import { createTheme, ThemeProvider, alpha, useTheme } from '@mui/material/styles';
|
|
@@ -1372,8 +1372,9 @@ function useCancelablePromise() {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
1374
|
const nullStr = null;
|
|
1375
|
-
|
|
1376
|
-
|
|
1375
|
+
let idCount = 100;
|
|
1376
|
+
const createAppInstance = (name, instance_state, appType = 'Deploy') => ({
|
|
1377
|
+
id: '757e74ed-389b-4ec4-be29-bfed6738b' + idCount++,
|
|
1377
1378
|
product_instance_id: nullStr,
|
|
1378
1379
|
account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
|
|
1379
1380
|
enabled: true,
|
|
@@ -1385,13 +1386,14 @@ const deployAppInstance = (id, name, instance_state) => ({
|
|
|
1385
1386
|
alternate_label: nullStr,
|
|
1386
1387
|
logo: nullStr,
|
|
1387
1388
|
needs_authentication: false,
|
|
1388
|
-
logo_product_name:
|
|
1389
|
-
instance_state
|
|
1389
|
+
logo_product_name: appType,
|
|
1390
|
+
instance_state: instance_state % 2
|
|
1390
1391
|
});
|
|
1391
|
-
const testData = [['
|
|
1392
|
+
const testData = [['QA Deploy', 0], ['Deploy 1', 1], ['Deploy 2er', 5], ['Deploy 3rf', 3], ['Deploy 4', 7], ['Deploy 5', 9], ['Deploy 5a', 101], ['Deploy 5b', 91], ['Deploy 6', 2], ['Deploy 7', 3], ['Deploy 8c', 21], ['Deploy 9', 20], ['Deploy 10m', 10], ['Deploy 11', 11], ['Deploy 12qa', 30], ['Deploy 13', 31], ['Deploy 14d', 41], ['Deploy 15', 45], ['Deploy 16', 40], ['Deploy 17', 51], ['Deploy 18', 70], ['Deploy 19a', 61], ['Deploy 20', 63], ['Deploy 21', 67], ['Deploy 22p', 65], ['Deploy 23', 73], ['Deploy 24o', 93], ['Deploy 25', 11], ['Deploy 26', 80], ['Deploy 27io', 81], ['Deploy 28ty', 87], ['Deploy 29', 76], ['Deploy 30rt', 97], ['Deploy 31sd', 37], ['Deploy 32as', 39], ['Deploy 33', 12], ['No type 1c', 13], ['Deploy 34pl', 19], ['No type 2t', 14], ['Deploy 35', 17], ['No type 3h', 44], ['Deploy 36d', 55]];
|
|
1392
1393
|
const deployInstances = [];
|
|
1393
|
-
for (const [
|
|
1394
|
-
|
|
1394
|
+
for (const [name, instanceState] of testData) {
|
|
1395
|
+
const appType = name.startsWith('No type') ? null : 'Deploy';
|
|
1396
|
+
deployInstances.push(createAppInstance(name, instanceState, appType));
|
|
1395
1397
|
}
|
|
1396
1398
|
let applications = [{
|
|
1397
1399
|
id: 'be6e1e4f-7009-4412-b3ba-e5633cbe6be0',
|
|
@@ -1979,15 +1981,19 @@ const createTopLevelMenuItem = (url, logo, title, openNewTab = true) => {
|
|
|
1979
1981
|
}), `top-menu-item-${title}`);
|
|
1980
1982
|
};
|
|
1981
1983
|
const createAppTypeLabel = (appTypeName, logo, appProps) => {
|
|
1984
|
+
const logoProps = logo ? {
|
|
1985
|
+
imageSrc: logo
|
|
1986
|
+
} : {
|
|
1987
|
+
iconId: 'collection'
|
|
1988
|
+
};
|
|
1982
1989
|
return jsxs("div", Object.assign({
|
|
1983
1990
|
className: "logo-title"
|
|
1984
1991
|
}, {
|
|
1985
|
-
children: [jsx(DotAvatar, {
|
|
1992
|
+
children: [jsx(DotAvatar, Object.assign({}, logoProps, {
|
|
1986
1993
|
alt: "app image",
|
|
1987
|
-
imageSrc: logo,
|
|
1988
1994
|
type: "image",
|
|
1989
1995
|
variant: "circular"
|
|
1990
|
-
}, void 0), jsxs("div", Object.assign({
|
|
1996
|
+
}), void 0), jsxs("div", Object.assign({
|
|
1991
1997
|
className: "dot-app-switcher-app-title"
|
|
1992
1998
|
}, {
|
|
1993
1999
|
children: [jsx(DotTypography, Object.assign({
|
|
@@ -2188,6 +2194,7 @@ const DotAppSwitcherView = ({
|
|
|
2188
2194
|
activeApp,
|
|
2189
2195
|
apps,
|
|
2190
2196
|
className,
|
|
2197
|
+
noAppTypeLabel: _noAppTypeLabel = 'Other',
|
|
2191
2198
|
platformConsoleUrl,
|
|
2192
2199
|
onClose,
|
|
2193
2200
|
open,
|
|
@@ -2209,19 +2216,26 @@ const DotAppSwitcherView = ({
|
|
|
2209
2216
|
selectedAppType = selectedAppTypeAlt;
|
|
2210
2217
|
setSelectedAppType = setSelectedAppTypeAlt;
|
|
2211
2218
|
}
|
|
2212
|
-
const showApps = appType => {
|
|
2219
|
+
const showApps = useCallback(appType => {
|
|
2213
2220
|
setSelectedAppType(appType);
|
|
2214
|
-
};
|
|
2215
|
-
const showAppTypes = () => setSelectedAppType(null);
|
|
2216
|
-
const populateAppTypeMap = () => {
|
|
2221
|
+
}, []);
|
|
2222
|
+
const showAppTypes = useCallback(() => setSelectedAppType(null), []);
|
|
2223
|
+
const populateAppTypeMap = useCallback(() => {
|
|
2217
2224
|
const newAppTypeMap = new Map();
|
|
2225
|
+
// we'll put Other at the end
|
|
2226
|
+
const otherApps = [];
|
|
2218
2227
|
apps === null || apps === void 0 ? void 0 : apps.forEach(app => {
|
|
2219
|
-
const appTypeName = app.logo_product_name;
|
|
2220
2228
|
const children = createMenuItem(app.url, app.name, getInstanceStateText(app));
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
newAppTypeMap.
|
|
2229
|
+
const appTypeName = app.logo_product_name;
|
|
2230
|
+
let appTypeApps;
|
|
2231
|
+
if (appTypeName) {
|
|
2232
|
+
appTypeApps = newAppTypeMap.get(appTypeName);
|
|
2233
|
+
if (!appTypeApps) {
|
|
2234
|
+
appTypeApps = [];
|
|
2235
|
+
newAppTypeMap.set(appTypeName, appTypeApps);
|
|
2236
|
+
}
|
|
2237
|
+
} else {
|
|
2238
|
+
appTypeApps = otherApps;
|
|
2225
2239
|
}
|
|
2226
2240
|
appTypeApps.push({
|
|
2227
2241
|
children,
|
|
@@ -2229,7 +2243,15 @@ const DotAppSwitcherView = ({
|
|
|
2229
2243
|
height: 64
|
|
2230
2244
|
});
|
|
2231
2245
|
});
|
|
2232
|
-
|
|
2246
|
+
const keys = Array.from(newAppTypeMap.keys()).sort();
|
|
2247
|
+
const sortedAppTypeMap = new Map();
|
|
2248
|
+
for (const appType of keys) {
|
|
2249
|
+
sortedAppTypeMap.set(appType, newAppTypeMap.get(appType));
|
|
2250
|
+
}
|
|
2251
|
+
if (otherApps.length > 0) {
|
|
2252
|
+
sortedAppTypeMap.set(_noAppTypeLabel, otherApps);
|
|
2253
|
+
}
|
|
2254
|
+
setAppTypeMap(sortedAppTypeMap);
|
|
2233
2255
|
const menuItems = [daiAppsHeaderMenuItem];
|
|
2234
2256
|
if (platformConsoleUrl) {
|
|
2235
2257
|
const children = createTopLevelMenuItem(platformConsoleUrl, getLogoForAppType('Platform'), 'Digital.ai Platform', !window.location.href.startsWith(platformConsoleUrl));
|
|
@@ -2240,9 +2262,9 @@ const DotAppSwitcherView = ({
|
|
|
2240
2262
|
});
|
|
2241
2263
|
}
|
|
2242
2264
|
const newAppTypeLabels = new Map();
|
|
2243
|
-
|
|
2265
|
+
sortedAppTypeMap.forEach((singleTypeApps, appTypeName) => {
|
|
2244
2266
|
if ((singleTypeApps === null || singleTypeApps === void 0 ? void 0 : singleTypeApps.length) > 0) {
|
|
2245
|
-
const logo = getLogoForAppType(appTypeName);
|
|
2267
|
+
const logo = appTypeName === _noAppTypeLabel ? null : getLogoForAppType(appTypeName);
|
|
2246
2268
|
newAppTypeLabels.set(appTypeName, {
|
|
2247
2269
|
logo,
|
|
2248
2270
|
singleTypeApps
|
|
@@ -2263,7 +2285,7 @@ const DotAppSwitcherView = ({
|
|
|
2263
2285
|
});
|
|
2264
2286
|
setAppTypeMenuItems(menuItems);
|
|
2265
2287
|
setAppTypeLabels(newAppTypeLabels);
|
|
2266
|
-
};
|
|
2288
|
+
}, [apps]);
|
|
2267
2289
|
const emptyState = () => {
|
|
2268
2290
|
const currentAppMenuItem = createTopLevelMenuItem(window.location.href, getLogoForAppType(activeApp.product), activeApp.name, false);
|
|
2269
2291
|
setAppTypeMenuItems([daiAppsHeaderMenuItem, {
|
package/index.umd.js
CHANGED
|
@@ -1548,9 +1548,13 @@
|
|
|
1548
1548
|
}
|
|
1549
1549
|
|
|
1550
1550
|
var nullStr = null;
|
|
1551
|
-
var
|
|
1551
|
+
var idCount = 100;
|
|
1552
|
+
var createAppInstance = function createAppInstance(name, instance_state, appType) {
|
|
1553
|
+
if (appType === void 0) {
|
|
1554
|
+
appType = 'Deploy';
|
|
1555
|
+
}
|
|
1552
1556
|
return {
|
|
1553
|
-
id:
|
|
1557
|
+
id: '757e74ed-389b-4ec4-be29-bfed6738b' + idCount++,
|
|
1554
1558
|
product_instance_id: nullStr,
|
|
1555
1559
|
account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
|
|
1556
1560
|
enabled: true,
|
|
@@ -1562,18 +1566,18 @@
|
|
|
1562
1566
|
alternate_label: nullStr,
|
|
1563
1567
|
logo: nullStr,
|
|
1564
1568
|
needs_authentication: false,
|
|
1565
|
-
logo_product_name:
|
|
1566
|
-
instance_state: instance_state
|
|
1569
|
+
logo_product_name: appType,
|
|
1570
|
+
instance_state: instance_state % 2
|
|
1567
1571
|
};
|
|
1568
1572
|
};
|
|
1569
|
-
var testData = [['
|
|
1573
|
+
var testData = [['QA Deploy', 0], ['Deploy 1', 1], ['Deploy 2er', 5], ['Deploy 3rf', 3], ['Deploy 4', 7], ['Deploy 5', 9], ['Deploy 5a', 101], ['Deploy 5b', 91], ['Deploy 6', 2], ['Deploy 7', 3], ['Deploy 8c', 21], ['Deploy 9', 20], ['Deploy 10m', 10], ['Deploy 11', 11], ['Deploy 12qa', 30], ['Deploy 13', 31], ['Deploy 14d', 41], ['Deploy 15', 45], ['Deploy 16', 40], ['Deploy 17', 51], ['Deploy 18', 70], ['Deploy 19a', 61], ['Deploy 20', 63], ['Deploy 21', 67], ['Deploy 22p', 65], ['Deploy 23', 73], ['Deploy 24o', 93], ['Deploy 25', 11], ['Deploy 26', 80], ['Deploy 27io', 81], ['Deploy 28ty', 87], ['Deploy 29', 76], ['Deploy 30rt', 97], ['Deploy 31sd', 37], ['Deploy 32as', 39], ['Deploy 33', 12], ['No type 1c', 13], ['Deploy 34pl', 19], ['No type 2t', 14], ['Deploy 35', 17], ['No type 3h', 44], ['Deploy 36d', 55]];
|
|
1570
1574
|
var deployInstances = [];
|
|
1571
1575
|
for (var _i = 0, testData_1 = testData; _i < testData_1.length; _i++) {
|
|
1572
1576
|
var _a = testData_1[_i],
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
deployInstances.push(
|
|
1577
|
+
name_1 = _a[0],
|
|
1578
|
+
instanceState = _a[1];
|
|
1579
|
+
var appType = name_1.startsWith('No type') ? null : 'Deploy';
|
|
1580
|
+
deployInstances.push(createAppInstance(name_1, instanceState, appType));
|
|
1577
1581
|
}
|
|
1578
1582
|
var applications = [{
|
|
1579
1583
|
id: 'be6e1e4f-7009-4412-b3ba-e5633cbe6be0',
|
|
@@ -2213,15 +2217,19 @@
|
|
|
2213
2217
|
}), "top-menu-item-" + title);
|
|
2214
2218
|
};
|
|
2215
2219
|
var createAppTypeLabel = function createAppTypeLabel(appTypeName, logo, appProps) {
|
|
2220
|
+
var logoProps = logo ? {
|
|
2221
|
+
imageSrc: logo
|
|
2222
|
+
} : {
|
|
2223
|
+
iconId: 'collection'
|
|
2224
|
+
};
|
|
2216
2225
|
return jsxRuntime.jsxs("div", __assign({
|
|
2217
2226
|
className: "logo-title"
|
|
2218
2227
|
}, {
|
|
2219
|
-
children: [jsxRuntime.jsx(DotAvatar, {
|
|
2228
|
+
children: [jsxRuntime.jsx(DotAvatar, __assign({}, logoProps, {
|
|
2220
2229
|
alt: "app image",
|
|
2221
|
-
imageSrc: logo,
|
|
2222
2230
|
type: "image",
|
|
2223
2231
|
variant: "circular"
|
|
2224
|
-
}, void 0), jsxRuntime.jsxs("div", __assign({
|
|
2232
|
+
}), void 0), jsxRuntime.jsxs("div", __assign({
|
|
2225
2233
|
className: "dot-app-switcher-app-title"
|
|
2226
2234
|
}, {
|
|
2227
2235
|
children: [jsxRuntime.jsx(DotTypography, __assign({
|
|
@@ -2434,51 +2442,60 @@
|
|
|
2434
2442
|
var activeApp = _a.activeApp,
|
|
2435
2443
|
apps = _a.apps,
|
|
2436
2444
|
className = _a.className,
|
|
2445
|
+
_b = _a.noAppTypeLabel,
|
|
2446
|
+
noAppTypeLabel = _b === void 0 ? 'Other' : _b,
|
|
2437
2447
|
platformConsoleUrl = _a.platformConsoleUrl,
|
|
2438
2448
|
onClose = _a.onClose,
|
|
2439
2449
|
open = _a.open,
|
|
2440
2450
|
selectedAppType = _a.selectedAppType,
|
|
2441
|
-
|
|
2442
|
-
yOffset =
|
|
2443
|
-
|
|
2444
|
-
zIndex =
|
|
2451
|
+
_c = _a.yOffset,
|
|
2452
|
+
yOffset = _c === void 0 ? 48 : _c,
|
|
2453
|
+
_d = _a.zIndex,
|
|
2454
|
+
zIndex = _d === void 0 ? 990 : _d;
|
|
2445
2455
|
var dotCoreApiContext = useDotCoreApiContext();
|
|
2446
2456
|
var setSelectedAppType = null;
|
|
2447
2457
|
if (dotCoreApiContext !== null) {
|
|
2448
2458
|
setSelectedAppType = dotCoreApiContext.setSelectedAppSwitcherAppType;
|
|
2449
2459
|
}
|
|
2450
2460
|
var rootClasses = useStylesWithRootClass(rootClassName$Q, className);
|
|
2451
|
-
var _d = React.useState(),
|
|
2452
|
-
appTypeMap = _d[0],
|
|
2453
|
-
setAppTypeMap = _d[1];
|
|
2454
2461
|
var _e = React.useState(),
|
|
2455
|
-
|
|
2456
|
-
|
|
2462
|
+
appTypeMap = _e[0],
|
|
2463
|
+
setAppTypeMap = _e[1];
|
|
2457
2464
|
var _f = React.useState(),
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
var _g = React.useState(
|
|
2461
|
-
|
|
2462
|
-
|
|
2465
|
+
appTypeLabels = _f[0],
|
|
2466
|
+
setAppTypeLabels = _f[1];
|
|
2467
|
+
var _g = React.useState(),
|
|
2468
|
+
appTypeMenuItems = _g[0],
|
|
2469
|
+
setAppTypeMenuItems = _g[1];
|
|
2470
|
+
var _h = React.useState(null),
|
|
2471
|
+
selectedAppTypeAlt = _h[0],
|
|
2472
|
+
setSelectedAppTypeAlt = _h[1];
|
|
2463
2473
|
if (!setSelectedAppType) {
|
|
2464
2474
|
selectedAppType = selectedAppTypeAlt;
|
|
2465
2475
|
setSelectedAppType = setSelectedAppTypeAlt;
|
|
2466
2476
|
}
|
|
2467
|
-
var showApps = function
|
|
2477
|
+
var showApps = React.useCallback(function (appType) {
|
|
2468
2478
|
setSelectedAppType(appType);
|
|
2469
|
-
};
|
|
2470
|
-
var showAppTypes = function
|
|
2479
|
+
}, []);
|
|
2480
|
+
var showAppTypes = React.useCallback(function () {
|
|
2471
2481
|
return setSelectedAppType(null);
|
|
2472
|
-
};
|
|
2473
|
-
var populateAppTypeMap = function
|
|
2482
|
+
}, []);
|
|
2483
|
+
var populateAppTypeMap = React.useCallback(function () {
|
|
2474
2484
|
var newAppTypeMap = new Map();
|
|
2485
|
+
// we'll put Other at the end
|
|
2486
|
+
var otherApps = [];
|
|
2475
2487
|
apps === null || apps === void 0 ? void 0 : apps.forEach(function (app) {
|
|
2476
|
-
var appTypeName = app.logo_product_name;
|
|
2477
2488
|
var children = createMenuItem(app.url, app.name, getInstanceStateText(app));
|
|
2478
|
-
var
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
newAppTypeMap.
|
|
2489
|
+
var appTypeName = app.logo_product_name;
|
|
2490
|
+
var appTypeApps;
|
|
2491
|
+
if (appTypeName) {
|
|
2492
|
+
appTypeApps = newAppTypeMap.get(appTypeName);
|
|
2493
|
+
if (!appTypeApps) {
|
|
2494
|
+
appTypeApps = [];
|
|
2495
|
+
newAppTypeMap.set(appTypeName, appTypeApps);
|
|
2496
|
+
}
|
|
2497
|
+
} else {
|
|
2498
|
+
appTypeApps = otherApps;
|
|
2482
2499
|
}
|
|
2483
2500
|
appTypeApps.push({
|
|
2484
2501
|
children: children,
|
|
@@ -2486,7 +2503,16 @@
|
|
|
2486
2503
|
height: 64
|
|
2487
2504
|
});
|
|
2488
2505
|
});
|
|
2489
|
-
|
|
2506
|
+
var keys = Array.from(newAppTypeMap.keys()).sort();
|
|
2507
|
+
var sortedAppTypeMap = new Map();
|
|
2508
|
+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
2509
|
+
var appType = keys_1[_i];
|
|
2510
|
+
sortedAppTypeMap.set(appType, newAppTypeMap.get(appType));
|
|
2511
|
+
}
|
|
2512
|
+
if (otherApps.length > 0) {
|
|
2513
|
+
sortedAppTypeMap.set(noAppTypeLabel, otherApps);
|
|
2514
|
+
}
|
|
2515
|
+
setAppTypeMap(sortedAppTypeMap);
|
|
2490
2516
|
var menuItems = [daiAppsHeaderMenuItem];
|
|
2491
2517
|
if (platformConsoleUrl) {
|
|
2492
2518
|
var children = createTopLevelMenuItem(platformConsoleUrl, getLogoForAppType('Platform'), 'Digital.ai Platform', !window.location.href.startsWith(platformConsoleUrl));
|
|
@@ -2497,9 +2523,9 @@
|
|
|
2497
2523
|
});
|
|
2498
2524
|
}
|
|
2499
2525
|
var newAppTypeLabels = new Map();
|
|
2500
|
-
|
|
2526
|
+
sortedAppTypeMap.forEach(function (singleTypeApps, appTypeName) {
|
|
2501
2527
|
if ((singleTypeApps === null || singleTypeApps === void 0 ? void 0 : singleTypeApps.length) > 0) {
|
|
2502
|
-
var logo = getLogoForAppType(appTypeName);
|
|
2528
|
+
var logo = appTypeName === noAppTypeLabel ? null : getLogoForAppType(appTypeName);
|
|
2503
2529
|
newAppTypeLabels.set(appTypeName, {
|
|
2504
2530
|
logo: logo,
|
|
2505
2531
|
singleTypeApps: singleTypeApps
|
|
@@ -2522,7 +2548,7 @@
|
|
|
2522
2548
|
});
|
|
2523
2549
|
setAppTypeMenuItems(menuItems);
|
|
2524
2550
|
setAppTypeLabels(newAppTypeLabels);
|
|
2525
|
-
};
|
|
2551
|
+
}, [apps]);
|
|
2526
2552
|
var emptyState = function emptyState() {
|
|
2527
2553
|
var currentAppMenuItem = createTopLevelMenuItem(window.location.href, getLogoForAppType(activeApp.product), activeApp.name, false);
|
|
2528
2554
|
setAppTypeMenuItems([daiAppsHeaderMenuItem, {
|
|
@@ -7,6 +7,7 @@ interface ActiveAppInfo {
|
|
|
7
7
|
}
|
|
8
8
|
interface CommonAppSwitcherProps extends CommonProps {
|
|
9
9
|
activeApp: ActiveAppInfo;
|
|
10
|
+
noAppTypeLabel?: string;
|
|
10
11
|
onClose?: (event: MouseEvent | KeyboardEvent) => void;
|
|
11
12
|
yOffset?: number;
|
|
12
13
|
zIndex?: number;
|
|
@@ -17,7 +18,7 @@ interface AppSwitcherViewProps extends CommonAppSwitcherProps {
|
|
|
17
18
|
platformConsoleUrl?: string;
|
|
18
19
|
selectedAppType: string;
|
|
19
20
|
}
|
|
20
|
-
export declare const DotAppSwitcherView: ({ activeApp, apps, className, platformConsoleUrl, onClose, open, selectedAppType, yOffset, zIndex, }: AppSwitcherViewProps) => JSX.Element;
|
|
21
|
+
export declare const DotAppSwitcherView: ({ activeApp, apps, className, noAppTypeLabel, platformConsoleUrl, onClose, open, selectedAppType, yOffset, zIndex, }: AppSwitcherViewProps) => JSX.Element;
|
|
21
22
|
interface AppSwitcherProps extends CommonAppSwitcherProps {
|
|
22
23
|
accountId?: string;
|
|
23
24
|
includePlatformConsole?: boolean;
|