corpushub-design-system 0.0.6 → 0.0.7

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.
@@ -8,7 +8,7 @@ export const BackupTexts = {
8
8
  'backup.field.user.name': 'User',
9
9
  'backup.field.log': 'Log',
10
10
  'backup.field.id': 'Date',
11
- 'backup.field.download': 'Actions',
11
+ 'backup.field.download': 'Download',
12
12
  'backup.label.log': 'Log',
13
13
  'backup.status.error': 'error',
14
14
  'backup.status.processing': 'processing',
@@ -31,7 +31,7 @@ export const BackupTexts = {
31
31
  'backup.field.filename': 'Nome do arquivo',
32
32
  'backup.field.user.name': 'Usuário',
33
33
  'backup.field.status': 'Status',
34
- 'backup.field.download': 'Ações',
34
+ 'backup.field.download': 'Baixar',
35
35
  'backup.field.log': 'Log',
36
36
  'backup.label.log': 'Log',
37
37
  'backup.status.error': 'erro',
@@ -56,7 +56,7 @@ export const BackupTexts = {
56
56
  'backup.field.user.name': 'Utente',
57
57
  'backup.field.log': 'Log',
58
58
  'backup.field.id': 'Data',
59
- 'backup.field.download': 'Azioni',
59
+ 'backup.field.download': 'Scarica',
60
60
  'backup.label.log': 'Log',
61
61
  'backup.status.error': 'errore',
62
62
  'backup.status.processing': 'in elaborazione',
@@ -1,16 +1,19 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { useTranslation } from 'react-i18next';
4
+ import AppLoading from '../../../common/AppLoading';
5
+ import AppModal from '../../../common/AppModal';
3
6
  import { useMessageUtils } from '../../../configs/useMessageUtils';
4
- import AppModalConfirm from '../../../common/AppModal/AppModalConfirm';
5
7
  import BackupService from '../BackupService';
6
8
  import './style.scss';
7
9
  export default function BackupCreate({ mode, resourceUid, onClose, onConfirm, }) {
8
10
  const { t } = useTranslation('backup');
9
- const { isLoading, dispatchLoading, dispatchError } = useMessageUtils();
11
+ const { dispatchError } = useMessageUtils();
12
+ const [loading, setLoading] = useState(false);
10
13
  const handleConfirm = () => {
11
- if (isLoading() || !resourceUid)
14
+ if (loading || !resourceUid)
12
15
  return;
13
- dispatchLoading(true);
16
+ setLoading(true);
14
17
  BackupService.execute(mode, resourceUid)
15
18
  .then((r) => {
16
19
  onConfirm(r.data);
@@ -19,8 +22,8 @@ export default function BackupCreate({ mode, resourceUid, onClose, onConfirm, })
19
22
  dispatchError({ err, t });
20
23
  })
21
24
  .finally(() => {
22
- dispatchLoading(false);
25
+ setLoading(false);
23
26
  });
24
27
  };
25
- return (_jsx(AppModalConfirm, { title: t('modal.title'), subtitle: t('modal.description'), onClose: onClose, onConfirm: handleConfirm }));
28
+ return (_jsxs(AppModal, { title: t('modal.title'), className: "backup-create-modal", confirm: handleConfirm, close: onClose, disableConfirm: loading, disableClose: loading, disableEscapeClose: loading, disableBackdropClose: loading, children: [_jsx("p", { children: t('modal.description') }), loading && _jsx(AppLoading, {})] }));
26
29
  }
@@ -2,15 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import AppDropzone from '../../../common/AppDropzone';
5
+ import AppLoading from '../../../common/AppLoading';
5
6
  import AppModal from '../../../common/AppModal';
6
7
  import { useMessageUtils } from '../../../configs/useMessageUtils';
7
8
  import BackupService from '../BackupService';
8
9
  import './style.scss';
9
10
  export default function BackupRestore({ mode, onClose }) {
10
11
  const { t } = useTranslation('backup');
11
- const { isLoading, dispatchLoading, dispatchError } = useMessageUtils();
12
+ const { dispatchError } = useMessageUtils();
12
13
  const [openExists, setOpenExists] = useState(false);
13
14
  const [backup, setBackup] = useState();
15
+ const [loading, setLoading] = useState(false);
14
16
  const handleSuccess = (uploaded) => {
15
17
  BackupService.restore(mode, uploaded)
16
18
  .then((r) => {
@@ -27,18 +29,16 @@ export default function BackupRestore({ mode, onClose }) {
27
29
  });
28
30
  };
29
31
  const handleExecute = (id) => {
30
- if (isLoading())
32
+ if (loading)
31
33
  return;
32
- dispatchLoading(true);
34
+ setLoading(true);
33
35
  BackupService.executeRestore(id)
34
36
  .then(() => {
35
37
  location.reload();
36
38
  })
37
39
  .catch((err) => {
38
40
  dispatchError({ err, t });
39
- })
40
- .finally(() => {
41
- dispatchLoading(false);
41
+ setLoading(false);
42
42
  });
43
43
  };
44
44
  const handleError = () => {
@@ -48,5 +48,5 @@ export default function BackupRestore({ mode, onClose }) {
48
48
  'application/gzip': ['.gz'],
49
49
  'application/x-tar': ['.tar'],
50
50
  'application/x-compressed-tar': ['.tar.gz'],
51
- } }), openExists && (_jsx(AppModal, { title: t('modal.restore.title'), className: "modal-parameter", confirm: () => backup && handleExecute(backup.id), close: () => setOpenExists(false), children: _jsx("div", { className: "alert alert-danger m-b-0", children: _jsxs("p", { children: [_jsx("span", { children: t(`modal.restore.message.${mode}`) }), _jsx("b", { className: "ms-1", children: t('modal.restore.confirm') })] }) }) }))] }));
51
+ } }), openExists && (_jsxs(AppModal, { title: t('modal.restore.title'), className: "modal-parameter", confirm: () => backup && handleExecute(backup.id), close: () => setOpenExists(false), disableConfirm: loading, disableClose: loading, disableEscapeClose: loading, disableBackdropClose: loading, children: [_jsx("div", { className: "alert alert-danger m-b-0", children: _jsxs("p", { children: [_jsx("span", { children: t(`modal.restore.message.${mode}`) }), _jsx("b", { className: "ms-1", children: t('modal.restore.confirm') })] }) }), loading && _jsx(AppLoading, {})] }))] }));
52
52
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {