@cccsaurora/howler-ui 2.17.0-dev.517 → 2.17.0-dev.519
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.
|
@@ -7,24 +7,22 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { Link } from 'react-router-dom';
|
|
8
8
|
const CaseTask = ({ task, onEdit, onDelete, paths, newTask = false }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
|
-
const [editing, setEditing] = useState(newTask);
|
|
11
10
|
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [editing, setEditing] = useState(newTask);
|
|
12
12
|
const [summary, setSummary] = useState(task?.summary || '');
|
|
13
13
|
const [path, setPath] = useState(task?.path ?? null);
|
|
14
14
|
const [assignment, setAssignment] = useState(task?.assignment);
|
|
15
15
|
const [complete, setComplete] = useState(task?.complete ?? false);
|
|
16
|
-
const dirty = summary !== task?.summary || path !== task?.path;
|
|
16
|
+
const dirty = summary !== task?.summary || path !== task?.path || complete !== task?.complete || assignment !== task?.assignment;
|
|
17
17
|
const onSubmit = async () => {
|
|
18
18
|
if (dirty && editing) {
|
|
19
|
-
console.log('confirmed bongo time');
|
|
20
19
|
setLoading(true);
|
|
21
|
-
await onEdit({ summary, path: !path ? null : path, assignment });
|
|
20
|
+
await onEdit({ summary, path: !path ? null : path, assignment, complete });
|
|
22
21
|
setLoading(false);
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
useEffect(() => {
|
|
26
25
|
if (!editing && task?.assignment !== assignment) {
|
|
27
|
-
console.log('confirmed bongo time 2');
|
|
28
26
|
setLoading(true);
|
|
29
27
|
onEdit({ assignment }).finally(() => setLoading(false));
|
|
30
28
|
}
|
|
@@ -32,13 +30,12 @@ const CaseTask = ({ task, onEdit, onDelete, paths, newTask = false }) => {
|
|
|
32
30
|
}, [assignment]);
|
|
33
31
|
useEffect(() => {
|
|
34
32
|
if (!editing && task?.complete !== complete) {
|
|
35
|
-
console.log('confirmed bongo time 3');
|
|
36
33
|
setLoading(true);
|
|
37
34
|
onEdit({ complete }).finally(() => setLoading(false));
|
|
38
35
|
}
|
|
39
36
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
37
|
}, [complete]);
|
|
41
|
-
return (_jsxs(Card, { sx: { pl: 0.5, pr: 1, py: 0.5, position: 'relative' }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [_jsx(Checkbox, { disabled: loading, color: "success", checked: complete, size: "small", onChange: (_ev, _complete) => setComplete(_complete) }), editing ? (_jsx(TextField, { disabled: loading, value: summary, onChange: e => setSummary(e.target.value), size: "small", fullWidth: true, sx: { minWidth: '40%' } })) : (_jsx(Typography, { sx: [
|
|
38
|
+
return (_jsxs(Card, { sx: { pl: 0.5, pr: 1, py: 0.5, position: 'relative' }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [_jsx(Checkbox, { disabled: loading, color: "success", checked: complete, size: "small", onChange: (_ev, _complete) => setComplete(_complete) }), editing ? (_jsx(TextField, { disabled: loading, value: summary, onChange: e => setSummary(e.target.value), size: "small", fullWidth: true, sx: { minWidth: '40%' } })) : (_jsx(Typography, { sx: [complete && { textDecoration: 'line-through' }], children: task?.summary || summary })), !editing && path && _jsx(Chip, { clickable: true, component: Link, to: path, label: path }), editing && (_jsx(Autocomplete, { disabled: loading, value: path, options: paths, onChange: (_ev, value) => setPath(value), fullWidth: true, renderInput: params => _jsx(TextField, { ...params, size: "small" }) })), _jsx(UserList, { disabled: loading, userIds: [assignment], onChange: ([_assigment]) => setAssignment(_assigment), i18nLabel: "route.cases.task.set.assignment", avatarHeight: 24 }), _jsx("div", { style: { flex: 1 } }), editing && !newTask && (_jsx(Tooltip, { title: t('route.cases.task.delete'), children: _jsx(IconButton, { size: "small", color: "error", onClick: () => {
|
|
42
39
|
setLoading(true);
|
|
43
40
|
onDelete().then(() => setLoading(false));
|
|
44
41
|
}, disabled: loading, children: _jsx(Delete, { fontSize: "small" }) }) })), _jsx(Tooltip, { title: t(editing ? 'route.cases.task.edit.save' : 'route.cases.task.edit'), children: _jsx("span", { children: _jsx(IconButton, { size: "small", color: editing ? 'success' : 'default', onClick: async () => {
|
|
@@ -48,6 +45,13 @@ const CaseTask = ({ task, onEdit, onDelete, paths, newTask = false }) => {
|
|
|
48
45
|
}
|
|
49
46
|
await onSubmit();
|
|
50
47
|
setEditing(false);
|
|
51
|
-
}, disabled: (!dirty && editing) || loading || !summary, children: editing ? _jsx(Check, { fontSize: "small" }) : _jsx(Edit, { fontSize: "small" }) }) }) }), editing && (_jsx(Tooltip, { title: t('route.cases.task.edit.cancel'), children: _jsx(IconButton, { size: "small", onClick: () =>
|
|
48
|
+
}, disabled: (!dirty && editing) || loading || !summary, children: editing ? _jsx(Check, { fontSize: "small" }) : _jsx(Edit, { fontSize: "small" }) }) }) }), editing && (_jsx(Tooltip, { title: t('route.cases.task.edit.cancel'), children: _jsx(IconButton, { size: "small", onClick: () => {
|
|
49
|
+
if (newTask) {
|
|
50
|
+
onDelete();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setEditing(false);
|
|
54
|
+
}
|
|
55
|
+
}, disabled: loading, children: _jsx(Close, { fontSize: "small" }) }) }))] }), loading && _jsx(LinearProgress, { sx: { left: 0, bottom: 0, right: 0, position: 'absolute' } })] }));
|
|
52
56
|
};
|
|
53
57
|
export default CaseTask;
|
|
@@ -13,7 +13,7 @@ const RelatedCasePanel = ({ case: _case }) => {
|
|
|
13
13
|
if (!_case) {
|
|
14
14
|
return _jsx(Skeleton, { height: 240 });
|
|
15
15
|
}
|
|
16
|
-
return (_jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", children: [_jsx(Typography, { flex: 1, variant: "h4", children: t('page.cases.dashboard.
|
|
16
|
+
return (_jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", children: [_jsx(Typography, { flex: 1, variant: "h4", children: t('page.cases.dashboard.cases') }), _jsx(Pagination, { count: casePages.length, page: casePage, onChange: (_, page) => setCasePage(page) })] }), _jsx(Divider, {}), casePages[casePage - 1]?.map(item => (_jsxs(Box, { position: "relative", children: [_jsx(CaseCard, { caseId: item.id }), _jsx(Box, { component: Link, to: item.path, sx: {
|
|
17
17
|
position: 'absolute',
|
|
18
18
|
top: 0,
|
|
19
19
|
left: 0,
|
|
@@ -336,6 +336,7 @@
|
|
|
336
336
|
"page.cases.created": "Created",
|
|
337
337
|
"page.cases.dashboard": "Dashboard",
|
|
338
338
|
"page.cases.dashboard.alerts": "Alerts",
|
|
339
|
+
"page.cases.dashboard.cases": "Related Cases",
|
|
339
340
|
"page.cases.dashboard.duration": "Duration",
|
|
340
341
|
"page.cases.dashboard.indicators": "Indicators",
|
|
341
342
|
"page.cases.dashboard.target": "Targets",
|
|
@@ -340,6 +340,7 @@
|
|
|
340
340
|
"page.cases.created": "Créé",
|
|
341
341
|
"page.cases.dashboard": "Tableau de bord",
|
|
342
342
|
"page.cases.dashboard.alerts": "Alertes",
|
|
343
|
+
"page.cases.dashboard.cases": "Cas connexes",
|
|
343
344
|
"page.cases.dashboard.duration": "Durée",
|
|
344
345
|
"page.cases.dashboard.indicators": "Indicateurs",
|
|
345
346
|
"page.cases.dashboard.target": "Cibles",
|