tycho-components 0.44.2 → 0.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/api/index.d.ts +1 -0
- package/dist/configs/api/index.js +4 -1
- package/dist/configs/brand.d.ts +8 -0
- package/dist/configs/brand.js +10 -1
- package/dist/configs/index.d.ts +41 -41
- package/dist/configs/index.js +23 -23
- package/dist/configs/localization/CommonTexts.d.ts +12 -0
- package/dist/configs/localization/CommonTexts.js +12 -0
- package/dist/configs/types/Access.d.ts +23 -0
- package/dist/configs/types/Access.js +14 -0
- package/dist/features/AccessControl/AccessControlService.d.ts +53 -0
- package/dist/features/AccessControl/AccessControlService.js +85 -0
- package/dist/features/AccessControl/AccessGrant/AccessGrant.d.ts +10 -0
- package/dist/features/AccessControl/AccessGrant/AccessGrant.js +75 -0
- package/dist/features/AccessControl/AccessGrant/index.d.ts +2 -0
- package/dist/features/AccessControl/AccessGrant/index.js +2 -0
- package/dist/features/AccessControl/AccessGrant/style.scss +27 -0
- package/dist/features/AccessControl/AccessUser/AccessData.d.ts +10 -0
- package/dist/features/AccessControl/AccessUser/AccessData.js +50 -0
- package/dist/features/AccessControl/AccessUser/AccessPortal.d.ts +9 -0
- package/dist/features/AccessControl/AccessUser/AccessPortal.js +40 -0
- package/dist/features/AccessControl/AccessUser/AccessUser.d.ts +14 -0
- package/dist/features/AccessControl/AccessUser/AccessUser.js +44 -0
- package/dist/features/AccessControl/AccessUser/AccessUserResources.d.ts +9 -0
- package/dist/features/AccessControl/AccessUser/AccessUserResources.js +57 -0
- package/dist/features/AccessControl/AccessUser/index.d.ts +2 -0
- package/dist/features/AccessControl/AccessUser/index.js +2 -0
- package/dist/features/AccessControl/AccessUser/style.scss +193 -0
- package/dist/features/AccessControl/AccessUsers/AccessUsers.d.ts +8 -0
- package/dist/features/AccessControl/AccessUsers/AccessUsers.js +112 -0
- package/dist/features/AccessControl/AccessUsers/AccessUsersFilter.d.ts +9 -0
- package/dist/features/AccessControl/AccessUsers/AccessUsersFilter.js +5 -0
- package/dist/features/AccessControl/AccessUsers/index.d.ts +4 -0
- package/dist/features/AccessControl/AccessUsers/index.js +3 -0
- package/dist/features/AccessControl/AccessUsers/styles.scss +9 -0
- package/dist/features/AccessControl/index.d.ts +10 -0
- package/dist/features/AccessControl/index.js +6 -0
- package/dist/features/AccessControl/types/PortalInformation.d.ts +20 -0
- package/dist/features/AccessControl/types/PortalInformation.js +11 -0
- package/dist/features/AccessControl/types/UserAccessResponse.d.ts +27 -0
- package/dist/features/AccessControl/types/UserAccessResponse.js +1 -0
- package/dist/features/index.d.ts +2 -0
- package/dist/features/index.js +1 -0
- package/dist/shell/Base/ErrorFound.js +2 -2
- package/dist/shell/Base/NotFound.js +2 -2
- package/dist/shell/Base/Unauthorized.js +2 -2
- package/dist/shell/Header/HeaderApps/HeaderApps.js +2 -2
- package/package.json +4 -4
- package/dist/shell/Base/logo.png +0 -0
- package/dist/shell/Header/HeaderApps/logo.png +0 -0
|
@@ -6,6 +6,7 @@ export declare const platformApi: {
|
|
|
6
6
|
editor: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const parserApiBase: string;
|
|
9
|
+
export declare const lexiconApiBase: string;
|
|
9
10
|
declare const api: import("axios").AxiosInstance;
|
|
10
11
|
export { createApiClient } from './createApiClient';
|
|
11
12
|
export type { CreateApiClientOptions, ServerErrorHandling } from './createApiClient';
|
|
@@ -8,7 +8,10 @@ export const platformApi = {
|
|
|
8
8
|
catalog: `${platformApiBase}/catalog`,
|
|
9
9
|
editor: `${platformApiBase}/editor`,
|
|
10
10
|
};
|
|
11
|
-
export const parserApiBase = import.meta.env.VITE_APP_PARSER_API
|
|
11
|
+
export const parserApiBase = import.meta.env.VITE_APP_PARSER_API ||
|
|
12
|
+
import.meta.env.VITE_APP_URL_API;
|
|
13
|
+
export const lexiconApiBase = import.meta.env.VITE_APP_LEXICON_API ||
|
|
14
|
+
import.meta.env.VITE_APP_URL_API;
|
|
12
15
|
const api = applyAuthErrorHandling(createApiClient({ baseURL: platformApiBase }), { authErrorHandling: 'redirect' });
|
|
13
16
|
export { createApiClient } from './createApiClient';
|
|
14
17
|
export { applyAuthErrorHandling } from './applyAuthErrorHandling';
|
package/dist/configs/brand.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export type BrandConfig = {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export declare function brandAssetBase(brandId: BrandId, originRaw: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* Absolute platform logo URL: `{origin}/brands/{id}/logo.png`.
|
|
23
|
+
* Use in shell pages that cannot take an AppCode (NotFound, etc.).
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveBrandLogo(options?: {
|
|
26
|
+
brandId?: string;
|
|
27
|
+
origin?: string;
|
|
28
|
+
}): string;
|
|
21
29
|
/**
|
|
22
30
|
* Resolve platform branding for a front-end app.
|
|
23
31
|
* Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
|
package/dist/configs/brand.js
CHANGED
|
@@ -49,6 +49,15 @@ function readEnvOrigin() {
|
|
|
49
49
|
return undefined;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Absolute platform logo URL: `{origin}/brands/{id}/logo.png`.
|
|
54
|
+
* Use in shell pages that cannot take an AppCode (NotFound, etc.).
|
|
55
|
+
*/
|
|
56
|
+
export function resolveBrandLogo(options) {
|
|
57
|
+
const id = resolveBrandId(options?.brandId ?? readEnvBrandId());
|
|
58
|
+
const origin = options?.origin ?? readEnvOrigin();
|
|
59
|
+
return `${brandAssetBase(id, origin)}/logo.png`;
|
|
60
|
+
}
|
|
52
61
|
/**
|
|
53
62
|
* Resolve platform branding for a front-end app.
|
|
54
63
|
* Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
|
|
@@ -73,7 +82,7 @@ export function createBrand(app, options) {
|
|
|
73
82
|
id,
|
|
74
83
|
...meta,
|
|
75
84
|
faviconBase,
|
|
76
|
-
logo:
|
|
85
|
+
logo: resolveBrandLogo({ brandId: id, origin }),
|
|
77
86
|
socialMedia: {
|
|
78
87
|
youtube: DEFAULT_YOUTUBE,
|
|
79
88
|
},
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
export { CommonProvider } from
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
5
|
-
export { createApiClient,
|
|
6
|
-
export type { ApplyAuthErrorHandlingOptions, AuthErrorHandling, CreateApiClientOptions, ServerErrorHandling,
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export { default as ProfileService } from
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export type {
|
|
18
|
-
export {
|
|
19
|
-
export type {
|
|
20
|
-
export
|
|
21
|
-
export type {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export
|
|
25
|
-
export type {
|
|
26
|
-
export type {
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
29
|
-
export {
|
|
30
|
-
export type {
|
|
31
|
-
export
|
|
32
|
-
export {
|
|
33
|
-
export
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export
|
|
40
|
-
export {
|
|
41
|
-
export
|
|
1
|
+
export { default as CommonContext, CommonProvider } from './CommonContext';
|
|
2
|
+
export { default as CommonDispatchBridge } from './CommonDispatchBridge';
|
|
3
|
+
export { default as CookieStorage } from './CookieStorage';
|
|
4
|
+
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
5
|
+
export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
|
|
6
|
+
export type { ApiErrorHandled, ApplyAuthErrorHandlingOptions, AuthErrorHandled, AuthErrorHandling, CreateApiClientOptions, ServerErrorHandling, } from './api';
|
|
7
|
+
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, } from './brand';
|
|
8
|
+
export type { AppCode, BrandConfig, BrandId } from './brand';
|
|
9
|
+
export { default as ProfileService } from './services/ProfileService';
|
|
10
|
+
export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
|
|
11
|
+
export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
|
|
12
|
+
export type { AnchorSelector, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './tour';
|
|
13
|
+
export { AccessRoleName, AccessStatusName, EMPTY_ACCESS } from './types/Access';
|
|
14
|
+
export type { default as Access, AccessMode, AccessRole, AccessStatus, } from './types/Access';
|
|
15
|
+
export { conlluAttributes } from './types/Conllu';
|
|
16
|
+
export type { Conllu } from './types/Conllu';
|
|
17
|
+
export type { Corpus, CorpusRequest } from './types/Corpus';
|
|
18
|
+
export { CorpusImageTypeNames } from './types/CorpusImage';
|
|
19
|
+
export type { CorpusImage, CorpusImageType } from './types/CorpusImage';
|
|
20
|
+
export { CorpusStatusNames } from './types/CorpusStatus';
|
|
21
|
+
export type { CorpusStatus } from './types/CorpusStatus';
|
|
22
|
+
export { DocumentEditableStatusNames, DocumentStatusNames, DocumentStatusTagColors, } from './types/Document';
|
|
23
|
+
export type { default as Document, DocumentStatus } from './types/Document';
|
|
24
|
+
export { DEFAULT_EDITION_TIERS, EditionTiers, StructuralEditionTiers, isStructuralEditionTier, } from './types/EditionTiers';
|
|
25
|
+
export type { EditionGroup, EditionTierDefinition, EditionTierGroup, EditionTierSymbol, } from './types/EditionTiers';
|
|
26
|
+
export type { Parameter, ParameterType } from './types/Parameter';
|
|
27
|
+
export type { default as Participant } from './types/Participant';
|
|
28
|
+
export { DEFAULT_DELIMITERS, DELIMITERS, DelimiterNames, EMPTY_CONFIGURATION, } from './types/ProcessConfiguration';
|
|
29
|
+
export type { default as ProcessConfiguration, SentenceDelimiter, } from './types/ProcessConfiguration';
|
|
30
|
+
export type { Break, Mark, default as Sentence, Format as SentenceFormat, SentenceParticipant, SentenceTier, Translation, } from './types/Sentence';
|
|
31
|
+
export { SentenceStatusNames } from './types/SentenceStatus';
|
|
32
|
+
export type { SentenceStatus } from './types/SentenceStatus';
|
|
33
|
+
export { EXTENSIONS, INFLECTIONS } from './types/Struct';
|
|
34
|
+
export type { Chunk, ConlluToken, Edition, Format, Morpheme, Split, Struct, Token, } from './types/Struct';
|
|
35
|
+
export type { CytoscapeTree, Tree } from './types/Tree';
|
|
36
|
+
export { UserStatusNames } from './types/User';
|
|
37
|
+
export type { User, UserStatus } from './types/User';
|
|
38
|
+
export { useCorpusUtils } from './useCorpusUtils';
|
|
39
|
+
export { useLoggedUtils } from './useLoggedUtils';
|
|
40
|
+
export { useMessageUtils } from './useMessageUtils';
|
|
41
|
+
export { useTourUtils } from './useTourUtils';
|
package/dist/configs/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { CommonProvider } from
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
5
|
-
export { createApiClient,
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
1
|
+
export { default as CommonContext, CommonProvider } from './CommonContext';
|
|
2
|
+
export { default as CommonDispatchBridge } from './CommonDispatchBridge';
|
|
3
|
+
export { default as CookieStorage } from './CookieStorage';
|
|
4
|
+
export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
|
|
5
|
+
export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
|
|
6
|
+
export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, } from './brand';
|
|
7
|
+
export { default as ProfileService } from './services/ProfileService';
|
|
8
|
+
export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
|
|
9
|
+
export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
|
|
10
|
+
export { AccessRoleName, AccessStatusName, EMPTY_ACCESS } from './types/Access';
|
|
11
|
+
export { conlluAttributes } from './types/Conllu';
|
|
12
|
+
export { CorpusImageTypeNames } from './types/CorpusImage';
|
|
13
|
+
export { CorpusStatusNames } from './types/CorpusStatus';
|
|
14
|
+
export { DocumentEditableStatusNames, DocumentStatusNames, DocumentStatusTagColors, } from './types/Document';
|
|
15
|
+
export { DEFAULT_EDITION_TIERS, EditionTiers, StructuralEditionTiers, isStructuralEditionTier, } from './types/EditionTiers';
|
|
16
|
+
export { DEFAULT_DELIMITERS, DELIMITERS, DelimiterNames, EMPTY_CONFIGURATION, } from './types/ProcessConfiguration';
|
|
17
|
+
export { SentenceStatusNames } from './types/SentenceStatus';
|
|
18
|
+
export { EXTENSIONS, INFLECTIONS } from './types/Struct';
|
|
19
|
+
export { UserStatusNames } from './types/User';
|
|
20
|
+
export { useCorpusUtils } from './useCorpusUtils';
|
|
21
|
+
export { useLoggedUtils } from './useLoggedUtils';
|
|
22
|
+
export { useMessageUtils } from './useMessageUtils';
|
|
23
|
+
export { useTourUtils } from './useTourUtils';
|
|
@@ -36,6 +36,10 @@ export declare const CommonTexts: {
|
|
|
36
36
|
'validation.required': string;
|
|
37
37
|
'placeholder.check': string;
|
|
38
38
|
'placeholder.input': string;
|
|
39
|
+
'user.role.administrator': string;
|
|
40
|
+
'user.role.editor': string;
|
|
41
|
+
'user.role.reader': string;
|
|
42
|
+
'user.role.visitor': string;
|
|
39
43
|
'user.status.active': string;
|
|
40
44
|
'user.status.inactive': string;
|
|
41
45
|
'user.status.super': string;
|
|
@@ -124,6 +128,10 @@ export declare const CommonTexts: {
|
|
|
124
128
|
'validation.required': string;
|
|
125
129
|
'placeholder.check': string;
|
|
126
130
|
'placeholder.input': string;
|
|
131
|
+
'user.role.administrator': string;
|
|
132
|
+
'user.role.editor': string;
|
|
133
|
+
'user.role.reader': string;
|
|
134
|
+
'user.role.visitor': string;
|
|
127
135
|
'user.status.active': string;
|
|
128
136
|
'user.status.inactive': string;
|
|
129
137
|
'user.status.super': string;
|
|
@@ -212,6 +220,10 @@ export declare const CommonTexts: {
|
|
|
212
220
|
'validation.required': string;
|
|
213
221
|
'placeholder.check': string;
|
|
214
222
|
'placeholder.input': string;
|
|
223
|
+
'user.role.administrator': string;
|
|
224
|
+
'user.role.editor': string;
|
|
225
|
+
'user.role.reader': string;
|
|
226
|
+
'user.role.visitor': string;
|
|
215
227
|
'user.status.active': string;
|
|
216
228
|
'user.status.inactive': string;
|
|
217
229
|
'user.status.super': string;
|
|
@@ -36,6 +36,10 @@ export const CommonTexts = {
|
|
|
36
36
|
'validation.required': 'Required field.',
|
|
37
37
|
'placeholder.check': 'click to choose',
|
|
38
38
|
'placeholder.input': 'click to add',
|
|
39
|
+
'user.role.administrator': 'Administrator',
|
|
40
|
+
'user.role.editor': 'Editor',
|
|
41
|
+
'user.role.reader': 'Reader',
|
|
42
|
+
'user.role.visitor': 'Visitor',
|
|
39
43
|
'user.status.active': 'Active',
|
|
40
44
|
'user.status.inactive': 'Inactive',
|
|
41
45
|
'user.status.super': 'Super',
|
|
@@ -124,6 +128,10 @@ export const CommonTexts = {
|
|
|
124
128
|
'validation.required': 'Campo obrigatório.',
|
|
125
129
|
'placeholder.check': 'clique para selecionar',
|
|
126
130
|
'placeholder.input': 'clique para adicionar',
|
|
131
|
+
'user.role.administrator': 'Administrador',
|
|
132
|
+
'user.role.editor': 'Editor',
|
|
133
|
+
'user.role.reader': 'Leitor',
|
|
134
|
+
'user.role.visitor': 'Visitante',
|
|
127
135
|
'user.status.active': 'Ativo',
|
|
128
136
|
'user.status.inactive': 'Inativo',
|
|
129
137
|
'user.status.super': 'Super',
|
|
@@ -212,6 +220,10 @@ export const CommonTexts = {
|
|
|
212
220
|
'validation.required': 'Campo obbligatorio.',
|
|
213
221
|
'placeholder.check': 'clicca per scegliere',
|
|
214
222
|
'placeholder.input': 'clicca per aggiungere',
|
|
223
|
+
'user.role.administrator': 'Amministratore',
|
|
224
|
+
'user.role.editor': 'Editore',
|
|
225
|
+
'user.role.reader': 'Lettore',
|
|
226
|
+
'user.role.visitor': 'Visitatore',
|
|
215
227
|
'user.status.active': 'Attivo',
|
|
216
228
|
'user.status.inactive': 'Inattivo',
|
|
217
229
|
'user.status.super': 'Super',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type Access = {
|
|
2
|
+
user: string;
|
|
3
|
+
status: AccessStatus;
|
|
4
|
+
role: AccessRole;
|
|
5
|
+
};
|
|
6
|
+
export declare const EMPTY_ACCESS: {
|
|
7
|
+
user: string;
|
|
8
|
+
role: AccessRole;
|
|
9
|
+
status: AccessStatus;
|
|
10
|
+
};
|
|
11
|
+
export type AccessRole = 'ADMIN' | 'EDITOR' | 'READER';
|
|
12
|
+
export declare const AccessRoleName: {
|
|
13
|
+
ADMIN: string;
|
|
14
|
+
EDITOR: string;
|
|
15
|
+
READER: string;
|
|
16
|
+
};
|
|
17
|
+
export type AccessStatus = 'ACTIVE' | 'INACTIVE';
|
|
18
|
+
export declare const AccessStatusName: {
|
|
19
|
+
ACTIVE: string;
|
|
20
|
+
INACTIVE: string;
|
|
21
|
+
};
|
|
22
|
+
export type AccessMode = 'corpus' | 'parser' | 'lexicon';
|
|
23
|
+
export default Access;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const EMPTY_ACCESS = {
|
|
2
|
+
user: '',
|
|
3
|
+
role: 'EDITOR',
|
|
4
|
+
status: 'ACTIVE',
|
|
5
|
+
};
|
|
6
|
+
export const AccessRoleName = {
|
|
7
|
+
ADMIN: 'user.role.administrator',
|
|
8
|
+
EDITOR: 'user.role.editor',
|
|
9
|
+
READER: 'user.role.reader',
|
|
10
|
+
};
|
|
11
|
+
export const AccessStatusName = {
|
|
12
|
+
ACTIVE: 'user.status.active',
|
|
13
|
+
INACTIVE: 'user.status.inactive',
|
|
14
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Access, { AccessMode } from '../../configs/types/Access';
|
|
2
|
+
import { Corpus } from '../../configs/types/Corpus';
|
|
3
|
+
import { AppPage } from '../../common';
|
|
4
|
+
import { AccessUsersFilter } from './AccessUsers/AccessUsersFilter';
|
|
5
|
+
import { AccessResponse, UserAccessRequest, UserAccessResponse } from './types/UserAccessResponse';
|
|
6
|
+
import { PortalInformationRequest } from './types/PortalInformation';
|
|
7
|
+
declare function updatePortal(user: string, corpus: string, request: PortalInformationRequest): Promise<import("axios").AxiosResponse<any, {
|
|
8
|
+
urlProfile: string;
|
|
9
|
+
display: boolean;
|
|
10
|
+
role: import("./types/PortalInformation").PortalRole;
|
|
11
|
+
corpus: string;
|
|
12
|
+
}, {}, any>>;
|
|
13
|
+
declare function update(mode: AccessMode, resourceUid: string, user: string, request: UserAccessRequest): Promise<import("axios").AxiosResponse<any, {
|
|
14
|
+
app: string;
|
|
15
|
+
status: import("../../configs/types/Access").AccessStatus;
|
|
16
|
+
role: import("../../configs/types/Access").AccessRole;
|
|
17
|
+
user: string;
|
|
18
|
+
}, {}, any>>;
|
|
19
|
+
declare function revoke(mode: AccessMode, user: string, resourceUid: string): Promise<import("axios").AxiosResponse<any, any, {}, any>>;
|
|
20
|
+
declare function grant(mode: AccessMode, access: Access, resourceUid: string): Promise<import("axios").AxiosResponse<any, {
|
|
21
|
+
corpus: boolean;
|
|
22
|
+
lexicon?: undefined;
|
|
23
|
+
parser?: undefined;
|
|
24
|
+
user: string;
|
|
25
|
+
status: import("../../configs/types/Access").AccessStatus;
|
|
26
|
+
role: import("../../configs/types/Access").AccessRole;
|
|
27
|
+
} | {
|
|
28
|
+
corpus: boolean;
|
|
29
|
+
lexicon: boolean;
|
|
30
|
+
parser: boolean;
|
|
31
|
+
user: string;
|
|
32
|
+
status: import("../../configs/types/Access").AccessStatus;
|
|
33
|
+
role: import("../../configs/types/Access").AccessRole;
|
|
34
|
+
}, {}, any>>;
|
|
35
|
+
declare function page(mode: AccessMode, resourceUid: string, filter: AccessUsersFilter): Promise<import("axios").AxiosResponse<AppPage<UserAccessResponse>, any, {}, any>>;
|
|
36
|
+
declare function search(mode: AccessMode, text: string, resourceUid: string): Promise<import("axios").AxiosResponse<UserAccessResponse[], any, {}, any>>;
|
|
37
|
+
declare function searchAll(text: string): Promise<import("axios").AxiosResponse<UserAccessResponse[], any, {}, any>>;
|
|
38
|
+
declare function findCorporaByUser(uid: string): Promise<import("axios").AxiosResponse<Corpus[], any, {}, any>>;
|
|
39
|
+
declare function findParsersByUser(uid: string): Promise<import("axios").AxiosResponse<AccessResponse[], any, {}, any>>;
|
|
40
|
+
declare function findLexiconsByUser(uid: string): Promise<import("axios").AxiosResponse<AccessResponse[], any, {}, any>>;
|
|
41
|
+
declare const AccessControlService: {
|
|
42
|
+
page: typeof page;
|
|
43
|
+
revoke: typeof revoke;
|
|
44
|
+
grant: typeof grant;
|
|
45
|
+
search: typeof search;
|
|
46
|
+
update: typeof update;
|
|
47
|
+
updatePortal: typeof updatePortal;
|
|
48
|
+
searchAll: typeof searchAll;
|
|
49
|
+
findCorporaByUser: typeof findCorporaByUser;
|
|
50
|
+
findParsersByUser: typeof findParsersByUser;
|
|
51
|
+
findLexiconsByUser: typeof findLexiconsByUser;
|
|
52
|
+
};
|
|
53
|
+
export default AccessControlService;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import api, { lexiconApiBase, parserApiBase, platformApi } from '../../configs/api';
|
|
2
|
+
import { convertPageable } from '../../common';
|
|
3
|
+
const AUTH_API = () => import.meta.env.VITE_APP_AUTH_API;
|
|
4
|
+
const APP_BY_MODE = {
|
|
5
|
+
corpus: 'CORPUS',
|
|
6
|
+
parser: 'PARSER',
|
|
7
|
+
lexicon: 'LEXICON',
|
|
8
|
+
};
|
|
9
|
+
function resourceKey(mode) {
|
|
10
|
+
return mode;
|
|
11
|
+
}
|
|
12
|
+
function updatePortal(user, corpus, request) {
|
|
13
|
+
return api.patch(`${AUTH_API()}/portal/${user}`, {
|
|
14
|
+
corpus,
|
|
15
|
+
...request,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function update(mode, resourceUid, user, request) {
|
|
19
|
+
return api.patch(`${AUTH_API()}/access/${resourceUid}`, {
|
|
20
|
+
user,
|
|
21
|
+
...request,
|
|
22
|
+
app: APP_BY_MODE[mode],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function revoke(mode, user, resourceUid) {
|
|
26
|
+
return api.delete(`${AUTH_API()}/${resourceUid}/${user}/${mode}`);
|
|
27
|
+
}
|
|
28
|
+
function grant(mode, access, resourceUid) {
|
|
29
|
+
const flags = mode === 'corpus'
|
|
30
|
+
? { corpus: true }
|
|
31
|
+
: mode === 'parser'
|
|
32
|
+
? { corpus: false }
|
|
33
|
+
: { corpus: false, lexicon: true, parser: false };
|
|
34
|
+
return api.post(`${AUTH_API()}/${resourceUid}`, {
|
|
35
|
+
...access,
|
|
36
|
+
...flags,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function page(mode, resourceUid, filter) {
|
|
40
|
+
const data = {
|
|
41
|
+
[resourceKey(mode)]: resourceUid,
|
|
42
|
+
...convertPageable(filter),
|
|
43
|
+
};
|
|
44
|
+
return api.post(`${AUTH_API()}/access`, data);
|
|
45
|
+
}
|
|
46
|
+
function search(mode, text, resourceUid) {
|
|
47
|
+
return api.get(`${AUTH_API()}/search`, {
|
|
48
|
+
params: {
|
|
49
|
+
text,
|
|
50
|
+
[resourceKey(mode)]: resourceUid,
|
|
51
|
+
...(mode === 'parser' ? { uid: resourceUid } : {}),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function searchAll(text) {
|
|
56
|
+
return api.get(`${AUTH_API()}/search`, {
|
|
57
|
+
params: { text },
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function findCorporaByUser(uid) {
|
|
61
|
+
return api.get(`${platformApi.base}/corpus/user/${uid}`);
|
|
62
|
+
}
|
|
63
|
+
function findParsersByUser(uid) {
|
|
64
|
+
return api.get(`${parserApiBase}/user/${uid}`);
|
|
65
|
+
}
|
|
66
|
+
function findLexiconsByUser(uid) {
|
|
67
|
+
const base = lexiconApiBase;
|
|
68
|
+
if (!base) {
|
|
69
|
+
return Promise.reject(new Error('VITE_APP_LEXICON_API / VITE_APP_URL_API is not configured'));
|
|
70
|
+
}
|
|
71
|
+
return api.get(`${base}/user/${uid}`);
|
|
72
|
+
}
|
|
73
|
+
const AccessControlService = {
|
|
74
|
+
page,
|
|
75
|
+
revoke,
|
|
76
|
+
grant,
|
|
77
|
+
search,
|
|
78
|
+
update,
|
|
79
|
+
updatePortal,
|
|
80
|
+
searchAll,
|
|
81
|
+
findCorporaByUser,
|
|
82
|
+
findParsersByUser,
|
|
83
|
+
findLexiconsByUser,
|
|
84
|
+
};
|
|
85
|
+
export default AccessControlService;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AccessMode } from '../../../configs/types/Access';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
type Props = {
|
|
4
|
+
mode: AccessMode;
|
|
5
|
+
resourceUid: string;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
reload: () => void;
|
|
8
|
+
};
|
|
9
|
+
export default function AccessGrant({ mode, resourceUid, onClose, reload, }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useForm } from 'react-hook-form';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { AsyncSelectField } from 'tycho-storybook';
|
|
6
|
+
import { AppForm, AppModal } from '../../../common';
|
|
7
|
+
import { AccessRoleName, AccessStatusName, EMPTY_ACCESS, } from '../../../configs/types/Access';
|
|
8
|
+
import { useMessageUtils } from '../../../configs/useMessageUtils';
|
|
9
|
+
import FormUtils from '../../../functions/FormUtils';
|
|
10
|
+
import AccessControlService from '../AccessControlService';
|
|
11
|
+
import './style.scss';
|
|
12
|
+
export default function AccessGrant({ mode, resourceUid, onClose, reload, }) {
|
|
13
|
+
const { t } = useTranslation('access');
|
|
14
|
+
const { dispatchError } = useMessageUtils();
|
|
15
|
+
const fields = useMemo(() => getAccessGrantFields(t), [t]);
|
|
16
|
+
const form = useForm({
|
|
17
|
+
defaultValues: {
|
|
18
|
+
user: null,
|
|
19
|
+
role: EMPTY_ACCESS.role,
|
|
20
|
+
status: EMPTY_ACCESS.status,
|
|
21
|
+
},
|
|
22
|
+
mode: 'onChange',
|
|
23
|
+
});
|
|
24
|
+
const handleConfirm = () => {
|
|
25
|
+
if (!resourceUid)
|
|
26
|
+
return;
|
|
27
|
+
const { user, role, status } = form.getValues();
|
|
28
|
+
if (!user?.value)
|
|
29
|
+
return;
|
|
30
|
+
AccessControlService.grant(mode, { user: user.value, role, status }, resourceUid)
|
|
31
|
+
.then(() => {
|
|
32
|
+
onClose();
|
|
33
|
+
reload();
|
|
34
|
+
})
|
|
35
|
+
.catch((err) => {
|
|
36
|
+
dispatchError({ err, t });
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const filterUsers = async (value) => {
|
|
40
|
+
if (value.length < 2 || !resourceUid)
|
|
41
|
+
return [];
|
|
42
|
+
const r = await AccessControlService.search(mode, value, resourceUid);
|
|
43
|
+
const options = [];
|
|
44
|
+
for (const thisUser of r.data) {
|
|
45
|
+
options.push({
|
|
46
|
+
value: thisUser.uid,
|
|
47
|
+
label: `${thisUser.name} - ${thisUser.email}`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return options;
|
|
51
|
+
};
|
|
52
|
+
/** Flat keys — avoid nesting under `access.modal.grant.title` (i18next keySeparator). */
|
|
53
|
+
const grantTitleKey = {
|
|
54
|
+
corpus: 'access.modal.grant.corpus',
|
|
55
|
+
parser: 'access.modal.grant.parser',
|
|
56
|
+
lexicon: 'access.modal.grant.lexicon',
|
|
57
|
+
};
|
|
58
|
+
return (_jsxs(AppModal, { title: t(grantTitleKey[mode]), className: "modal-access-grant", close: onClose, confirm: handleConfirm, children: [_jsx(AsyncSelectField, { label: t('access.modal.label.find'), attr: "user", createdForm: form, loadOptions: filterUsers, noOptionsText: t('message:generic.option.notfound') }), _jsx(AppForm, { form: form, fields: fields, twoColumns: true })] }));
|
|
59
|
+
}
|
|
60
|
+
const getAccessGrantFields = (t) => [
|
|
61
|
+
{
|
|
62
|
+
attr: 'role',
|
|
63
|
+
name: t('access.field.role'),
|
|
64
|
+
type: 'select',
|
|
65
|
+
options: FormUtils.convertEnum(AccessRoleName, t, 'common'),
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
attr: 'status',
|
|
70
|
+
name: t('access.field.status'),
|
|
71
|
+
type: 'select',
|
|
72
|
+
options: FormUtils.convertEnum(AccessStatusName, t, 'common'),
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.modal-access-grant {
|
|
2
|
+
width: 40vw !important;
|
|
3
|
+
max-width: 40vw !important;
|
|
4
|
+
|
|
5
|
+
> .body {
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 16px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (max-width: 1366px) {
|
|
12
|
+
.modal-access-grant {
|
|
13
|
+
width: 90vw !important;
|
|
14
|
+
max-width: 90vw !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media (max-width: 768px) {
|
|
19
|
+
.modal-access-grant {
|
|
20
|
+
width: 90vw !important;
|
|
21
|
+
max-width: 90vw !important;
|
|
22
|
+
|
|
23
|
+
.body {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AccessMode } from '../../../configs/types/Access';
|
|
2
|
+
import { UserAccessRequest, UserAccessResponse } from '../types/UserAccessResponse';
|
|
3
|
+
type Props = {
|
|
4
|
+
mode: AccessMode;
|
|
5
|
+
resourceUid: string;
|
|
6
|
+
user: UserAccessResponse;
|
|
7
|
+
onChange: (r: UserAccessRequest) => void;
|
|
8
|
+
};
|
|
9
|
+
export default function AccessData({ mode, resourceUid, user, onChange, }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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 'tycho-storybook';
|
|
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';
|
|
11
|
+
/** Flat keys (no suffix under another key) — i18next `.` keySeparator nests otherwise. */
|
|
12
|
+
const TITLE_KEY = {
|
|
13
|
+
corpus: 'access.title.corpus',
|
|
14
|
+
parser: 'access.title.parser',
|
|
15
|
+
lexicon: 'access.title.lexicon',
|
|
16
|
+
};
|
|
17
|
+
const DESC_KEY = {
|
|
18
|
+
corpus: 'access.desc.corpus',
|
|
19
|
+
parser: 'access.desc.parser',
|
|
20
|
+
lexicon: 'access.desc.lexicon',
|
|
21
|
+
};
|
|
22
|
+
export default function AccessData({ mode, resourceUid, user, onChange, }) {
|
|
23
|
+
const { t } = useTranslation('access');
|
|
24
|
+
const { dispatchMessage } = useMessageUtils();
|
|
25
|
+
const createdForm = useForm({
|
|
26
|
+
resolver: yupResolver(getFormSchema(t)),
|
|
27
|
+
defaultValues: { role: user.role, status: user.status },
|
|
28
|
+
mode: 'onChange',
|
|
29
|
+
});
|
|
30
|
+
const handleSave = () => {
|
|
31
|
+
if (!resourceUid)
|
|
32
|
+
return;
|
|
33
|
+
const request = createdForm.getValues();
|
|
34
|
+
AccessControlService.update(mode, resourceUid, user.uid, request).then(() => {
|
|
35
|
+
dispatchMessage({ key: 'update.success', t });
|
|
36
|
+
onChange(request);
|
|
37
|
+
});
|
|
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 }), _jsx(SelectField, { label: t('table.label.status'), attr: "status", createdForm: createdForm, options: FormUtils.convertEnum(AccessStatusName, t, 'common'), showEndAdornment: false }), _jsx(Button, { text: t('common:button.save'), disabled: !createdForm.formState.isValid, onClick: handleSave, size: "small" })] })] }));
|
|
40
|
+
}
|
|
41
|
+
const getFormSchema = (t) => yup.object().shape({
|
|
42
|
+
status: yup
|
|
43
|
+
.string()
|
|
44
|
+
.oneOf(Object.keys(AccessStatusName))
|
|
45
|
+
.required(t('message:validation.required')),
|
|
46
|
+
role: yup
|
|
47
|
+
.string()
|
|
48
|
+
.oneOf(Object.keys(AccessRoleName))
|
|
49
|
+
.required(t('message:validation.required')),
|
|
50
|
+
});
|