@centreon/ui 24.4.24 → 24.4.25
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/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
|
|
1
3
|
import CheckIcon from '@mui/icons-material/Check';
|
|
2
4
|
import SaveIcon from '@mui/icons-material/Save';
|
|
3
|
-
import { Typography, TypographyProps } from '@mui/material';
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
labelLoading: string;
|
|
@@ -10,42 +11,24 @@ interface Props {
|
|
|
10
11
|
succeeded: boolean;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
interface WrapperLabelProps {
|
|
14
|
-
label: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const WrapperLabel = ({
|
|
18
|
-
label,
|
|
19
|
-
...rest
|
|
20
|
-
}: WrapperLabelProps & TypographyProps): JSX.Element => {
|
|
21
|
-
return <Typography {...rest}>{label}</Typography>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
14
|
const Content = ({
|
|
25
15
|
succeeded,
|
|
26
16
|
labelSucceeded,
|
|
27
17
|
labelSave,
|
|
28
18
|
loading,
|
|
29
|
-
labelLoading
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
labelLoading
|
|
20
|
+
}: Props): JSX.Element | string | null => {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
|
|
32
23
|
if (loading) {
|
|
33
|
-
return
|
|
24
|
+
return t(labelLoading);
|
|
34
25
|
}
|
|
35
26
|
|
|
36
27
|
if (succeeded) {
|
|
37
|
-
return labelSucceeded ? (
|
|
38
|
-
<WrapperLabel label={labelSucceeded} {...rest} />
|
|
39
|
-
) : (
|
|
40
|
-
<CheckIcon />
|
|
41
|
-
);
|
|
28
|
+
return labelSucceeded ? t(labelSucceeded) : <CheckIcon />;
|
|
42
29
|
}
|
|
43
30
|
|
|
44
|
-
return labelSave ? (
|
|
45
|
-
<WrapperLabel label={labelSave} {...rest} />
|
|
46
|
-
) : (
|
|
47
|
-
<SaveIcon />
|
|
48
|
-
);
|
|
31
|
+
return labelSave ? t(labelSave) : <SaveIcon />;
|
|
49
32
|
};
|
|
50
33
|
|
|
51
34
|
export default Content;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { any, isEmpty, isNil, not, or, pipe } from 'ramda';
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
|
-
import { Theme, Tooltip, TypographyProps } from '@mui/material';
|
|
5
4
|
import { LoadingButton, LoadingButtonProps } from '@mui/lab';
|
|
5
|
+
import { Theme, Tooltip } from '@mui/material';
|
|
6
6
|
|
|
7
7
|
import { getNormalizedId } from '../../utils';
|
|
8
8
|
|
|
9
|
-
import StartIcon from './StartIcon';
|
|
10
9
|
import Content from './Content';
|
|
10
|
+
import StartIcon from './StartIcon';
|
|
11
11
|
|
|
12
12
|
const useStyles = makeStyles()((theme: Theme) => ({
|
|
13
13
|
loadingButton: {
|
|
@@ -18,7 +18,6 @@ const useStyles = makeStyles()((theme: Theme) => ({
|
|
|
18
18
|
interface Props {
|
|
19
19
|
className?: string;
|
|
20
20
|
labelLoading?: string;
|
|
21
|
-
labelProps?: TypographyProps;
|
|
22
21
|
labelSave?: string;
|
|
23
22
|
labelSucceeded?: string;
|
|
24
23
|
loading?: boolean;
|
|
@@ -48,7 +47,6 @@ const SaveButton = ({
|
|
|
48
47
|
size = 'small',
|
|
49
48
|
className,
|
|
50
49
|
startIcon = true,
|
|
51
|
-
labelProps,
|
|
52
50
|
...rest
|
|
53
51
|
}: Props & LoadingButtonProps): JSX.Element => {
|
|
54
52
|
const { classes, cx } = useStyles();
|
|
@@ -88,8 +86,7 @@ const SaveButton = ({
|
|
|
88
86
|
labelSave,
|
|
89
87
|
labelSucceeded,
|
|
90
88
|
loading,
|
|
91
|
-
succeeded
|
|
92
|
-
...labelProps
|
|
89
|
+
succeeded
|
|
93
90
|
})}
|
|
94
91
|
</LoadingButton>
|
|
95
92
|
</div>
|