corpushub-design-system 0.1.0 → 0.1.1

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 (142) 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/services/ProfileService.js +3 -3
  37. package/dist/configs/tour/index.d.ts +1 -1
  38. package/dist/configs/types/CorpusImage.d.ts +3 -0
  39. package/dist/features/AccessControl/AccessControlService.d.ts +9 -0
  40. package/dist/features/AccessControl/AccessControlService.js +22 -8
  41. package/dist/features/AccessControl/AccessGrant/AccessGrant.js +3 -1
  42. package/dist/features/AccessControl/AccessUser/AccessData.d.ts +2 -2
  43. package/dist/features/AccessControl/AccessUser/AccessData.js +21 -21
  44. package/dist/features/AccessControl/AccessUser/AccessUser.js +20 -3
  45. package/dist/features/AccessControl/AccessUser/AccessUserGroups.d.ts +8 -0
  46. package/dist/features/AccessControl/AccessUser/AccessUserGroups.js +77 -0
  47. package/dist/features/AccessControl/AccessUser/style.scss +41 -3
  48. package/dist/features/AccessControl/AccessUsers/AccessUsers.js +44 -29
  49. package/dist/features/AccessControl/AccessUsers/styles.scss +5 -0
  50. package/dist/features/AccessControl/index.d.ts +1 -0
  51. package/dist/features/AccessControl/types/CorpusGroup.d.ts +10 -0
  52. package/dist/features/AccessControl/types/CorpusGroup.js +1 -0
  53. package/dist/features/AccessControl/types/UserAccessResponse.d.ts +4 -0
  54. package/dist/features/Backup/BackupCreate/BackupCreate.d.ts +11 -0
  55. package/dist/features/Backup/BackupCreate/BackupCreate.js +89 -0
  56. package/dist/features/Backup/BackupCreate/index.d.ts +2 -0
  57. package/dist/features/Backup/BackupCreate/index.js +2 -0
  58. package/dist/features/Backup/BackupCreate/style.scss +5 -0
  59. package/dist/features/Backup/BackupInfo/BackupInfo.d.ts +8 -0
  60. package/dist/features/Backup/BackupInfo/BackupInfo.js +36 -0
  61. package/dist/features/Backup/BackupInfo/index.d.ts +2 -0
  62. package/dist/features/Backup/BackupInfo/index.js +2 -0
  63. package/dist/features/Backup/BackupInfo/style.scss +23 -0
  64. package/dist/features/Backup/BackupRestore/BackupRestore.d.ts +7 -0
  65. package/dist/features/Backup/BackupRestore/BackupRestore.js +52 -0
  66. package/dist/features/Backup/BackupRestore/index.d.ts +3 -0
  67. package/dist/features/Backup/BackupRestore/index.js +2 -0
  68. package/dist/features/Backup/BackupRestore/style.scss +17 -0
  69. package/dist/features/Backup/BackupService.d.ts +20 -0
  70. package/dist/features/Backup/BackupService.js +43 -0
  71. package/dist/features/Backup/BackupTable/BackupSearchFilter.d.ts +5 -0
  72. package/dist/features/Backup/BackupTable/BackupSearchFilter.js +4 -0
  73. package/dist/features/Backup/BackupTable/BackupTable.d.ts +8 -0
  74. package/dist/features/Backup/BackupTable/BackupTable.js +121 -0
  75. package/dist/features/Backup/BackupTable/index.d.ts +4 -0
  76. package/dist/features/Backup/BackupTable/index.js +3 -0
  77. package/dist/features/Backup/BackupTable/style.scss +19 -0
  78. package/dist/features/Backup/index.d.ts +7 -0
  79. package/dist/features/Backup/index.js +4 -0
  80. package/dist/features/Backup/types/Backup.d.ts +14 -0
  81. package/dist/features/Backup/types/Backup.js +1 -0
  82. package/dist/features/Comments/CommentService.js +2 -1
  83. package/dist/features/PageRender/PageRenderView.d.ts +1 -1
  84. package/dist/features/PageRender/PageRenderView.js +67 -9
  85. package/dist/features/PageRender/style.scss +27 -5
  86. package/dist/features/PageRender/types.d.ts +5 -1
  87. package/dist/features/ParserRuleGroups/ParserRuleGroupItem.d.ts +9 -0
  88. package/dist/features/ParserRuleGroups/ParserRuleGroupItem.js +18 -0
  89. package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.d.ts +17 -0
  90. package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.js +129 -0
  91. package/dist/features/ParserRuleGroups/index.d.ts +2 -0
  92. package/dist/features/ParserRuleGroups/index.js +2 -0
  93. package/dist/features/ParserRuleGroups/style.scss +81 -0
  94. package/dist/features/ServerErrorReport/ServerErrorReport.js +9 -48
  95. package/dist/features/ServerErrorReport/ServerErrorReportForm.d.ts +22 -0
  96. package/dist/features/ServerErrorReport/ServerErrorReportForm.js +85 -0
  97. package/dist/features/ServerErrorReport/captureTabScreenshot.d.ts +1 -1
  98. package/dist/features/ServerErrorReport/captureTabScreenshot.js +5 -20
  99. package/dist/features/ServerErrorReport/index.d.ts +2 -0
  100. package/dist/features/ServerErrorReport/index.js +1 -0
  101. package/dist/features/ServerErrorReport/styles.scss +22 -9
  102. package/dist/features/index.d.ts +5 -1
  103. package/dist/features/index.js +2 -0
  104. package/dist/primitives/AsyncSelectField/AsyncSelectField.js +2 -2
  105. package/dist/primitives/AsyncSelectField/styles.scss +31 -31
  106. package/dist/primitives/Button/Button.d.ts +5 -4
  107. package/dist/primitives/Button/Button.js +19 -19
  108. package/dist/primitives/DropdownButton/DropdownButton.d.ts +2 -1
  109. package/dist/primitives/DropdownButton/DropdownButton.js +2 -2
  110. package/dist/primitives/DropdownMenu/DropdownMenu.js +7 -1
  111. package/dist/primitives/Icon/Icon.d.ts +2 -1
  112. package/dist/primitives/Icon/Icon.js +2 -2
  113. package/dist/primitives/IconButton/IconButton.d.ts +2 -1
  114. package/dist/primitives/IconButton/IconButton.js +2 -2
  115. package/dist/primitives/Tag/Tag.d.ts +2 -1
  116. package/dist/primitives/Tag/Tag.js +3 -3
  117. package/dist/primitives/index.js +1 -1
  118. package/dist/shell/Header/HelpButton/HelpModal.js +3 -69
  119. package/dist/shell/Header/HelpButton/HelpModalMainColumn.d.ts +5 -0
  120. package/dist/shell/Header/HelpButton/HelpModalMainColumn.js +76 -0
  121. package/dist/shell/Header/HelpButton/HelpModalSideColumn.d.ts +7 -0
  122. package/dist/shell/Header/HelpButton/HelpModalSideColumn.js +18 -0
  123. package/dist/shell/Header/HelpButton/live-tour.png +0 -0
  124. package/dist/shell/Header/HelpButton/style.scss +330 -47
  125. package/dist/styles/base/_typographs.scss +376 -1
  126. package/dist/styles/main.scss +112 -1
  127. package/package.json +1 -1
  128. package/dist/primitives/styles/base/_typographs.scss +0 -376
  129. package/dist/primitives/styles/font-googleapis.scss +0 -222
  130. package/dist/primitives/styles/main.scss +0 -112
  131. /package/dist/{primitives/fonts → fonts}/material-symbols-outlined.woff2 +0 -0
  132. /package/dist/{primitives/fonts → fonts}/work-sans-latin-ext.woff2 +0 -0
  133. /package/dist/{primitives/fonts → fonts}/work-sans-latin.woff2 +0 -0
  134. /package/dist/{primitives/fonts → fonts}/work-sans-vietnamese.woff2 +0 -0
  135. /package/dist/{primitives/fonts.d.ts → fonts.d.ts} +0 -0
  136. /package/dist/{primitives/fonts.js → fonts.js} +0 -0
  137. /package/dist/{primitives/styles → styles}/base/_borders.scss +0 -0
  138. /package/dist/{primitives/styles → styles}/base/_colors.scss +0 -0
  139. /package/dist/{primitives/styles → styles}/base/_displays.scss +0 -0
  140. /package/dist/{primitives/styles → styles}/base/_margins.css +0 -0
  141. /package/dist/{primitives/styles → styles}/base/_spacing.scss +0 -0
  142. /package/dist/{primitives/styles → styles}/base/_tokens.scss +0 -0
