corpushub-design-system 0.1.0 → 0.1.2

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 (144) hide show
  1. package/dist/common/AppDropzone/AppDropzoneBody.js +2 -1
  2. package/dist/common/AppDropzone/UploadedFile.d.ts +2 -0
  3. package/dist/common/AppDropzone/index.d.ts +2 -0
  4. package/dist/common/AppDropzone/index.js +1 -0
  5. package/dist/common/AppDropzone/toMediaDisplayUrl.d.ts +10 -0
  6. package/dist/common/AppDropzone/toMediaDisplayUrl.js +27 -0
  7. package/dist/common/AppPicture/AppPicture.js +1 -1
  8. package/dist/common/AppTable/styles.scss +6 -2
  9. package/dist/common/index.d.ts +1 -1
  10. package/dist/common/index.js +1 -1
  11. package/dist/configs/Localization.js +4 -0
  12. package/dist/configs/api/applyAuthErrorHandling.js +5 -0
  13. package/dist/configs/api/index.js +2 -0
  14. package/dist/configs/auth/authApi.js +6 -0
  15. package/dist/configs/auth/installAuthRefreshInterceptor.js +5 -0
  16. package/dist/configs/auth/isPublicAuthRequest.d.ts +6 -0
  17. package/dist/configs/auth/isPublicAuthRequest.js +28 -0
  18. package/dist/configs/auth/session.js +8 -6
  19. package/dist/configs/brand.d.ts +6 -0
  20. package/dist/configs/brand.js +10 -3
  21. package/dist/configs/index.d.ts +3 -2
  22. package/dist/configs/index.js +2 -1
  23. package/dist/configs/localization/BackupTexts.d.ts +74 -0
  24. package/dist/configs/localization/BackupTexts.js +74 -0
  25. package/dist/configs/localization/CommentsTexts.d.ts +145 -145
  26. package/dist/configs/localization/CommentsTexts.js +145 -145
  27. package/dist/configs/localization/CommonTexts.d.ts +15 -0
  28. package/dist/configs/localization/CommonTexts.js +18 -3
  29. package/dist/configs/localization/HeaderTexts.js +3 -3
  30. package/dist/configs/localization/HelpTexts.d.ts +44 -2
  31. package/dist/configs/localization/HelpTexts.js +53 -11
  32. package/dist/configs/localization/HistoryTexts.d.ts +6 -0
  33. package/dist/configs/localization/HistoryTexts.js +6 -0
  34. package/dist/configs/localization/ParserRuleGroupsTexts.d.ts +53 -0
  35. package/dist/configs/localization/ParserRuleGroupsTexts.js +53 -0
  36. package/dist/configs/localization/SentenceTexts.js +33 -33
  37. package/dist/configs/services/ProfileService.js +3 -3
  38. package/dist/configs/tour/index.d.ts +1 -1
  39. package/dist/configs/types/CorpusImage.d.ts +3 -0
  40. package/dist/features/AccessControl/AccessControlService.d.ts +9 -0
  41. package/dist/features/AccessControl/AccessControlService.js +22 -8
  42. package/dist/features/AccessControl/AccessGrant/AccessGrant.js +3 -1
  43. package/dist/features/AccessControl/AccessUser/AccessData.d.ts +2 -2
  44. package/dist/features/AccessControl/AccessUser/AccessData.js +21 -21
  45. package/dist/features/AccessControl/AccessUser/AccessUser.js +20 -3
  46. package/dist/features/AccessControl/AccessUser/AccessUserGroups.d.ts +8 -0
  47. package/dist/features/AccessControl/AccessUser/AccessUserGroups.js +77 -0
  48. package/dist/features/AccessControl/AccessUser/style.scss +41 -3
  49. package/dist/features/AccessControl/AccessUsers/AccessUsers.js +44 -29
  50. package/dist/features/AccessControl/AccessUsers/styles.scss +5 -0
  51. package/dist/features/AccessControl/index.d.ts +1 -0
  52. package/dist/features/AccessControl/types/CorpusGroup.d.ts +10 -0
  53. package/dist/features/AccessControl/types/CorpusGroup.js +1 -0
  54. package/dist/features/AccessControl/types/UserAccessResponse.d.ts +4 -0
  55. package/dist/features/Backup/BackupCreate/BackupCreate.d.ts +11 -0
  56. package/dist/features/Backup/BackupCreate/BackupCreate.js +89 -0
  57. package/dist/features/Backup/BackupCreate/index.d.ts +2 -0
  58. package/dist/features/Backup/BackupCreate/index.js +2 -0
  59. package/dist/features/Backup/BackupCreate/style.scss +5 -0
  60. package/dist/features/Backup/BackupInfo/BackupInfo.d.ts +8 -0
  61. package/dist/features/Backup/BackupInfo/BackupInfo.js +36 -0
  62. package/dist/features/Backup/BackupInfo/index.d.ts +2 -0
  63. package/dist/features/Backup/BackupInfo/index.js +2 -0
  64. package/dist/features/Backup/BackupInfo/style.scss +23 -0
  65. package/dist/features/Backup/BackupRestore/BackupRestore.d.ts +7 -0
  66. package/dist/features/Backup/BackupRestore/BackupRestore.js +52 -0
  67. package/dist/features/Backup/BackupRestore/index.d.ts +3 -0
  68. package/dist/features/Backup/BackupRestore/index.js +2 -0
  69. package/dist/features/Backup/BackupRestore/style.scss +17 -0
  70. package/dist/features/Backup/BackupService.d.ts +20 -0
  71. package/dist/features/Backup/BackupService.js +43 -0
  72. package/dist/features/Backup/BackupTable/BackupSearchFilter.d.ts +5 -0
  73. package/dist/features/Backup/BackupTable/BackupSearchFilter.js +4 -0
  74. package/dist/features/Backup/BackupTable/BackupTable.d.ts +8 -0
  75. package/dist/features/Backup/BackupTable/BackupTable.js +121 -0
  76. package/dist/features/Backup/BackupTable/index.d.ts +4 -0
  77. package/dist/features/Backup/BackupTable/index.js +3 -0
  78. package/dist/features/Backup/BackupTable/style.scss +19 -0
  79. package/dist/features/Backup/index.d.ts +7 -0
  80. package/dist/features/Backup/index.js +4 -0
  81. package/dist/features/Backup/types/Backup.d.ts +14 -0
  82. package/dist/features/Backup/types/Backup.js +1 -0
  83. package/dist/features/Comments/CommentService.js +2 -1
  84. package/dist/features/PageRender/PageRenderView.d.ts +1 -1
  85. package/dist/features/PageRender/PageRenderView.js +67 -9
  86. package/dist/features/PageRender/style.scss +27 -5
  87. package/dist/features/PageRender/types.d.ts +5 -1
  88. package/dist/features/ParserRuleGroups/ParserRuleGroupItem.d.ts +9 -0
  89. package/dist/features/ParserRuleGroups/ParserRuleGroupItem.js +18 -0
  90. package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.d.ts +17 -0
  91. package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.js +129 -0
  92. package/dist/features/ParserRuleGroups/index.d.ts +2 -0
  93. package/dist/features/ParserRuleGroups/index.js +2 -0
  94. package/dist/features/ParserRuleGroups/style.scss +81 -0
  95. package/dist/features/ServerErrorReport/ServerErrorReport.js +9 -48
  96. package/dist/features/ServerErrorReport/ServerErrorReportForm.d.ts +22 -0
  97. package/dist/features/ServerErrorReport/ServerErrorReportForm.js +85 -0
  98. package/dist/features/ServerErrorReport/captureTabScreenshot.d.ts +1 -1
  99. package/dist/features/ServerErrorReport/captureTabScreenshot.js +5 -20
  100. package/dist/features/ServerErrorReport/index.d.ts +2 -0
  101. package/dist/features/ServerErrorReport/index.js +1 -0
  102. package/dist/features/ServerErrorReport/styles.scss +22 -9
  103. package/dist/features/index.d.ts +5 -1
  104. package/dist/features/index.js +2 -0
  105. package/dist/functions/EditionTierUtils.js +11 -5
  106. package/dist/primitives/AsyncSelectField/AsyncSelectField.js +2 -2
  107. package/dist/primitives/AsyncSelectField/styles.scss +31 -31
  108. package/dist/primitives/Button/Button.d.ts +5 -4
  109. package/dist/primitives/Button/Button.js +19 -19
  110. package/dist/primitives/DropdownButton/DropdownButton.d.ts +2 -1
  111. package/dist/primitives/DropdownButton/DropdownButton.js +2 -2
  112. package/dist/primitives/DropdownMenu/DropdownMenu.js +7 -1
  113. package/dist/primitives/Icon/Icon.d.ts +2 -1
  114. package/dist/primitives/Icon/Icon.js +2 -2
  115. package/dist/primitives/IconButton/IconButton.d.ts +2 -1
  116. package/dist/primitives/IconButton/IconButton.js +2 -2
  117. package/dist/primitives/Tag/Tag.d.ts +2 -1
  118. package/dist/primitives/Tag/Tag.js +3 -3
  119. package/dist/primitives/index.js +1 -1
  120. package/dist/shell/Header/HelpButton/HelpModal.js +3 -69
  121. package/dist/shell/Header/HelpButton/HelpModalMainColumn.d.ts +5 -0
  122. package/dist/shell/Header/HelpButton/HelpModalMainColumn.js +76 -0
  123. package/dist/shell/Header/HelpButton/HelpModalSideColumn.d.ts +7 -0
  124. package/dist/shell/Header/HelpButton/HelpModalSideColumn.js +18 -0
  125. package/dist/shell/Header/HelpButton/live-tour.png +0 -0
  126. package/dist/shell/Header/HelpButton/style.scss +330 -47
  127. package/dist/styles/base/_typographs.scss +376 -1
  128. package/dist/styles/main.scss +112 -1
  129. package/package.json +1 -1
  130. package/dist/primitives/styles/base/_typographs.scss +0 -376
  131. package/dist/primitives/styles/font-googleapis.scss +0 -222
  132. package/dist/primitives/styles/main.scss +0 -112
  133. /package/dist/{primitives/fonts → fonts}/material-symbols-outlined.woff2 +0 -0
  134. /package/dist/{primitives/fonts → fonts}/work-sans-latin-ext.woff2 +0 -0
  135. /package/dist/{primitives/fonts → fonts}/work-sans-latin.woff2 +0 -0
  136. /package/dist/{primitives/fonts → fonts}/work-sans-vietnamese.woff2 +0 -0
  137. /package/dist/{primitives/fonts.d.ts → fonts.d.ts} +0 -0
  138. /package/dist/{primitives/fonts.js → fonts.js} +0 -0
  139. /package/dist/{primitives/styles → styles}/base/_borders.scss +0 -0
  140. /package/dist/{primitives/styles → styles}/base/_colors.scss +0 -0
  141. /package/dist/{primitives/styles → styles}/base/_displays.scss +0 -0
  142. /package/dist/{primitives/styles → styles}/base/_margins.css +0 -0
  143. /package/dist/{primitives/styles → styles}/base/_spacing.scss +0 -0
  144. /package/dist/{primitives/styles → styles}/base/_tokens.scss +0 -0
