corpushub-design-system 0.0.3 → 0.0.6

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.
Files changed (37) hide show
  1. package/dist/common/AppTable/styles.scss +6 -2
  2. package/dist/configs/Localization.js +2 -0
  3. package/dist/configs/localization/BackupTexts.d.ts +74 -0
  4. package/dist/configs/localization/BackupTexts.js +74 -0
  5. package/dist/configs/localization/CommentsTexts.d.ts +145 -145
  6. package/dist/configs/localization/CommentsTexts.js +145 -145
  7. package/dist/features/Backup/BackupCreate/BackupCreate.d.ts +11 -0
  8. package/dist/features/Backup/BackupCreate/BackupCreate.js +26 -0
  9. package/dist/features/Backup/BackupCreate/index.d.ts +2 -0
  10. package/dist/features/Backup/BackupCreate/index.js +2 -0
  11. package/dist/features/Backup/BackupCreate/style.scss +0 -0
  12. package/dist/features/Backup/BackupInfo/BackupInfo.d.ts +8 -0
  13. package/dist/features/Backup/BackupInfo/BackupInfo.js +36 -0
  14. package/dist/features/Backup/BackupInfo/index.d.ts +2 -0
  15. package/dist/features/Backup/BackupInfo/index.js +2 -0
  16. package/dist/features/Backup/BackupInfo/style.scss +23 -0
  17. package/dist/features/Backup/BackupRestore/BackupRestore.d.ts +7 -0
  18. package/dist/features/Backup/BackupRestore/BackupRestore.js +52 -0
  19. package/dist/features/Backup/BackupRestore/index.d.ts +3 -0
  20. package/dist/features/Backup/BackupRestore/index.js +2 -0
  21. package/dist/features/Backup/BackupRestore/style.scss +17 -0
  22. package/dist/features/Backup/BackupService.d.ts +18 -0
  23. package/dist/features/Backup/BackupService.js +39 -0
  24. package/dist/features/Backup/BackupTable/BackupSearchFilter.d.ts +5 -0
  25. package/dist/features/Backup/BackupTable/BackupSearchFilter.js +4 -0
  26. package/dist/features/Backup/BackupTable/BackupTable.d.ts +8 -0
  27. package/dist/features/Backup/BackupTable/BackupTable.js +121 -0
  28. package/dist/features/Backup/BackupTable/index.d.ts +4 -0
  29. package/dist/features/Backup/BackupTable/index.js +3 -0
  30. package/dist/features/Backup/BackupTable/style.scss +19 -0
  31. package/dist/features/Backup/index.d.ts +7 -0
  32. package/dist/features/Backup/index.js +4 -0
  33. package/dist/features/Backup/types/Backup.d.ts +14 -0
  34. package/dist/features/Backup/types/Backup.js +1 -0
  35. package/dist/features/index.d.ts +2 -0
  36. package/dist/features/index.js +1 -0
  37. package/package.json +1 -1