@@ -1,50 +1,50 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { yupResolver } from "@hookform/resolvers/yup";
3
- import { useForm } from "react-hook-form";
4
- import { useTranslation } from "react-i18next";
5
- import { Button, SelectField } from "../../../primitives";
6
- import * as yup from "yup";
7
- import { AccessRoleName, AccessStatusName, } from "../../../configs/types/Access";
8
- import { useMessageUtils } from "../../../configs/useMessageUtils";
9
- import FormUtils from "../../../functions/FormUtils";
10
- import AccessControlService from "../AccessControlService";
2
+ import { yupResolver } from '@hookform/resolvers/yup';
3
+ import { useForm } from 'react-hook-form';
4
+ import { useTranslation } from 'react-i18next';
5
+ import * as yup from 'yup';
6
+ import { AccessRoleName, AccessStatusName, } from '../../../configs/types/Access';
7
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
8
+ import FormUtils from '../../../functions/FormUtils';
9
+ import { Button, SelectField } from '../../../primitives';
10
+ import AccessControlService from '../AccessControlService';
11
11
  /** Flat keys (no suffix under another key) — i18next `.` keySeparator nests otherwise. */
12
12
  const TITLE_KEY = {
13
- corpus: "access.title.corpus",
14
- parser: "access.title.parser",
15
- lexicon: "access.title.lexicon",
13
+ corpus: 'access.title.corpus',
14
+ parser: 'access.title.parser',
15
+ lexicon: 'access.title.lexicon',
16
16
  };