@@ -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 AppLoading from '../../../common/AppLoading';
6
+ import AppModal from '../../../common/AppModal';
7
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
8
+ import BackupService from '../BackupService';
9
+ import './style.scss';
10
+ export default function BackupRestore({ mode, onClose }) {
11
+ const { t } = useTranslation('backup');
12
+ const { dispatchError } = useMessageUtils();
13
+ const [openExists, setOpenExists] = useState(false);
14
+ const [backup, setBackup] = useState();
15
+ const [loading, setLoading] = useState(false);
16
+ const handleSuccess = (uploaded) => {
17
+ BackupService.restore(mode, uploaded)
18
+ .then((r) => {
19
+ setBackup(r.data);
20
+ if (r.data.message === 'corpus.exists') {
21
+ setOpenExists(true);
22
+ }
23
+ else {
24
+ handleExecute(r.data.id);
25
+ }
26
+ })
27
+ .catch((err) => {
28
+ dispatchError({ err, t });
29
+ });
30
+ };
31
+ const handleExecute = (id) => {
32
+ if (loading)
33
+ return;
34
+ setLoading(true);
35
+ BackupService.executeRestore(id)
36
+ .then(() => {
37
+ location.reload();
38
+ })
39
+ .catch((err) => {
40
+ dispatchError({ err, t });
41
+ setLoading(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 && (_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
+ }
@@ -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,20 @@
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 status(id: string): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
9
+ declare function restore(mode: AccessMode, uploaded: UploadedFile): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
10
+ declare function executeRestore(id: string): Promise<import("axios").AxiosResponse<Backup, any, {}, any>>;
11
+ declare function download(id: string): Promise<import("axios").AxiosResponse<string, any, {}, any>>;
12
+ declare const BackupService: {
13
+ page: typeof page;
14
+ execute: typeof execute;
15
+ status: typeof status;
16
+ download: typeof download;
17
+ restore: typeof restore;
18
+ executeRestore: typeof executeRestore;
19
+ };
20
+ export default BackupService;
@@ -0,0 +1,43 @@
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 status(id) {
21
+ return api.get(`${FUNCTIONS_API()}/backup/status/${id}`);
22
+ }
23
+ function restore(mode, uploaded) {
24
+ return api.post(`${FUNCTIONS_API()}/backup/restore`, {
25
+ filename: uploaded.path,
26
+ app: APP_BY_MODE[mode],
27
+ });
28
+ }
29
+ function executeRestore(id) {
30
+ return api.post(`${FUNCTIONS_API()}/backup/restore/${id}`);
31
+ }
32
+ function download(id) {
33
+ return api.get(`${FUNCTIONS_API()}/backup/download/${id}`);
34
+ }
35
+ const BackupService = {
36
+ page,
37
+ execute,
38
+ status,
39
+ download,
40
+ restore,
41
+ executeRestore,
42
+ };
43
+ 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;
@@ -0,0 +1,121 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import AppCard from '../../../common/AppCard/AppCard';
5
+ import AppPicture from '../../../common/AppPicture';
6
+ import AppPlaceholder from '../../../common/AppPlaceholder';
7
+ import AppTable from '../../../common/AppTable';
8
+ import { EMPTY_PAGE } from '../../../common/AppTable/types/AppPage';
9
+ import DateUtils from '../../../functions/DateUtils';
10
+ import { Button } from '../../../primitives';
11
+ import BackupCreate from '../BackupCreate';
12
+ import BackupInfo from '../BackupInfo';
13
+ import BackupService from '../BackupService';
14
+ import { EMPTY_BACKUP_SEARCH_FILTER, } from './BackupSearchFilter';
15
+ import './style.scss';
16
+ export default function BackupTable({ mode, resourceUid }) {
17
+ const { t } = useTranslation('backup');
18
+ const [filter, setFilter] = useState(EMPTY_BACKUP_SEARCH_FILTER);
19
+ const [data, setData] = useState();
20
+ const [selected, setSelected] = useState();
21
+ const [openInfo, setOpenInfo] = useState(false);
22
+ const [openCreate, setOpenCreate] = useState(false);
23
+ const load = () => {
24
+ if (!resourceUid)
25
+ return;
26
+ BackupService.page(mode, resourceUid, filter).then((r) => {
27
+ setData(r.data);
28
+ });
29
+ };
30
+ const onClickRow = (row) => {
31
+ setSelected(row);
32
+ setOpenInfo(true);
33
+ };
34
+ const handleCreate = () => {
35
+ setSelected(undefined);
36
+ setOpenCreate(true);
37
+ };
38
+ const onConfirm = (backup) => {
39
+ const updatedData = {
40
+ ...(data || EMPTY_PAGE),
41
+ totalElements: (data?.totalElements ?? 0) + 1,
42
+ content: [backup, ...(data?.content ?? [])],
43
+ };
44
+ setData(updatedData);
45
+ setOpenCreate(false);
46
+ };
47
+ const handleDownload = (fileUrl) => {
48
+ if (!resourceUid)
49
+ return;
50
+ BackupService.download(resourceUid).then((r) => {
51
+ const filename = fileUrl.split('/').pop();
52
+ if (!filename) {
53
+ console.error('Invalid file URL');
54
+ return;
55
+ }
56
+ const secureUrl = `${fileUrl}?token=${encodeURIComponent(r.data)}`;
57
+ window.open(secureUrl, '_blank');
58
+ });
59
+ };
60
+ const menuOptions = [
61
+ {
62
+ icon: 'add',
63
+ label: t('button.create'),
64
+ onClick: handleCreate,
65
+ },
66
+ ];
67
+ const addDownloadButtonToCell = (props) => {
68
+ return (_jsx(Button, { text: t('backup.field.download'), size: "x-small", onClick: (e) => {
69
+ e.stopPropagation();
70
+ handleDownload(props.row.original.path);
71
+ } }));
72
+ };
73
+ const addDateToCell = (props) => {
74
+ return (_jsx("span", { children: DateUtils.extractDateFromMongoId(props.row.original.id, true) }));
75
+ };
76
+ const addUserToCell = (props) => {
77
+ const user = props.row.original.user;
78
+ return (_jsxs("div", { className: "user", children: [_jsx(AppPicture, { className: "avatar", src: user.picture, person: true }), _jsx("span", { className: "ms-2", children: user.name })] }));
79
+ };
80
+ const columns = React.useMemo(() => [
81
+ {
82
+ id: 'date',
83
+ header: t('backup.field.id'),
84
+ cell: addDateToCell,
85
+ size: 20,
86
+ },
87
+ {
88
+ id: 'filename',
89
+ header: t('backup.field.filename'),
90
+ accessorKey: 'filename',
91
+ size: 45,
92
+ },
93
+ {
94
+ id: 'user',
95
+ header: t('backup.field.user.name'),
96
+ cell: addUserToCell,
97
+ size: 25,
98
+ },
99
+ {
100
+ id: 'status',
101
+ header: t('backup.field.status'),
102
+ accessorKey: 'status',
103
+ cell: (props) => t(`backup.status.${props.row.original.status.toLowerCase()}`),
104
+ size: 10,
105
+ },
106
+ {
107
+ id: 'download',
108
+ header: t('backup.field.download'),
109
+ cell: addDownloadButtonToCell,
110
+ size: 10,
111
+ },
112
+ ], [data, t]);
113
+ useEffect(() => {
114
+ load();
115
+ }, [filter, resourceUid, mode]);
116
+ return (_jsxs(AppCard, { title: t('label.title'), className: "base-card backup-table-card", dataTour: "admin-info-backups-panel", options: menuOptions, children: [data && data.totalElements !== 0 && (_jsx(AppTable, { columns: columns, data: data, onClickRow: onClickRow, pagination: { pageIndex: filter.page, pageSize: filter.size }, setPagination: (p) => {
117
+ setFilter({ ...filter, page: p.pageIndex, size: p.pageSize });
118
+ }, sorting: filter.sort || [], setSorting: (s) => {
119
+ setFilter({ ...filter, sort: s });
120
+ } })), data && data.totalElements === 0 && (_jsx(AppPlaceholder, { text: t('placeholder.empty') })), openInfo && selected && (_jsx(BackupInfo, { backup: selected, onClose: () => setOpenInfo(false) })), openCreate && (_jsx(BackupCreate, { mode: mode, resourceUid: resourceUid, onClose: () => setOpenCreate(false), onConfirm: onConfirm }))] }));
121
+ }
@@ -0,0 +1,4 @@
1
+ import BackupTable from './BackupTable';
2
+ export default BackupTable;
3
+ export type { BackupTableProps } from './BackupTable';
4
+ export { EMPTY_BACKUP_SEARCH_FILTER, type BackupSearchFilter, } from './BackupSearchFilter';
@@ -0,0 +1,3 @@
1
+ import BackupTable from './BackupTable';
2
+ export default BackupTable;
3
+ export { EMPTY_BACKUP_SEARCH_FILTER, } from './BackupSearchFilter';
@@ -0,0 +1,19 @@
1
+ .backup-table-card {
2
+ overflow: hidden;
3
+
4
+ .body {
5
+ padding: 0;
6
+
7
+ .user {
8
+ display: flex;
9
+ align-items: center;
10
+
11
+ .avatar {
12
+ width: 28px;
13
+ height: 28px;
14
+ border-radius: 50%;
15
+ object-fit: cover;
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,7 @@
1
+ export { default as BackupTable } from './BackupTable';
2
+ export type { BackupTableProps } from './BackupTable';
3
+ export { EMPTY_BACKUP_SEARCH_FILTER, type BackupSearchFilter, } from './BackupTable';
4
+ export { default as BackupRestore } from './BackupRestore';
5
+ export type { BackupRestoreProps } from './BackupRestore';
6
+ export { default as BackupService } from './BackupService';
7
+ export type { Backup, BackupStatus } from './types/Backup';
@@ -0,0 +1,4 @@
1
+ export { default as BackupTable } from './BackupTable';
2
+ export { EMPTY_BACKUP_SEARCH_FILTER, } from './BackupTable';
3
+ export { default as BackupRestore } from './BackupRestore';
4
+ export { default as BackupService } from './BackupService';
@@ -0,0 +1,14 @@
1
+ import { User } from '../../../configs/types/User';
2
+ export type BackupStatus = 'ERROR' | 'PROCESSING' | 'FINISHED';
3
+ export type Backup = {
4
+ id: string;
5
+ log: string;
6
+ ref: string;
7
+ filename: string;
8
+ user: User;
9
+ status: BackupStatus;
10
+ app: string;
11
+ message: string;
12
+ path: string;
13
+ };
14
+ export default Backup;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import api from '../../configs/api';
2
+ import authApi from '../../configs/auth/authApi';
2
3
  import StorybookUtils from '../../functions/StorybookUtils';
3
4
  import { mockCommentUsers, mockComments } from './CommentService.mock';
4
5
  let storybookComments = mockComments.map((c) => ({ ...c }));
@@ -109,7 +110,7 @@ function findAvailableUsers(uid, mode) {
109
110
  if (StorybookUtils.isStorybook()) {
110
111
  return mockResponse(mockCommentUsers);
111
112
  }
112
- return api.get(`${import.meta.env.VITE_APP_AUTH_API}/${mode}/${uid}`);
113
+ return authApi.get(`/${mode}/${uid}`);
113
114
  }
114
115
  const CommentService = {
115
116
  add,
@@ -2,5 +2,5 @@ import './style.scss';
2
2
  import { CollapsedPageRenderElement, PageRenderElement, PageRenderViewProps } from './types';
3
3
  /** Ensure PARTICIPANT elements carry a sentence uid (API or next-token look-ahead). */
4
4
  export declare function withParticipantSentenceUids(elements: PageRenderElement[]): PageRenderElement[];
5
- export default function PageRenderView({ elements, selectedTier, corpus, displayTags, showLineNumbers, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }: PageRenderViewProps): import("react").JSX.Element;
5
+ export default function PageRenderView({ elements, selectedTier, corpus, displayTags, showLineNumbers, showSectionLabels, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, getSectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }: PageRenderViewProps): import("react").JSX.Element;
6
6
  export declare function findPunctuationAfterCollapsedJunction(items: CollapsedPageRenderElement[], junctionIndex: number): number | undefined;
@@ -24,7 +24,7 @@ export function withParticipantSentenceUids(elements) {
24
24
  return element;
25
25
  });
26
26
  }
27
- export default function PageRenderView({ elements, selectedTier, corpus, displayTags = false, showLineNumbers = true, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
27
+ export default function PageRenderView({ elements, selectedTier, corpus, displayTags = false, showLineNumbers = true, showSectionLabels = true, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, getSectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
28
28
  const elementsWithUids = useMemo(() => withParticipantSentenceUids(elements), [elements]);
29
29
  const collapsed = collapseElementsForTier(elementsWithUids, selectedTier, corpus);
30
30
  const punctuationBeforeBreak = new Map();
@@ -36,8 +36,30 @@ export default function PageRenderView({ elements, selectedTier, corpus, display
36
36
  punctuationBeforeBreak.set(index, punctuationIndex);
37
37
  punctuationIndexes.add(punctuationIndex);
38
38
  });
39
+ const sectionLabelByItemKey = useMemo(() => {
40
+ const labels = new Map();
41
+ if (!showSectionLabels || !getSectionLabel)
42
+ return labels;
43
+ const seenSentences = new Set();
44
+ for (const item of collapsed) {
45
+ if (!isTokenBearingItem(item))
46
+ continue;
47
+ const uid = sentenceUidForItem(item);
48
+ if (!uid || seenSentences.has(uid))
49
+ continue;
50
+ // Skip empty categories / hidden tokens so the chip floats over the
51
+ // first actually displayed word of the sentence.
52
+ if (!isVisibleSectionHost(item, displayTags))
53
+ continue;
54
+ seenSentences.add(uid);
55
+ const label = getSectionLabel(uid);
56
+ if (label)
57
+ labels.set(item.key, label);
58
+ }
59
+ return labels;
60
+ }, [collapsed, displayTags, getSectionLabel, showSectionLabels]);
39
61
  const renderItem = (item) => (_jsx(PageRenderElementItem, { item: item, highlight: highlightSentenceUid != null &&
40
- sentenceUidForItem(item) === highlightSentenceUid, showLineNumbers: showLineNumbers, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, getParticipantName: getParticipantName, getParticipantColor: getParticipantColor, onTokenClick: onTokenClick, onTokenHover: onTokenHover, onParticipantHover: onParticipantHover, onParticipantClick: onParticipantClick, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }, item.key));
62
+ sentenceUidForItem(item) === highlightSentenceUid, showLineNumbers: showLineNumbers, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, getParticipantName: getParticipantName, getParticipantColor: getParticipantColor, sectionLabel: sectionLabelByItemKey.get(item.key), onTokenClick: onTokenClick, onTokenHover: onTokenHover, onParticipantHover: onParticipantHover, onParticipantClick: onParticipantClick, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }, item.key));
41
63
  return (_jsx("div", { className: "page-render-elements", children: collapsed.map((item, index) => {
42
64
  if (punctuationIndexes.has(index))
43
65
  return null;
@@ -82,9 +104,40 @@ function sentenceUidForItem(item) {
82
104
  return item.element.uid;
83
105
  return undefined;
84
106
  }
85
- function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
107
+ function isTokenBearingItem(item) {
108
+ if (item.kind === 'collapsedJunction')
109
+ return true;
110
+ if (item.kind !== 'single' || !item.element.token)
111
+ return false;
112
+ return (item.element.type === PageRenderElementType.TOKEN ||
113
+ item.element.type === PageRenderElementType.JUNCTION_SPLIT ||
114
+ item.element.type === PageRenderElementType.MARK);
115
+ }
116
+ function tokenRefForItem(item) {
117
+ if (item.kind === 'collapsedJunction')
118
+ return item.token;
119
+ return item.element.token;
120
+ }
121
+ /** Matches TokenNode visibility: marks always show; empty categories do not. */
122
+ function isVisibleSectionHost(item, displayTags) {
123
+ const ref = tokenRefForItem(item);
124
+ if (!ref)
125
+ return false;
126
+ const isMark = item.kind === 'single' &&
127
+ item.element.type === PageRenderElementType.MARK;
128
+ if (isMark)
129
+ return true;
130
+ if (!isTokenRefVisible(ref))
131
+ return false;
132
+ // Same rule as TokenNode: split pieces of empty categories are hidden
133
+ // when POS tags are off.
134
+ if (ref.ec && ref.split && !displayTags)
135
+ return false;
136
+ return true;
137
+ }
138
+ function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, sectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
86
139
  if (item.kind === 'collapsedJunction') {
87
- return (_jsx(TokenNode, { refToken: item.token, splitIdx: item.splitIdx ?? 0, isSplit: true, isCollapsedJunction: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
140
+ return (_jsx(TokenNode, { refToken: item.token, splitIdx: item.splitIdx ?? 0, isSplit: true, isCollapsedJunction: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
88
141
  }
89
142
  const { element } = item;
90
143
  switch (element.type) {
@@ -112,20 +165,20 @@ function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags,
112
165
  case PageRenderElementType.MARK:
113
166
  if (!element.token)
114
167
  return null;
115
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: 0, isMark: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
168
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, isMark: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
116
169
  case PageRenderElementType.JUNCTION_SPLIT:
117
170
  if (!element.token)
118
171
  return null;
119
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: element.idx ?? 0, isSplit: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
172
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: element.idx ?? 0, isSplit: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
120
173
  case PageRenderElementType.TOKEN:
121
174
  if (!element.token)
122
175
  return null;
123
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: 0, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
176
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
124
177
  default:
125
178
  return null;
126
179
  }
127
180
  }
128
- function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isCollapsedJunction = false, highlight, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, onTokenClick, onTokenHover, wrapToken, renderTokenSuffix, }) {
181
+ function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isCollapsedJunction = false, highlight, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, sectionLabel, onTokenClick, onTokenHover, wrapToken, renderTokenSuffix, }) {
129
182
  const token = tokenRefToToken(refToken);
130
183
  const displaySplits = Boolean(token.ec && token.split && !displayTags);
131
184
  const visible = isMark || isTokenRefVisible(refToken);
@@ -161,5 +214,10 @@ function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isColl
161
214
  onTokenClick(refToken, splitIdx, 'sentence', clickModifiers(event));
162
215
  }
163
216
  : undefined, onMouseEnter: () => onTokenHover?.(refToken.uid), onMouseLeave: () => onTokenHover?.(undefined), children: [getDisplayValue(token, splitIdx), displayTags && (_jsxs("b", { className: "tag", children: ["/", token.split ? token.split.t : token.t] })), renderTokenSuffix?.(refToken, token, ctx)] }));
164
- return (_jsx(_Fragment, { children: wrapToken ? wrapToken(refToken, token, content, ctx) : content }));
217
+ const tokenNode = wrapToken
218
+ ? wrapToken(refToken, token, content, ctx)
219
+ : content;
220
+ if (!sectionLabel)
221
+ return _jsx(_Fragment, { children: tokenNode });
222
+ return (_jsxs("span", { className: "section-anchor", children: [_jsx("span", { className: "section", children: sectionLabel }), tokenNode] }));
165
223
  }