@cccsaurora/howler-ui 2.17.0-dev.519 → 2.17.0-dev.521
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.
|
@@ -5,7 +5,7 @@ import { ArrowDropDown, InfoOutlined } from '@mui/icons-material';
|
|
|
5
5
|
import { Accordion, AccordionDetails, AccordionSummary, Box, Divider, Grid, Stack, TextField, Tooltip, Typography, useTheme } from '@mui/material';
|
|
6
6
|
import { flatten } from 'flat';
|
|
7
7
|
import Fuse from 'fuse.js';
|
|
8
|
-
import { capitalize, groupBy, isArray, isEmpty, isNull, isObject, isPlainObject, isUndefined, max, sortBy, uniq } from 'lodash-es';
|
|
8
|
+
import { capitalize, groupBy, isArray, isBoolean, isEmpty, isNull, isNumber, isObject, isPlainObject, isUndefined, max, sortBy, uniq } from 'lodash-es';
|
|
9
9
|
import { memo, useEffect, useMemo, useState } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
|
|
@@ -56,7 +56,7 @@ const ObjectRenderer = memo(({ obj: obj, data, parentKey, indent = false }) => {
|
|
|
56
56
|
}, [data]);
|
|
57
57
|
const longestKey = useMemo(() => max(entries.map(([key]) => key.length)), [entries]);
|
|
58
58
|
return (_jsxs(Stack, { direction: "row", overflow: "hidden", maxWidth: "100%", children: [indent && _jsx(Divider, { orientation: "vertical", flexItem: true, sx: { borderColor: 'primary.main', borderWidth: '2px' } }), _jsx(Stack, { flex: 1, ml: 1, maxWidth: "100%", children: entries
|
|
59
|
-
.filter(([__, val]) => !isNull(val) && !isUndefined(val) && !isEmpty(val))
|
|
59
|
+
.filter(([__, val]) => !isNull(val) && !isUndefined(val) && !isEmpty(val) && !isBoolean(val) && !isNumber(val))
|
|
60
60
|
.map(([key, val]) => {
|
|
61
61
|
if (Array.isArray(val)) {
|
|
62
62
|
return _jsx(ListRenderer, { obj: obj, maxKeyLength: longestKey, objKey: key, entries: val }, key);
|
|
@@ -82,7 +82,7 @@ const Collapsible = memo(({ obj, title, data, query }) => {
|
|
|
82
82
|
const throttler = useMemo(() => new Throttler(400), []);
|
|
83
83
|
const [scores, setScores] = useState([]);
|
|
84
84
|
const [results, setResults] = useState({});
|
|
85
|
-
const options = useMemo(() => Object.entries(data).map(([key, value]) => ({ key, value })), [data]);
|
|
85
|
+
const options = useMemo(() => Object.entries(data).map(([key, value]) => ({ key, value: value.toString() })), [data]);
|
|
86
86
|
const keys = useMemo(() => options
|
|
87
87
|
.flatMap(option => (isArray(option.value) ? Object.keys(flatten(option.value)) : []))
|
|
88
88
|
.map(key => key.replace(/\d+/g, 'value'))
|
|
@@ -117,7 +117,7 @@ const ObjectDetails = ({ obj }) => {
|
|
|
117
117
|
const groups = useMemo(() => groupBy(Object.entries(flatten(obj ?? {}, { safe: true })).filter(([key, value]) => !key.startsWith('__') &&
|
|
118
118
|
key.includes('.') &&
|
|
119
119
|
['howler', 'labels'].every(prefix => !key.startsWith(prefix)) &&
|
|
120
|
-
!isEmpty(value)), ([key]) => key.split('.')[0]), [obj]);
|
|
120
|
+
(!isEmpty(value) || isNumber(value) || isBoolean(value))), ([key]) => key.split('.')[0]), [obj]);
|
|
121
121
|
return (_jsxs(Stack, { spacing: 1, children: [_jsx(TextField, { value: query, onChange: event => setQuery(event.target.value), label: t('overview.search') }), Object.entries(groups).map(([section, entries]) => {
|
|
122
122
|
return (_jsx(Collapsible, { obj: obj, query: query, title: section
|
|
123
123
|
.split('_')
|
|
@@ -41,6 +41,6 @@ const CaseDashboard = ({ case: providedCase, caseId }) => {
|
|
|
41
41
|
if (!_case) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
return (_jsxs(Grid, { container: true, spacing: 5, width: "100%", px: 3, children: [_jsx(Grid, { item: true, xs: 12, children: _jsx(CaseOverview, { case: _case, updateCase: updateCase }) }), AGGREGATE_FIELDS.map(([field, icon, iconColor, subtitle]) => (_jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: icon, iconColor: iconColor && get(theme.palette, iconColor), field: field, records: records, subtitle: t(subtitle) }) }, field))), _jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: "mingcute:heartbeat-line", iconColor: theme.palette.error.light, title: getDuration(_case)
|
|
44
|
+
return (_jsxs(Grid, { container: true, spacing: 5, width: "100%", px: 3, children: [_jsx(Grid, { item: true, xs: 12, children: _jsx(CaseOverview, { case: _case, updateCase: updateCase }) }), AGGREGATE_FIELDS.map(([field, icon, iconColor, subtitle]) => (_jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: icon, iconColor: iconColor && get(theme.palette, iconColor), field: field, records: records, subtitle: t(subtitle) }) }, field))), _jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: "mingcute:heartbeat-line", iconColor: theme.palette.error.light, title: getDuration(_case)?.format('HH[h] mm[m]') ?? '--', subtitle: t('page.cases.dashboard.duration') }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(TaskPanel, { case: _case, updateCase: updateCase }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(AlertPanel, { case: _case }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(RelatedCasePanel, { case: _case }) })] }));
|
|
45
45
|
};
|
|
46
46
|
export default CaseDashboard;
|