17
17
  const DESC_KEY = {
18
- corpus: "access.desc.corpus",
19
- parser: "access.desc.parser",
20
- lexicon: "access.desc.lexicon",
18
+ corpus: 'access.desc.corpus',
19
+ parser: 'access.desc.parser',
20
+ lexicon: 'access.desc.lexicon',
21
21
  };
22
22
  export default function AccessData({ mode, resourceUid, user, onChange, }) {
23
- const { t } = useTranslation("access");
23
+ const { t } = useTranslation('access');
24
24
  const { dispatchMessage } = useMessageUtils();
25
25
  const createdForm = useForm({
26
26
  resolver: yupResolver(getFormSchema(t)),
27
27
  defaultValues: { role: user.role, status: user.status },
28
- mode: "onChange",
28
+ mode: 'onChange',
29
29
  });
30
30
  const handleSave = () => {
31
31
  if (!resourceUid)
32
32
  return;
33
33
  const request = createdForm.getValues();
34
34
  AccessControlService.update(mode, resourceUid, user.uid, request).then(() => {
35
- dispatchMessage({ key: "update.success", t });
35
+ dispatchMessage({ key: 'update.success', t });
36
36
  onChange(request);
37
37
  });
38
38
  };
39
- return (_jsxs("div", { className: "access-container", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "title", children: t(TITLE_KEY[mode]) }), _jsx("span", { className: "desc", children: t(DESC_KEY[mode]) })] }), _jsxs("div", { className: "body", children: [_jsx(SelectField, { label: t("table.label.role"), attr: "role", createdForm: createdForm, options: FormUtils.convertEnum(AccessRoleName, t, "common"), showEndAdornment: false, allowEmpty: false }), _jsx(SelectField, { label: t("table.label.status"), attr: "status", createdForm: createdForm, options: FormUtils.convertEnum(AccessStatusName, t, "common"), showEndAdornment: false, allowEmpty: false }), _jsx(Button, { text: t("common:button.save"), disabled: !createdForm.formState.isValid, onClick: handleSave, size: "small" })] })] }));
39
+ return (_jsxs("div", { className: "access-container", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "title", children: t(TITLE_KEY[mode]) }), _jsx("span", { className: "desc", children: t(DESC_KEY[mode]) })] }), _jsxs("div", { className: "body", children: [_jsx(SelectField, { label: t('table.label.role'), attr: "role", createdForm: createdForm, options: FormUtils.convertEnum(AccessRoleName, t, 'common'), showEndAdornment: false, allowEmpty: false }), _jsx(SelectField, { label: t('table.label.status'), attr: "status", createdForm: createdForm, options: FormUtils.convertEnum(AccessStatusName, t, 'common'), showEndAdornment: false, allowEmpty: false }), _jsx(Button, { text: t('common:button.save'), disabled: !createdForm.formState.isValid, onClick: handleSave, size: "x-small" })] })] }));
40
40
  }