@@ -1,152 +1,152 @@
1
1
  export const CommentsTexts = {
2
2
  en: {
3
- "label.title.comments": "Comments",
4
- "label.header.add": "Add a comment",
5
- "placeholder.comment.text": "Your comment",
6
- "placeholder.comment.title": "Title (optional)",
7
- "placeholder.comment.person": "Select person",
8
- "label.button.add": "Add comment",
9
- "label.button.update": "Update comment",
10
- "label.requested.to": "Sent to:",
11
- "label.posted.on": "Posted on:",
12
- "label.on": "on",
13
- "placeholder.comments.empty": "No comments available.",
14
- "tooltip.edit": "Edit comment",
15
- "tooltip.delete": "Remove comment",
16
- "tooltip.read": "Mark as read",
17
- "tooltip.reply": "Reply",
18
- "tooltip.resolve": "Mark as resolved",
19
- "tooltip.details": "See detailed information",
20
- "modal.title.details": "Comment details",
21
- "label.author": "Author",
22
- "label.edited.on": "Edited on:",
23
- "label.read": "Read",
24
- "label.unread": "Unread",
25
- "label.read.on": "Read on:",
26
- "label.requested": "Requested",
27
- "modal.title.footnote": "Edit footnote",
28
- "placeholder.footnote.text": "Enter footnote",
29
- "modal.title.footnote.remove": "Confirm footnote removal",
30
- "modal.text.footnote.remove": "Are you sure you want to remove this footnote? This action is irreversible.",
31
- "button.add": "Add comment",
32
- "input.value": "Comment",
33
- "input.title": "Title",
34
- "input.user": "Send to users",
35
- "input.user.reply": "Reply to users",
36
- "button.discard": "Discard",
37
- "notification.title": "Notifications",
38
- "notification.unread": "Unread",
39
- "notification.all": "Read",
40
- "notification.empty": "No more notifications",
41
- "notification.text": "{{user}} added a new comment.",
42
- "label.edited": "edited",
43
- "label.resolved": "resolved",
44
- "tab.write": "Write",
45
- "tab.preview": "Preview",
46
- "placeholder.preview.empty": "Nothing to preview",
47
- "menu.undock": "Undock into separate window",
48
- "menu.dock.left": "Dock to left",
49
- "menu.dock.bottom": "Dock to bottom",
50
- "menu.dock.right": "Dock to right",
3
+ 'label.title.comments': 'Comments',
4
+ 'label.header.add': 'Add a comment',
5
+ 'placeholder.comment.text': 'Your comment',
6
+ 'placeholder.comment.title': 'Title (optional)',
7
+ 'placeholder.comment.person': 'Select person',
8
+ 'label.button.add': 'Add comment',
9
+ 'label.button.update': 'Update comment',
10
+ 'label.requested.to': 'Sent to:',
11
+ 'label.posted.on': 'Posted on:',
12
+ 'label.on': 'on',
13
+ 'placeholder.comments.empty': 'No comments available.',
14
+ 'tooltip.edit': 'Edit comment',
15
+ 'tooltip.delete': 'Remove comment',
16
+ 'tooltip.read': 'Mark as read',
17
+ 'tooltip.reply': 'Reply',
18
+ 'tooltip.resolve': 'Mark as resolved',
19
+ 'tooltip.details': 'See detailed information',
20
+ 'modal.title.details': 'Comment details',
21
+ 'label.author': 'Author',
22
+ 'label.edited.on': 'Edited on:',
23
+ 'label.read': 'Read',
24
+ 'label.unread': 'Unread',
25
+ 'label.read.on': 'Read on:',
26
+ 'label.requested': 'Requested',
27
+ 'modal.title.footnote': 'Edit footnote',
28
+ 'placeholder.footnote.text': 'Enter footnote',
29
+ 'modal.title.footnote.remove': 'Confirm footnote removal',
30
+ 'modal.text.footnote.remove': 'Are you sure you want to remove this footnote? This action is irreversible.',
31
+ 'button.add': 'Add comment',
32
+ 'input.value': 'Comment',
33
+ 'input.title': 'Title',
34
+ 'input.user': 'Send to users',
35
+ 'input.user.reply': 'Reply to users',
36
+ 'button.discard': 'Discard',
37
+ 'notification.title': 'Notifications',
38
+ 'notification.unread': 'Unread',
39
+ 'notification.all': 'Read',
40
+ 'notification.empty': 'No more notifications',
41
+ 'notification.text': '{{user}} added a new comment.',
42
+ 'label.edited': 'edited',
43
+ 'label.resolved': 'resolved',
44
+ 'tab.write': 'Write',
45
+ 'tab.preview': 'Preview',
46
+ 'placeholder.preview.empty': 'Nothing to preview',
47
+ 'menu.undock': 'Undock into separate window',
48
+ 'menu.dock.left': 'Dock to left',
49
+ 'menu.dock.bottom': 'Dock to bottom',
50
+ 'menu.dock.right': 'Dock to right',
51
51
  },
52
- "pt-BR": {
53
- "label.title.comments": "Comentários",
54
- "label.header.add": "Adicionar um comentário",
55
- "placeholder.comment.text": "Sua comentário",
56
- "placeholder.comment.title": "Título (opcional)",
57
- "placeholder.comment.person": "Selecione a pessoa",
58
- "label.button.add": "Adicionar comentário",
59
- "label.button.update": "Atualizar comentário",
60
- "label.requested.to": "Enviado para:",
61
- "label.posted.on": "Postado em:",
62
- "label.on": "em",
63
- "placeholder.comments.empty": "Nenhum comentário disponível.",
64
- "tooltip.edit": "Editar comentário",
65
- "tooltip.delete": "Remover comentário",
66
- "tooltip.read": "Marcar como lido",
67
- "tooltip.reply": "Responder",
68
- "tooltip.resolve": "Marcar como resolvido",
69
- "tooltip.details": "Ver informações detalhadas",
70
- "modal.title.details": "Detalhes do comentário",
71
- "label.author": "Autor",
72
- "label.edited.on": "Editado em:",
73
- "label.read": "Lido",
74
- "label.unread": "Não lido",
75
- "label.read.on": "Lido em:",
76
- "label.requested": "Solicitados",
77
- "modal.title.footnote": "Editar nota de rodapé",
78
- "placeholder.footnote.text": "Entre o texto da nota de rodapé",
79
- "modal.title.footnote.remove": "Confirmação de exclusão de nota de rodapé",
80
- "modal.text.footnote.remove": "Tem certeza de que deseja remover esta nota de rodapé? Esta ação é irreversível.",
81
- "button.add": "Adicionar comentário",
82
- "input.value": "Comentário",
83
- "input.title": "Título",
84
- "input.user": "Enviar para usuários",
85
- "input.user.reply": "Responder para usuários",
86
- "button.discard": "Descartar",
87
- "notification.title": "Notificações",
88
- "notification.unread": "Não lidas",
89
- "notification.all": "Lidas",
90
- "notification.empty": "Não há notificações",
91
- "notification.text": "{{user}} adicionou um novo comentário.",
92
- "label.edited": "editado",
93
- "label.resolved": "resolvido",
94
- "tab.write": "Escrever",
95
- "tab.preview": "Visualizar",
96
- "placeholder.preview.empty": "Nada para visualizar",
97
- "menu.undock": "Desencaixar em janela separada",
98
- "menu.dock.left": "Encaixar à esquerda",
99
- "menu.dock.bottom": "Encaixar embaixo",
100
- "menu.dock.right": "Encaixar à direita",
52
+ 'pt-BR': {
53
+ 'label.title.comments': 'Comentários',
54
+ 'label.header.add': 'Adicionar um comentário',
55
+ 'placeholder.comment.text': 'Seu comentário',
56
+ 'placeholder.comment.title': 'Título (opcional)',
57
+ 'placeholder.comment.person': 'Selecione a pessoa',
58
+ 'label.button.add': 'Adicionar comentário',
59
+ 'label.button.update': 'Atualizar comentário',
60
+ 'label.requested.to': 'Enviado para:',
61
+ 'label.posted.on': 'Postado em:',
62
+ 'label.on': 'em',
63
+ 'placeholder.comments.empty': 'Nenhum comentário disponível.',
64
+ 'tooltip.edit': 'Editar comentário',
65
+ 'tooltip.delete': 'Remover comentário',
66
+ 'tooltip.read': 'Marcar como lido',
67
+ 'tooltip.reply': 'Responder',
68
+ 'tooltip.resolve': 'Marcar como resolvido',
69
+ 'tooltip.details': 'Ver informações detalhadas',
70
+ 'modal.title.details': 'Detalhes do comentário',
71
+ 'label.author': 'Autor',
72
+ 'label.edited.on': 'Editado em:',
73
+ 'label.read': 'Lido',
74
+ 'label.unread': 'Não lido',
75
+ 'label.read.on': 'Lido em:',
76
+ 'label.requested': 'Solicitados',
77
+ 'modal.title.footnote': 'Editar nota de rodapé',
78
+ 'placeholder.footnote.text': 'Entre o texto da nota de rodapé',
79
+ 'modal.title.footnote.remove': 'Confirmação de exclusão de nota de rodapé',
80
+ 'modal.text.footnote.remove': 'Tem certeza de que deseja remover esta nota de rodapé? Esta ação é irreversível.',
81
+ 'button.add': 'Adicionar comentário',
82
+ 'input.value': 'Comentário',
83
+ 'input.title': 'Título',
84
+ 'input.user': 'Enviar para usuários',
85
+ 'input.user.reply': 'Responder para usuários',
86
+ 'button.discard': 'Descartar',
87
+ 'notification.title': 'Notificações',
88
+ 'notification.unread': 'Não lidas',
89
+ 'notification.all': 'Lidas',
90
+ 'notification.empty': 'Não há notificações',
91
+ 'notification.text': '{{user}} adicionou um novo comentário.',
92
+ 'label.edited': 'editado',
93
+ 'label.resolved': 'resolvido',
94
+ 'tab.write': 'Escrever',
95
+ 'tab.preview': 'Visualizar',
96
+ 'placeholder.preview.empty': 'Nada para visualizar',
97
+ 'menu.undock': 'Desencaixar em janela separada',
98
+ 'menu.dock.left': 'Encaixar à esquerda',
99
+ 'menu.dock.bottom': 'Encaixar embaixo',
100
+ 'menu.dock.right': 'Encaixar à direita',
101
101
  },
102
102
  it: {
103
- "label.title.comments": "Commenti",
104
- "label.header.add": "Aggiungi un commento",
105
- "placeholder.comment.text": "Il tuo commento",
106
- "placeholder.comment.title": "Titolo (facoltativo)",
107
- "placeholder.comment.person": "Seleziona persona",
108
- "label.button.add": "Aggiungi commento",
109
- "label.button.update": "Aggiorna commento",
110
- "label.requested.to": "Inviato a:",
111
- "label.posted.on": "Pubblicato il:",
112
- "label.on": "il",
113
- "placeholder.comments.empty": "Nessun commento disponibile.",
114
- "tooltip.edit": "Modifica commento",
115
- "tooltip.delete": "Rimuovi commento",
116
- "tooltip.read": "Segnala come letto",
117
- "tooltip.reply": "Rispondi",
118
- "tooltip.resolve": "Segna come risolto",
119
- "tooltip.details": "Vedi informazioni dettagliate",
120
- "modal.title.details": "Dettagli del commento",
121
- "label.author": "Autore",
122
- "label.edited.on": "Modificato il:",
123
- "label.read": "Letto",
124
- "label.unread": "Non letto",
125
- "label.read.on": "Letto il:",
126
- "label.requested": "Richiesti",
127
- "modal.title.footnote": "Modifica nota a piè di pagina",
128
- "placeholder.footnote.text": "Inserisci nota a piè di pagina",
129
- "modal.title.footnote.remove": "Conferma rimozione nota a piè di pagina",
130
- "modal.text.footnote.remove": "Sei sicuro di voler rimuovere questa nota a piè di pagina? Questa azione è irreversibile.",
131
- "button.add": "Aggiungi commento",
132
- "input.value": "Commento",
133
- "input.title": "Titolo",
134
- "input.user": "Invia agli utenti",
135
- "input.user.reply": "Rispondi agli utenti",
136
- "button.discard": "Scarta",
137
- "notification.title": "Notifiche",
138
- "notification.unread": "Non letto",
139
- "notification.all": "Letti",
140
- "notification.empty": "Nessun'altra notifica",
141
- "notification.text": "{{user}} ha aggiunto un commento all'inserimento {{entry}}.",
142
- "label.edited": "modificato",
143
- "label.resolved": "risolto",
144
- "tab.write": "Scrivi",
145
- "tab.preview": "Anteprima",
146
- "placeholder.preview.empty": "Niente da visualizzare",
147
- "menu.undock": "Sgancia in una finestra separata",
148
- "menu.dock.left": "Aggancia a sinistra",
149
- "menu.dock.bottom": "Aggancia in basso",
150
- "menu.dock.right": "Aggancia a destra",
103
+ 'label.title.comments': 'Commenti',
104
+ 'label.header.add': 'Aggiungi un commento',
105
+ 'placeholder.comment.text': 'Il tuo commento',
106
+ 'placeholder.comment.title': 'Titolo (facoltativo)',
107
+ 'placeholder.comment.person': 'Seleziona persona',
108
+ 'label.button.add': 'Aggiungi commento',
109
+ 'label.button.update': 'Aggiorna commento',
110
+ 'label.requested.to': 'Inviato a:',
111
+ 'label.posted.on': 'Pubblicato il:',
112
+ 'label.on': 'il',
113
+ 'placeholder.comments.empty': 'Nessun commento disponibile.',
114
+ 'tooltip.edit': 'Modifica commento',
115
+ 'tooltip.delete': 'Rimuovi commento',
116
+ 'tooltip.read': 'Segnala come letto',
117
+ 'tooltip.reply': 'Rispondi',
118
+ 'tooltip.resolve': 'Segna come risolto',
119
+ 'tooltip.details': 'Vedi informazioni dettagliate',
120
+ 'modal.title.details': 'Dettagli del commento',
121
+ 'label.author': 'Autore',
122
+ 'label.edited.on': 'Modificato il:',
123
+ 'label.read': 'Letto',
124
+ 'label.unread': 'Non letto',
125
+ 'label.read.on': 'Letto il:',
126
+ 'label.requested': 'Richiesti',
127
+ 'modal.title.footnote': 'Modifica nota a piè di pagina',
128
+ 'placeholder.footnote.text': 'Inserisci nota a piè di pagina',
129
+ 'modal.title.footnote.remove': 'Conferma rimozione nota a piè di pagina',
130
+ 'modal.text.footnote.remove': 'Sei sicuro di voler rimuovere questa nota a piè di pagina? Questa azione è irreversibile.',
131
+ 'button.add': 'Aggiungi commento',
132
+ 'input.value': 'Commento',
133
+ 'input.title': 'Titolo',
134
+ 'input.user': 'Invia agli utenti',
135
+ 'input.user.reply': 'Rispondi agli utenti',
136
+ 'button.discard': 'Scarta',
137
+ 'notification.title': 'Notifiche',
138
+ 'notification.unread': 'Non letto',
139
+ 'notification.all': 'Letti',
140
+ 'notification.empty': "Nessun'altra notifica",
141
+ 'notification.text': "{{user}} ha aggiunto un commento all'inserimento {{entry}}.",
142
+ 'label.edited': 'modificato',
143
+ 'label.resolved': 'risolto',
144
+ 'tab.write': 'Scrivi',
145
+ 'tab.preview': 'Anteprima',
146
+ 'placeholder.preview.empty': 'Niente da visualizzare',
147
+ 'menu.undock': 'Sgancia in una finestra separata',
148
+ 'menu.dock.left': 'Aggancia a sinistra',
149
+ 'menu.dock.bottom': 'Aggancia in basso',
150
+ 'menu.dock.right': 'Aggancia a destra',
151
151
  },
152
152
  };
@@ -0,0 +1,11 @@
1
+ import { AccessMode } from '../../../configs/types/Access';
2
+ import Backup from '../types/Backup';
3
+ import './style.scss';
4
+ type Props = {
5
+ mode: AccessMode;
6
+ resourceUid: string;
7
+ onClose: () => void;
8
+ onConfirm: (b: Backup) => void;
9
+ };
10
+ export default function BackupCreate({ mode, resourceUid, onClose, onConfirm, }: Props): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from 'react-i18next';
3
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
4
+ import AppModalConfirm from '../../../common/AppModal/AppModalConfirm';
5
+ import BackupService from '../BackupService';
6
+ import './style.scss';
7
+ export default function BackupCreate({ mode, resourceUid, onClose, onConfirm, }) {
8
+ const { t } = useTranslation('backup');
9
+ const { isLoading, dispatchLoading, dispatchError } = useMessageUtils();
10
+ const handleConfirm = () => {
11
+ if (isLoading() || !resourceUid)
12
+ return;
13
+ dispatchLoading(true);
14
+ BackupService.execute(mode, resourceUid)
15
+ .then((r) => {
16
+ onConfirm(r.data);
17
+ })
18
+ .catch((err) => {
19
+ dispatchError({ err, t });
20
+ })
21
+ .finally(() => {
22
+ dispatchLoading(false);
23
+ });
24
+ };
25
+ return (_jsx(AppModalConfirm, { title: t('modal.title'), subtitle: t('modal.description'), onClose: onClose, onConfirm: handleConfirm }));
26
+ }
@@ -0,0 +1,2 @@
1
+ import BackupCreate from './BackupCreate';
2
+ export default BackupCreate;
@@ -0,0 +1,2 @@
1
+ import BackupCreate from './BackupCreate';
2
+ export default BackupCreate;
File without changes
@@ -0,0 +1,8 @@
1
+ import Backup from '../types/Backup';
2
+ import './style.scss';
3
+ type Props = {
4
+ backup: Backup;
5
+ onClose: () => void;
6
+ };
7
+ export default function BackupInfo({ backup, onClose }: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import AppFormInfo from '../../../common/AppForm/AppFormInfo';
5
+ import AppModal from '../../../common/AppModal';
6
+ import DateUtils from '../../../functions/DateUtils';
7
+ import './style.scss';
8
+ export default function BackupInfo({ backup, onClose }) {
9
+ const { t } = useTranslation('backup');
10
+ const fields = useMemo(() => getBackupInfoFields(t), [t]);
11
+ return (_jsxs(AppModal, { title: t('modal.title.info'), className: "modal-metadata", close: onClose, closeLabel: t('modal.button.close'), children: [_jsx(AppFormInfo, { fields: fields, data: backup }), _jsxs("div", { className: "item item-log", children: [_jsx("span", { className: "label", children: t('backup.label.log') }), _jsx("div", { className: "pre-like", children: backup.log })] })] }));
12
+ }
13
+ const getBackupInfoFields = (t) => [
14
+ {
15
+ attr: 'filename',
16
+ name: t('backup.field.filename'),
17
+ type: 'display',
18
+ },
19
+ {
20
+ attr: 'status',
21
+ name: t('backup.field.status'),
22
+ type: 'display',
23
+ fn: (status) => t(`backup.status.${status?.toLowerCase()}`),
24
+ },
25
+ {
26
+ attr: 'user.name',
27
+ name: t('backup.field.user.name'),
28
+ type: 'display',
29
+ },
30
+ {
31
+ attr: 'id',
32
+ name: t('backup.field.id'),
33
+ type: 'function',
34
+ fn: (id) => DateUtils.extractDateFromMongoId(id, true),
35
+ },
36
+ ];
@@ -0,0 +1,2 @@
1
+ import BackupInfo from './BackupInfo';
2
+ export default BackupInfo;
@@ -0,0 +1,2 @@
1
+ import BackupInfo from './BackupInfo';
2
+ export default BackupInfo;
@@ -0,0 +1,23 @@
1
+ .modal-metadata {
2
+ width: 50vw;
3
+ max-width: 50vw;
4
+
5
+ .body {
6
+ .item {
7
+ .label {
8
+ @include label-medium-2;
9
+ }
10
+ }
11
+
12
+ .item-log {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 8px;
16
+ margin-top: 16px;
17
+
18
+ .pre-like {
19
+ height: 200px;
20
+ }
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,7 @@
1
+ import { AccessMode } from '../../../configs/types/Access';
2
+ import './style.scss';
3
+ export type BackupRestoreProps = {
4
+ mode: AccessMode;
5
+ onClose: () => void;
6
+ };
7
+ export default function BackupRestore({ mode, onClose }: BackupRestoreProps): import("react").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import AppDropzone from '../../../common/AppDropzone';
5
+ import AppModal from '../../../common/AppModal';
6
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
7
+ import BackupService from '../BackupService';
8
+ import './style.scss';
9
+ export default function BackupRestore({ mode, onClose }) {
10
+ const { t } = useTranslation('backup');
11
+ const { isLoading, dispatchLoading, dispatchError } = useMessageUtils();
12
+ const [openExists, setOpenExists] = useState(false);
13
+ const [backup, setBackup] = useState();
14
+ const handleSuccess = (uploaded) => {
15
+ BackupService.restore(mode, uploaded)
16
+ .then((r) => {
17
+ setBackup(r.data);
18
+ if (r.data.message === 'corpus.exists') {
19
+ setOpenExists(true);
20
+ }
21
+ else {
22
+ handleExecute(r.data.id);
23
+ }
24
+ })
25
+ .catch((err) => {
26
+ dispatchError({ err, t });
27
+ });
28
+ };
29
+ const handleExecute = (id) => {
30
+ if (isLoading())
31
+ return;
32
+ dispatchLoading(true);
33
+ BackupService.executeRestore(id)
34
+ .then(() => {
35
+ location.reload();
36
+ })
37
+ .catch((err) => {
38
+ dispatchError({ err, t });
39
+ })
40
+ .finally(() => {
41
+ dispatchLoading(false);
42
+ });
43
+ };
44
+ const handleError = () => {
45
+ dispatchError({ err: 'message:upload.error', t });
46
+ };
47
+ return (_jsxs(_Fragment, { children: [_jsx(AppDropzone, { folder: "/restore", onSuccess: handleSuccess, onError: handleError, onClose: onClose, keepName: true, accept: {
48
+ 'application/gzip': ['.gz'],
49
+ 'application/x-tar': ['.tar'],
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') })] }) }) }))] }));
52
+ }
@@ -0,0 +1,3 @@
1
+ import BackupRestore from './BackupRestore';
2
+ export default BackupRestore;
3
+ export type { BackupRestoreProps } from './BackupRestore';
@@ -0,0 +1,2 @@
1
+ import BackupRestore from './BackupRestore';
2
+ export default BackupRestore;
@@ -0,0 +1,17 @@
1
+ .modal-metadata {
2
+ width: 50vw;
3
+ max-width: 50vw;
4
+
5
+ .modal-content {
6
+ .buttons {
7
+ margin-top: 24px;
8
+ text-align: center;
9
+ border-top: var(--border-default);
10
+ padding-top: 16px;
11
+
12
+ .btn svg {
13
+ margin-right: 8px;
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ import { AccessMode } from '../../configs/types/Access';
2
+ import { AppPage } from '../../common';
3
+ import { UploadedFile } from '../../common/AppDropzone/UploadedFile';
4
+ import { BackupSearchFilter } from './BackupTable/BackupSearchFilter';
5
+ import Backup from './types/Backup';
6
+ declare function page(mode: AccessMode, resourceUid: string, filter: BackupSearchFilter): Promise<import("axios").AxiosResponse<AppPage<Backup>, any, {}, any>>;
7
+ declare function execute(mode: AccessMode, resourceUid: string): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
8
+ declare function restore(mode: AccessMode, uploaded: UploadedFile): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
9
+ declare function executeRestore(id: string): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
10
+ declare function download(id: string): Promise<import("axios").AxiosResponse<string, any, {}, any>>;
11
+ declare const BackupService: {
12
+ page: typeof page;
13
+ execute: typeof execute;
14
+ download: typeof download;
15
+ restore: typeof restore;
16
+ executeRestore: typeof executeRestore;
17
+ };
18
+ export default BackupService;
@@ -0,0 +1,39 @@
1
+ import api from '../../configs/api';
2
+ import { convertPageable } from '../../common';
3
+ const FUNCTIONS_API = () => import.meta.env.VITE_APP_FUNCTIONS_API;
4
+ const APP_BY_MODE = {
5
+ corpus: 'CORPUS',
6
+ parser: 'PARSER',
7
+ lexicon: 'LEXICON',
8
+ };
9
+ function page(mode, resourceUid, filter) {
10
+ const data = {
11
+ id: resourceUid,
12
+ app: APP_BY_MODE[mode],
13
+ ...convertPageable(filter),
14
+ };
15
+ return api.post(`${FUNCTIONS_API()}/backup`, data);
16
+ }
17
+ function execute(mode, resourceUid) {
18
+ return api.get(`${FUNCTIONS_API()}/backup/${resourceUid}/${APP_BY_MODE[mode]}`);
19
+ }
20
+ function restore(mode, uploaded) {
21
+ return api.post(`${FUNCTIONS_API()}/backup/restore`, {
22
+ filename: uploaded.path,
23
+ app: APP_BY_MODE[mode],
24
+ });
25
+ }
26
+ function executeRestore(id) {
27
+ return api.post(`${FUNCTIONS_API()}/backup/restore/${id}`);
28
+ }
29
+ function download(id) {
30
+ return api.get(`${FUNCTIONS_API()}/backup/download/${id}`);
31
+ }
32
+ const BackupService = {
33
+ page,
34
+ execute,
35
+ download,
36
+ restore,
37
+ executeRestore,
38
+ };
39
+ export default BackupService;
@@ -0,0 +1,5 @@
1
+ import { AppPageable } from '../../../common';
2
+ type Filter = {};
3
+ export type BackupSearchFilter = Filter & AppPageable;
4
+ export declare const EMPTY_BACKUP_SEARCH_FILTER: BackupSearchFilter;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ export const EMPTY_BACKUP_SEARCH_FILTER = {
2
+ page: 0,
3
+ size: 10,
4
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AccessMode } from '../../../configs/types/Access';
3
+ import './style.scss';
4
+ export type BackupTableProps = {
5
+ mode: AccessMode;
6
+ resourceUid: string;
7
+ };
8
+ export default function BackupTable({ mode, resourceUid }: BackupTableProps): React.JSX.Element;