41
41
  const getFormSchema = (t) => yup.object().shape({
42
42
  status: yup
43
43
  .string()
44
44
  .oneOf(Object.keys(AccessStatusName))
45
- .required(t("message:validation.required")),
45
+ .required(t('message:validation.required')),
46
46
  role: yup
47
47
  .string()
48
48
  .oneOf(Object.keys(AccessRoleName))
49
- .required(t("message:validation.required")),
49
+ .required(t('message:validation.required')),
50
50
  });
@@ -1,15 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
- import { AppModal } from "../../../common";
3
+ import { AppModal, AppPicture } from "../../../common";
4
4
  import { useCorpusUtils } from "../../../configs/useCorpusUtils";
5
5
  import AccessData from "./AccessData";
6
6
  import AccessPortal from "./AccessPortal";
7
+ import AccessUserGroups from "./AccessUserGroups";
7
8
  import AccessUserResources from "./AccessUserResources";
8
9
  import "./style.scss";
9
10
  export default function AccessUser({ mode, resourceUid, user, onClose, onReload, setItems, }) {
10
11
  const { t } = useTranslation("access");
11
12
  const { getCorpus, hasCorpus } = useCorpusUtils();
12
- const showPortal = mode === "corpus" && hasCorpus() && getCorpus().opened;
13
+ const hasDirectAccess = user.direct !== false;
14
+ const showPortal = mode === "corpus" &&
15
+ hasDirectAccess &&
16
+ hasCorpus() &&
17
+ getCorpus().opened;
13
18
  const handleChangeAccess = (r) => {
14
19
  setItems((prevState) => {
15
20
  if (!prevState)
@@ -39,5 +44,17 @@ export default function AccessUser({ mode, resourceUid, user, onClose, onReload,
39
44
  return { ...prevState, content: updatedContent };
40
45
  });
41
46
  };
42
- return (_jsxs(AppModal, { title: user.name, className: "modal-access-user", close: onClose, disableCancel: true, hideFooter: true, children: [_jsxs("div", { className: "row-info", children: [_jsxs("div", { className: "col-profile", children: [_jsxs("div", { className: "info", children: [_jsx("img", { className: "avatar", src: user.picture, referrerPolicy: "no-referrer" }), _jsxs("div", { className: "texts", children: [_jsxs("span", { children: [_jsx("b", { children: t("access.label.name") }), " ", user.name] }), _jsxs("span", { children: [_jsx("b", { children: t("access.label.email") }), " ", user.email] })] })] }), _jsx(AccessData, { mode: mode, resourceUid: resourceUid, user: user, onChange: handleChangeAccess })] }), showPortal && (_jsx(AccessPortal, { resourceUid: resourceUid, user: user, onChange: handleChangePortal })), _jsx(AccessUserResources, { mode: mode, user: user, onReload: onReload })] }), _jsx("div", { className: "uid", children: user.uid })] }));
47
+ const handleChangeGroups = (groups) => {
48
+ if (!hasDirectAccess && groups.length === 0) {
49
+ onReload();
50
+ return;
51
+ }
52
+ setItems((prevState) => {
53
+ if (!prevState)
54
+ return prevState;
55
+ const updatedContent = prevState.content.map((item) => item.uid === user.uid ? { ...item, groups } : item);
56
+ return { ...prevState, content: updatedContent };
57
+ });
58
+ };
59
+ return (_jsxs(AppModal, { title: user.name, className: "modal-access-user", close: onClose, disableCancel: true, hideFooter: true, children: [_jsxs("div", { className: "row-info", children: [_jsxs("div", { className: "col-profile", children: [_jsxs("div", { className: "info", children: [_jsx(AppPicture, { className: "avatar", src: user.picture, person: true }), _jsxs("div", { className: "texts", children: [_jsxs("span", { children: [_jsx("b", { children: t("access.label.name") }), " ", user.name] }), _jsxs("span", { children: [_jsx("b", { children: t("access.label.email") }), " ", user.email] })] })] }), hasDirectAccess && (_jsx(AccessData, { mode: mode, resourceUid: resourceUid, user: user, onChange: handleChangeAccess })), mode === "corpus" && (_jsx(AccessUserGroups, { resourceUid: resourceUid, user: user, onChange: handleChangeGroups }))] }), showPortal && (_jsx(AccessPortal, { resourceUid: resourceUid, user: user, onChange: handleChangePortal })), hasDirectAccess && (_jsx(AccessUserResources, { mode: mode, user: user, onReload: onReload }))] }), _jsx("div", { className: "uid", children: user.uid })] }));
43
60
  }
@@ -0,0 +1,8 @@
1
+ import { UserAccessResponse } from '../types/UserAccessResponse';
2
+ type Props = {
3
+ resourceUid: string;
4
+ user: UserAccessResponse;
5
+ onChange: (groups: string[]) => void;
6
+ };
7
+ export default function AccessUserGroups({ resourceUid, user, onChange, }: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
+ import { useForm } from 'react-hook-form';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
6
+ import { Button, SelectField, Tag } from '../../../primitives';
7
+ import AccessControlService from '../AccessControlService';
8
+ const ROLE_TAG_COLOR = {
9
+ EDITOR: 'blue',
10
+ READER: 'yellow',
11
+ };
12
+ function sortedNames(groups) {
13
+ return groups
14
+ .map((g) => g.name)
15
+ .filter(Boolean)
16
+ .sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' }));
17
+ }
18
+ export default function AccessUserGroups({ resourceUid, user, onChange, }) {
19
+ const { t } = useTranslation('access');
20
+ const { dispatchMessage } = useMessageUtils();
21
+ const [groups, setGroups] = useState([]);
22
+ const [loading, setLoading] = useState(true);
23
+ const [memberNames, setMemberNames] = useState(() => user.groups ?? []);
24
+ const createdForm = useForm({
25
+ defaultValues: { groupUid: '' },
26
+ });
27
+ const memberNameSet = useMemo(() => new Set(memberNames.filter(Boolean)), [memberNames]);
28
+ const memberships = useMemo(() => groups
29
+ .filter((g) => g.status === 'ACTIVE' && memberNameSet.has(g.name))
30
+ .sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' })), [groups, memberNameSet]);
31
+ const available = useMemo(() => groups
32
+ .filter((g) => g.status === 'ACTIVE' && !memberNameSet.has(g.name))
33
+ .sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' })), [groups, memberNameSet]);
34
+ const options = useMemo(() => available.map((g) => ({ value: g.uid, label: g.name })), [available]);
35
+ const load = () => {
36
+ if (!resourceUid)
37
+ return;
38
+ setLoading(true);
39
+ AccessControlService.listGroups(resourceUid)
40
+ .then((r) => setGroups(r.data ?? []))
41
+ .catch(() => setGroups([]))
42
+ .finally(() => setLoading(false));
43
+ };
44
+ useEffect(() => {
45
+ setMemberNames(user.groups ?? []);
46
+ }, [user.uid, user.groups]);
47
+ useEffect(() => {
48
+ load();
49
+ }, [resourceUid]);
50
+ const applyMembership = (nextGroups) => {
51
+ const next = sortedNames(nextGroups);
52
+ setMemberNames(next);
53
+ onChange(next);
54
+ };
55
+ const handleAdd = () => {
56
+ const groupUid = createdForm.getValues('groupUid');
57
+ if (!resourceUid || !groupUid)
58
+ return;
59
+ const added = groups.find((g) => g.uid === groupUid);
60
+ if (!added)
61
+ return;
62
+ AccessControlService.addGroupMember(resourceUid, groupUid, user.uid).then(() => {
63
+ dispatchMessage({ key: 'update.success', t });
64
+ createdForm.reset({ groupUid: '' });
65
+ applyMembership([...memberships, added]);
66
+ });
67
+ };
68
+ const handleRemove = (group) => {
69
+ if (!resourceUid)
70
+ return;
71
+ AccessControlService.removeGroupMember(resourceUid, group.uid, user.uid).then(() => {
72
+ dispatchMessage({ key: 'update.success', t });
73
+ applyMembership(memberships.filter((g) => g.uid !== group.uid));
74
+ });
75
+ };
76
+ return (_jsxs("div", { className: "access-container access-groups-container", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "title", children: t('group.title') }), _jsx("span", { className: "desc", children: t('group.desc') })] }), _jsxs("div", { className: "body", children: [!loading && groups.length === 0 && (_jsx("span", { className: "empty", children: t('group.empty') })), memberships.map((group) => (_jsxs("div", { className: "group-line", children: [_jsx("span", { className: "name", children: group.name }), _jsx(Tag, { text: t(`role.label.${group.role.toLowerCase()}`), color: ROLE_TAG_COLOR[group.role], size: "small" }), _jsx(Button, { text: t('common:button.remove'), onClick: () => handleRemove(group), size: "x-small", color: "danger" })] }, group.uid))), available.length > 0 && (_jsxs("div", { className: "add-row", children: [_jsx(SelectField, { label: t('table.label.groups'), attr: "groupUid", createdForm: createdForm, options: options, showEndAdornment: false, allowEmpty: true }), _jsx(Button, { text: t('common:button.add'), disabled: !createdForm.watch('groupUid'), onClick: handleAdd, size: "small" })] }))] })] }));
77
+ }
@@ -3,10 +3,10 @@
3
3
  max-width: 70vw !important;
4
4
  top: 45% !important;
5
5
 
6
- .body {
6
+ > .body {
7
7
  display: flex;
8
8
  flex-direction: column;
9
- gap: 16px;
9
+ gap: 8px;
10
10
 
11
11
  .uid {
12
12
  margin-top: auto;
@@ -72,15 +72,53 @@
72
72
  }
73
73
 
74
74
  > .body {
75
+ padding-bottom: 8px;
75
76
  display: flex;
76
77
  flex-direction: column;
77
- gap: 16px;
78
+ gap: 8px;
78
79
 
79
80
  > .ds-button {
80
81
  margin-left: auto;
81
82
  }
82
83
  }
83
84
  }
85
+
86
+ .access-groups-container {
87
+ > .body {
88
+ > .empty {
89
+ @include body-medium-1;
90
+ color: var(--text-secondary);
91
+ }
92
+
93
+ > .group-line {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 12px;
97
+ border-bottom: var(--border-default);
98
+ padding-bottom: 8px;
99
+
100
+ > .name {
101
+ @include body-xmedium-1;
102
+ flex: 1;
103
+ min-width: 0;
104
+ }
105
+
106
+ > .ds-button {
107
+ margin-left: auto;
108
+ }
109
+ }
110
+
111
+ > .add-row {
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: 12px;
115
+
116
+ > .ds-button {
117
+ margin-left: auto;
118
+ }
119
+ }
120
+ }
121
+ }
84
122
  }
85
123
 
86
124
  .portal-container {
@@ -67,35 +67,50 @@ export default function AccessUsers({ mode, resourceUid }) {
67
67
  const user = props.row.original;
68
68
  return user.name || user.email;
69
69
  };
70
- const columns = React.useMemo(() => [
71
- {
72
- id: "original",
73
- header: "",
74
- cell: addImageToCell,
75
- size: 10,
76
- },
77
- {
78
- id: "name",
79
- header: t("table.label.name"),
80
- accessorFn: (row) => row.name || row.email,
81
- cell: addNameToCell,
82
- size: 35,
83
- },
84
- {
85
- id: "status",
86
- header: t("table.label.status"),
87
- accessorKey: "status",
88
- cell: addStatusToCell,
89
- size: 15,
90
- },
91
- {
92
- id: "role",
93
- header: t("table.label.role"),
94
- accessorKey: "role",
95
- cell: addRoleToCell,
96
- size: 35,
97
- },
98
- ], [resourceUid, data, t]);
70
+ const addGroupsToCell = (props) => {
71
+ const groups = props.row.original.groups;
72
+ return groups?.length ? groups.join(", ") : "—";
73
+ };
74
+ const columns = React.useMemo(() => {
75
+ const cols = [
76
+ {
77
+ id: "original",
78
+ header: "",
79
+ cell: addImageToCell,
80
+ size: 10,
81
+ },
82
+ {
83
+ id: "name",
84
+ header: t("table.label.name"),
85
+ accessorFn: (row) => row.name || row.email,
86
+ cell: addNameToCell,
87
+ size: mode === "corpus" ? 28 : 35,
88
+ },
89
+ {
90
+ id: "status",
91
+ header: t("table.label.status"),
92
+ accessorKey: "status",
93
+ cell: addStatusToCell,
94
+ size: 15,
95
+ },
96
+ {
97
+ id: "role",
98
+ header: t("table.label.role"),
99
+ accessorKey: "role",
100
+ cell: addRoleToCell,
101
+ size: mode === "corpus" ? 20 : 35,
102
+ },
103
+ ];
104
+ if (mode === "corpus") {
105
+ cols.push({
106
+ id: "groups",
107
+ header: t("table.label.groups"),
108
+ cell: addGroupsToCell,
109
+ size: 27,
110
+ });
111
+ }
112
+ return cols;
113
+ }, [resourceUid, data, t, mode]);
99
114
  useEffect(() => {
100
115
  paginate();
101
116
  }, [filter, resourceUid, mode]);
@@ -4,6 +4,11 @@
4
4
 
5
5
  .users-table {
6
6
  border: none;
7
+
8
+ .avatar {
9
+ width: 48px;
10
+ height: 48px;
11
+ }
7
12
  }
8
13
  }
9
14
  }
@@ -5,6 +5,7 @@ export { default as AccessUser } from './AccessUser';
5
5
  export { default as AccessGrant } from './AccessGrant';
6
6
  export { default as AccessControlService } from './AccessControlService';
7
7
  export type { AccessResponse, UserAccessRequest, UserAccessResponse, } from './types/UserAccessResponse';
8
+ export type { CorpusGroup, CorpusGroupRole, CorpusGroupStatus, } from './types/CorpusGroup';
8
9
  export type { default as PortalInformation } from './types/PortalInformation';
9
10
  export type { PortalInformationRequest, PortalRole, } from './types/PortalInformation';
10
11
  export { EMPTY_PORTAL, PortalRoleName } from './types/PortalInformation';
@@ -0,0 +1,10 @@
1
+ export type CorpusGroupRole = 'EDITOR' | 'READER';
2
+ export type CorpusGroupStatus = 'ACTIVE' | 'INACTIVE';
3
+ export type CorpusGroup = {
4
+ uid: string;
5
+ corpus: string;
6
+ name: string;
7
+ role: CorpusGroupRole;
8
+ status: CorpusGroupStatus;
9
+ members: number;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -17,6 +17,10 @@ export type UserAccessResponse = {
17
17
  role: AccessRole;
18
18
  plan?: string | null;
19
19
  lastLogin?: number | null;
20
+ /** Active corpus group names (corpus access page only). */
21
+ groups?: string[] | null;
22
+ /** False when the user only has access via groups (no direct grant). */
23
+ direct?: boolean;
20
24
  corpora: AccessResponse[];
21
25
  parsers: AccessResponse[];
22
26
  lexicons: AccessResponse[];
@@ -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,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import AppLoading from '../../../common/AppLoading';
5
+ import AppModal from '../../../common/AppModal';
6
+ import { useMessageUtils } from '../../../configs/useMessageUtils';
7
+ import BackupService from '../BackupService';
8
+ import './style.scss';
9
+ const POLL_INTERVAL_MS = 2000;
10
+ export default function BackupCreate({ mode, resourceUid, onClose, onConfirm, }) {
11
+ const { t } = useTranslation('backup');
12
+ const { dispatchError, dispatchMessageDirect } = useMessageUtils();
13
+ const [loading, setLoading] = useState(false);
14
+ const mountedRef = useRef(true);
15
+ const pollRef = useRef(null);
16
+ useEffect(() => {
17
+ mountedRef.current = true;
18
+ return () => {
19
+ mountedRef.current = false;
20
+ if (pollRef.current != null) {
21
+ window.clearInterval(pollRef.current);
22
+ pollRef.current = null;
23
+ }
24
+ };
25
+ }, []);
26
+ const stopPolling = () => {
27
+ if (pollRef.current != null) {
28
+ window.clearInterval(pollRef.current);
29
+ pollRef.current = null;
30
+ }
31
+ };
32
+ const pollUntilDone = (backupId) => {
33
+ const tick = () => {
34
+ BackupService.status(backupId)
35
+ .then((r) => {
36
+ if (!mountedRef.current)
37
+ return;
38
+ const backup = r.data;
39
+ if (backup.status === 'PROCESSING')
40
+ return;
41
+ stopPolling();
42
+ setLoading(false);
43
+ if (backup.status === 'FINISHED') {
44
+ onConfirm(backup);
45
+ return;
46
+ }
47
+ dispatchMessageDirect(backup.log || t('backup.status.error'), 'error');
48
+ })
49
+ .catch((err) => {
50
+ if (!mountedRef.current)
51
+ return;
52
+ stopPolling();
53
+ setLoading(false);
54
+ dispatchError({ err, t });
55
+ });
56
+ };
57
+ tick();
58
+ pollRef.current = window.setInterval(tick, POLL_INTERVAL_MS);
59
+ };
60
+ const handleConfirm = () => {
61
+ if (loading || !resourceUid)
62
+ return;
63
+ setLoading(true);
64
+ BackupService.execute(mode, resourceUid)
65
+ .then((r) => {
66
+ if (!mountedRef.current)
67
+ return;
68
+ const backup = r.data;
69
+ if (backup.status === 'FINISHED') {
70
+ setLoading(false);
71
+ onConfirm(backup);
72
+ return;
73
+ }
74
+ if (backup.status === 'ERROR') {
75
+ setLoading(false);
76
+ dispatchMessageDirect(backup.log || t('backup.status.error'), 'error');
77
+ return;
78
+ }
79
+ pollUntilDone(backup.id);
80
+ })
81
+ .catch((err) => {
82
+ if (!mountedRef.current)
83
+ return;
84
+ setLoading(false);
85
+ dispatchError({ err, t });
86
+ });
87
+ };
88
+ 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, {})] }));
89
+ }
@@ -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;
@@ -0,0 +1,5 @@
1
+ .backup-create-modal {
2
+ .loading-container {
3
+ margin: 0% 50%;
4
+ }
5
+ }
@@ -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;