@beinformed/ui 1.57.0-contextpath.0 → 1.57.0
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/CHANGELOG.md +63 -0
- package/esm/constants/Settings.js +10 -2
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useModularUI.js +24 -18
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +52 -41
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +1 -8
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +8 -9
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +3 -20
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +3 -1
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +9 -3
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +10 -4
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +10 -6
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +20 -5
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/href/Href.js +21 -4
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/list/ListItemCollection.js +1 -1
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js +12 -3
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js +7 -3
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +11 -9
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +4 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +2 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +7 -6
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Application.js +11 -6
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +0 -2
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +0 -2
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js +6 -5
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/constants/Settings.js +10 -2
- package/lib/constants/Settings.js.flow +8 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +11 -4
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +2 -8
- package/lib/hooks/__tests__/useForm.spec.js.flow +14 -12
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +10 -4
- package/lib/hooks/__tests__/useModels.spec.js.flow +3 -12
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +9 -8
- package/lib/hooks/useModularUI.js +23 -17
- package/lib/hooks/useModularUI.js.flow +31 -16
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +52 -41
- package/lib/hooks/useModularUIBasic.js.flow +66 -50
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +1 -8
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -7
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.flow +7 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +8 -9
- package/lib/models/concepts/ConceptLinkModel.js.flow +14 -9
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +3 -20
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +3 -25
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +3 -1
- package/lib/models/concepts/SourceReferenceCollection.js.flow +8 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +9 -3
- package/lib/models/concepts/SourceReferenceModel.js.flow +19 -3
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/concepts/__mock__/conceptindex.js.flow +15 -0
- package/lib/models/concepts/__tests__/ConceptIndexModel.spec.js.flow +30 -2
- package/lib/models/concepts/__tests__/ConceptTypeDetailModel.spec.js.flow +1 -18
- package/lib/models/content/ContentLinkModel.js +9 -4
- package/lib/models/content/ContentLinkModel.js.flow +19 -4
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +10 -6
- package/lib/models/content/SectionModel.js.flow +31 -5
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +20 -5
- package/lib/models/error/ErrorResponse.js.flow +34 -5
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/href/Href.js +21 -4
- package/lib/models/href/Href.js.flow +21 -4
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +9 -3
- package/lib/models/list/ListItemCollection.js +1 -1
- package/lib/models/list/ListItemCollection.js.flow +2 -0
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js +11 -2
- package/lib/modularui/CaptchaRequest.js.flow +17 -3
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +1 -1
- package/lib/modularui/ModularUIRequest.js.flow +3 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js +6 -2
- package/lib/modularui/UploadRequest.js.flow +12 -2
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +11 -9
- package/lib/redux/_modularui/ModularUIActions.js.flow +20 -10
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +3 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +6 -3
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +2 -1
- package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +5 -6
- package/lib/redux/_modularui/ModularUISelectors.js.flow +22 -10
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -4
- package/lib/redux/_modularui/types.js.flow +1 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Application.js +10 -5
- package/lib/redux/actions/Application.js.flow +16 -5
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -8
- package/lib/redux/actions/__tests__/Authorization.spec.js.flow +0 -4
- package/lib/redux/connectors/PanelRenderer.js +0 -2
- package/lib/redux/connectors/PanelRenderer.js.flow +0 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +0 -2
- package/lib/utils/helpers/checkResource.js.flow +0 -2
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js +6 -5
- package/lib/utils/helpers/repositoryResource.js.flow +8 -6
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/package.json +18 -18
- package/src/constants/Settings.js +8 -2
- package/src/hooks/__tests__/UseModularUIModel.spec.js +11 -4
- package/src/hooks/__tests__/useAuthentication.spec.js +2 -8
- package/src/hooks/__tests__/useForm.spec.js +14 -12
- package/src/hooks/__tests__/useModelCatalog.spec.js +10 -4
- package/src/hooks/__tests__/useModels.spec.js +3 -12
- package/src/hooks/__tests__/useModularUIBasic.spec.js +9 -8
- package/src/hooks/useModularUI.js +31 -16
- package/src/hooks/useModularUIBasic.js +66 -50
- package/src/models/concepts/ConceptDetailModel.js +2 -7
- package/src/models/concepts/ConceptIndexModel.js +7 -1
- package/src/models/concepts/ConceptLinkModel.js +14 -9
- package/src/models/concepts/ConceptTypeDetailModel.js +3 -25
- package/src/models/concepts/SourceReferenceCollection.js +8 -1
- package/src/models/concepts/SourceReferenceModel.js +19 -3
- package/src/models/concepts/__mock__/conceptindex.js +15 -0
- package/src/models/concepts/__mock__/conceptindex_contributions.json +86 -0
- package/src/models/concepts/__mock__/conceptindex_data.json +323 -0
- package/src/models/concepts/__mock__/concepttype_hierarchy.json +1 -11
- package/src/models/concepts/__tests__/ConceptIndexModel.spec.js +30 -2
- package/src/models/concepts/__tests__/ConceptTypeDetailModel.spec.js +1 -18
- package/src/models/content/ContentLinkModel.js +19 -4
- package/src/models/content/SectionModel.js +31 -5
- package/src/models/error/ErrorResponse.js +34 -5
- package/src/models/href/Href.js +21 -4
- package/src/models/href/__tests__/Href.spec.js +9 -3
- package/src/models/list/ListItemCollection.js +2 -0
- package/src/modularui/CaptchaRequest.js +17 -3
- package/src/modularui/ModularUIRequest.js +3 -1
- package/src/modularui/UploadRequest.js +12 -2
- package/src/redux/_modularui/ModularUIActions.js +20 -10
- package/src/redux/_modularui/ModularUIMiddleware.js +6 -3
- package/src/redux/_modularui/ModularUIReducer.js +1 -0
- package/src/redux/_modularui/ModularUISelectors.js +22 -10
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -4
- package/src/redux/_modularui/types.js +1 -0
- package/src/redux/actions/Application.js +16 -5
- package/src/redux/actions/__tests__/Application.spec.js +1 -8
- package/src/redux/actions/__tests__/Authorization.spec.js +0 -4
- package/src/redux/connectors/PanelRenderer.js +0 -1
- package/src/utils/helpers/checkResource.js +0 -2
- package/src/utils/helpers/repositoryResource.js +8 -6
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// @flow
|
|
2
|
+
import { useMemo } from "react";
|
|
2
3
|
import { useModularUI } from "./useModularUI";
|
|
3
|
-
|
|
4
4
|
import { useLocation } from "./useRouter";
|
|
5
|
-
|
|
6
5
|
import { IllegalStateException } from "../exceptions";
|
|
7
|
-
|
|
8
6
|
import type { ModularUIModel, Href } from "../models";
|
|
9
7
|
|
|
10
8
|
export type UseModularUIBasicOptions<T: ModularUIModel> = {
|
|
@@ -16,22 +14,13 @@ export type UseModularUIBasicOptions<T: ModularUIModel> = {
|
|
|
16
14
|
cache?: boolean,
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
targetModel: undefined,
|
|
27
|
-
forceTargetModel: false,
|
|
28
|
-
origin: undefined,
|
|
29
|
-
contextPath: undefined,
|
|
30
|
-
},
|
|
31
|
-
): T | null => {
|
|
32
|
-
const location = useLocation();
|
|
33
|
-
|
|
34
|
-
const useModularUIOptions = {
|
|
17
|
+
// Helper to create useModularUI options
|
|
18
|
+
const createUseModularUIOptions = <T: ModularUIModel>(
|
|
19
|
+
options: UseModularUIBasicOptions<T>,
|
|
20
|
+
href: string,
|
|
21
|
+
location: any,
|
|
22
|
+
): Object => {
|
|
23
|
+
const baseOptions = {
|
|
35
24
|
targetModel: undefined,
|
|
36
25
|
forceTargetModel: undefined,
|
|
37
26
|
isReload: false,
|
|
@@ -39,48 +28,75 @@ export const useModularUIBasic = <T: ModularUIModel>(
|
|
|
39
28
|
contextPath: undefined,
|
|
40
29
|
cache: false,
|
|
41
30
|
};
|
|
31
|
+
|
|
32
|
+
// Handle targetModel and forceTargetModel
|
|
42
33
|
if (options.targetModel) {
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
baseOptions.targetModel = options.targetModel;
|
|
35
|
+
baseOptions.forceTargetModel = options.forceTargetModel;
|
|
45
36
|
}
|
|
46
37
|
|
|
38
|
+
// Handle cache option
|
|
47
39
|
if (options.cache) {
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// reload when the modular service starts with the current location
|
|
52
|
-
if (location.state?.reload && location.pathname.startsWith(href.toString())) {
|
|
53
|
-
useModularUIOptions.isReload = true;
|
|
40
|
+
baseOptions.cache = options.cache;
|
|
54
41
|
}
|
|
55
42
|
|
|
56
|
-
if
|
|
57
|
-
|
|
43
|
+
// Check for reload if location matches href
|
|
44
|
+
if (location.state?.reload && location.pathname.startsWith(href)) {
|
|
45
|
+
baseOptions.isReload = true;
|
|
58
46
|
}
|
|
59
47
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// $FlowFixMe[incompatible-call]
|
|
65
|
-
const modularUI = useModularUI(key, href, useModularUIOptions);
|
|
66
|
-
|
|
67
|
-
if (modularUI?.model) {
|
|
68
|
-
const { model } = modularUI;
|
|
48
|
+
// Handle origin and contextPath options
|
|
49
|
+
baseOptions.origin = options.origin ?? baseOptions.origin;
|
|
50
|
+
baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;
|
|
69
51
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const isCorrectModel = expectedModels.some((expectedModel) => {
|
|
73
|
-
return model.type === expectedModel;
|
|
74
|
-
});
|
|
52
|
+
return baseOptions;
|
|
53
|
+
};
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
// Helper to validate the model against expectedModels
|
|
56
|
+
const validateModel = (model: any, expectedModels: Array<string>) => {
|
|
57
|
+
if (expectedModels.length > 0) {
|
|
58
|
+
const isCorrectModel = expectedModels.some(
|
|
59
|
+
(expectedModel) => model.type === expectedModel,
|
|
60
|
+
);
|
|
61
|
+
if (!isCorrectModel) {
|
|
62
|
+
console.error(model, "is not of instance", expectedModels);
|
|
63
|
+
throw new IllegalStateException("Resolved model has incorrect type");
|
|
80
64
|
}
|
|
81
|
-
|
|
82
|
-
return model;
|
|
83
65
|
}
|
|
66
|
+
};
|
|
84
67
|
|
|
85
|
-
|
|
68
|
+
/**
|
|
69
|
+
* useModularUIBasic Hook
|
|
70
|
+
*/
|
|
71
|
+
export const useModularUIBasic = <T: ModularUIModel>(
|
|
72
|
+
key: string,
|
|
73
|
+
href: string | Href,
|
|
74
|
+
options: UseModularUIBasicOptions<T> = {
|
|
75
|
+
expectedModels: [],
|
|
76
|
+
targetModel: undefined,
|
|
77
|
+
forceTargetModel: false,
|
|
78
|
+
origin: undefined,
|
|
79
|
+
contextPath: undefined,
|
|
80
|
+
},
|
|
81
|
+
): T | null => {
|
|
82
|
+
const location = useLocation();
|
|
83
|
+
const memoizedHref = useMemo(() => href.toString(), [href]);
|
|
84
|
+
const useModularUIOptions = useMemo(
|
|
85
|
+
() => createUseModularUIOptions(options, memoizedHref, location),
|
|
86
|
+
[options, memoizedHref, location],
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const modularUI = useModularUI(key, memoizedHref, useModularUIOptions);
|
|
90
|
+
const expectedModels = useMemo(
|
|
91
|
+
() => options.expectedModels ?? [],
|
|
92
|
+
[options.expectedModels],
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
return useMemo((): T | null => {
|
|
96
|
+
if (modularUI?.model) {
|
|
97
|
+
validateModel(modularUI.model, expectedModels);
|
|
98
|
+
return modularUI.model;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}, [expectedModels, modularUI]);
|
|
86
102
|
};
|
|
@@ -273,6 +273,8 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
273
273
|
this._sourceReferences = new SourceReferenceCollection(
|
|
274
274
|
this.getSourceReferencesForCurrentLanguage(availableLocales),
|
|
275
275
|
this.entryDate,
|
|
276
|
+
this.origin,
|
|
277
|
+
this.contextPath,
|
|
276
278
|
);
|
|
277
279
|
}
|
|
278
280
|
|
|
@@ -338,11 +340,4 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
338
340
|
isOfConceptType(conceptTypeId: string): boolean {
|
|
339
341
|
return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;
|
|
340
342
|
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Indicates if the given metamodel functional identifier exists in the hierarchy of concept types for this concept
|
|
344
|
-
*/
|
|
345
|
-
hasMetamodelIdInConceptTypeHierarchy(metamodelId: string): boolean {
|
|
346
|
-
return this.conceptType?.hasMetamodelIdInHierarchy(metamodelId) ?? false;
|
|
347
|
-
}
|
|
348
343
|
}
|
|
@@ -32,7 +32,13 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
32
32
|
this._concepts = new ResourceCollection();
|
|
33
33
|
this._concepts.collection = this.data._embedded
|
|
34
34
|
? this.data._embedded.results.map(
|
|
35
|
-
(concept) =>
|
|
35
|
+
(concept) =>
|
|
36
|
+
new ConceptLinkModel(
|
|
37
|
+
concept.concept,
|
|
38
|
+
this.entryDate,
|
|
39
|
+
this.origin,
|
|
40
|
+
this.contextPath,
|
|
41
|
+
),
|
|
36
42
|
)
|
|
37
43
|
: [];
|
|
38
44
|
}
|
|
@@ -7,6 +7,7 @@ import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
|
7
7
|
|
|
8
8
|
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
9
9
|
import type Href from "../href/Href";
|
|
10
|
+
import { getBasePath } from "../../constants";
|
|
10
11
|
/**
|
|
11
12
|
* Link to a concept
|
|
12
13
|
*/
|
|
@@ -17,14 +18,23 @@ export default class ConceptLinkModel
|
|
|
17
18
|
_links: ?LinkCollection;
|
|
18
19
|
_entryDate: ?ISO_DATE;
|
|
19
20
|
_conceptType: ?ConceptTypeDetailModel;
|
|
21
|
+
_origin: string = "";
|
|
22
|
+
_contextPath: string = getBasePath();
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* Construct ConceptLinkModel
|
|
23
26
|
*/
|
|
24
|
-
constructor(
|
|
27
|
+
constructor(
|
|
28
|
+
data: Object,
|
|
29
|
+
entryDate: ?ISO_DATE = null,
|
|
30
|
+
origin?: string,
|
|
31
|
+
contextPath?: string,
|
|
32
|
+
) {
|
|
25
33
|
super(data, {});
|
|
26
34
|
|
|
27
35
|
this._entryDate = entryDate;
|
|
36
|
+
this._origin = origin || "";
|
|
37
|
+
this._contextPath = contextPath || getBasePath();
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
/**
|
|
@@ -97,6 +107,9 @@ export default class ConceptLinkModel
|
|
|
97
107
|
Array.isArray(this.data._links)
|
|
98
108
|
? this.data._links[0]
|
|
99
109
|
: this.data._links,
|
|
110
|
+
null,
|
|
111
|
+
this._contextPath,
|
|
112
|
+
this._origin,
|
|
100
113
|
);
|
|
101
114
|
}
|
|
102
115
|
|
|
@@ -156,7 +169,6 @@ export default class ConceptLinkModel
|
|
|
156
169
|
/**
|
|
157
170
|
*/
|
|
158
171
|
asLinkModel(): LinkModel {
|
|
159
|
-
// TODO SBO: origin and contextpath
|
|
160
172
|
const link = LinkModel.create(this.key, this.selfhref.href, this.label);
|
|
161
173
|
link.href = this.selfhref;
|
|
162
174
|
|
|
@@ -169,11 +181,4 @@ export default class ConceptLinkModel
|
|
|
169
181
|
isOfConceptType(conceptTypeId: string): boolean {
|
|
170
182
|
return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;
|
|
171
183
|
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Indicates if the given metamodel functional identifier exists in the hierarchy of concept types for this concept
|
|
175
|
-
*/
|
|
176
|
-
hasMetamodelIdInConceptTypeHierarchy(metamodelId: string): boolean {
|
|
177
|
-
return this.conceptType?.hasMetamodelIdInHierarchy(metamodelId) ?? false;
|
|
178
|
-
}
|
|
179
184
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
|
|
4
4
|
import type ModularUIResponse from "../../modularui/ModularUIResponse";
|
|
5
|
-
import type LinkCollection from "../links/LinkCollection";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Model for concept details, available through modelcatalog
|
|
@@ -12,8 +11,8 @@ class ConceptTypeDetailModel extends ResourceModel {
|
|
|
12
11
|
* The name of the concept type consists of the functional id of the kmt and the functional id of the concept type separated by a #.<br>
|
|
13
12
|
* For example BEI_CaseManagement#Case
|
|
14
13
|
*/
|
|
15
|
-
get
|
|
16
|
-
return this.getData("
|
|
14
|
+
get kmtId(): string {
|
|
15
|
+
return this.getData("kmtId", "");
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -119,31 +118,10 @@ class ConceptTypeDetailModel extends ResourceModel {
|
|
|
119
118
|
return this.getData("sectionReferenceTypes", []);
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
/**
|
|
123
|
-
*/
|
|
124
|
-
get conceptTypeHierarchy(): LinkCollection {
|
|
125
|
-
return this.links.getLinksByGroup("conceptTypeHierarchy");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
121
|
/**
|
|
129
122
|
*/
|
|
130
123
|
isOfConceptType(conceptTypeId: string): boolean {
|
|
131
|
-
return (
|
|
132
|
-
this.conceptTypeHierarchy?.hasLinkByKey(conceptTypeId) ||
|
|
133
|
-
this.conceptTypeHierarchy?.hasLinkByHref(conceptTypeId) ||
|
|
134
|
-
this.selfhref.equals(conceptTypeId)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Indicates if the given metamodel functional identifier exists in the hierarchy of concept types
|
|
140
|
-
*/
|
|
141
|
-
hasMetamodelIdInHierarchy(metamodelId: string): boolean {
|
|
142
|
-
return (
|
|
143
|
-
this.conceptTypeHierarchy?.all.some((link) =>
|
|
144
|
-
link.key.startsWith(metamodelId + "#"),
|
|
145
|
-
) || false
|
|
146
|
-
);
|
|
124
|
+
return this.selfhref.equals(conceptTypeId);
|
|
147
125
|
}
|
|
148
126
|
}
|
|
149
127
|
|
|
@@ -11,13 +11,20 @@ export default class SourceReferenceCollection extends BaseCollection<SourceRefe
|
|
|
11
11
|
constructor(
|
|
12
12
|
sourceReferences: Array<Object> = [],
|
|
13
13
|
entryDate: ?ISO_DATE = null,
|
|
14
|
+
origin?: string,
|
|
15
|
+
contextPath?: string,
|
|
14
16
|
) {
|
|
15
17
|
super();
|
|
16
18
|
|
|
17
19
|
this.collection = sourceReferences
|
|
18
20
|
? sourceReferences.map(
|
|
19
21
|
(sourceReference) =>
|
|
20
|
-
new SourceReferenceModel(
|
|
22
|
+
new SourceReferenceModel(
|
|
23
|
+
sourceReference,
|
|
24
|
+
entryDate,
|
|
25
|
+
origin,
|
|
26
|
+
contextPath,
|
|
27
|
+
),
|
|
21
28
|
)
|
|
22
29
|
: [];
|
|
23
30
|
}
|
|
@@ -3,18 +3,28 @@ import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
|
3
3
|
|
|
4
4
|
import ContentLinkModel from "../content/ContentLinkModel";
|
|
5
5
|
import Href from "../href/Href";
|
|
6
|
+
import { getBasePath } from "../../constants";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*/
|
|
9
10
|
class SourceReferenceModel {
|
|
10
11
|
_sourceReference: Object;
|
|
11
12
|
_entryDate: ?ISO_DATE;
|
|
13
|
+
_origin: string = "";
|
|
14
|
+
_contextPath: string = getBasePath();
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
*/
|
|
15
|
-
constructor(
|
|
18
|
+
constructor(
|
|
19
|
+
sourceReference: Object,
|
|
20
|
+
entryDate: ?ISO_DATE = null,
|
|
21
|
+
origin?: string,
|
|
22
|
+
contextPath?: string,
|
|
23
|
+
) {
|
|
16
24
|
this._sourceReference = sourceReference;
|
|
17
25
|
this._entryDate = entryDate;
|
|
26
|
+
this._origin = origin || "";
|
|
27
|
+
this._contextPath = contextPath || getBasePath();
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
/**
|
|
@@ -31,14 +41,20 @@ class SourceReferenceModel {
|
|
|
31
41
|
section,
|
|
32
42
|
},
|
|
33
43
|
this._entryDate,
|
|
44
|
+
this._origin,
|
|
45
|
+
this._contextPath,
|
|
34
46
|
);
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
/**
|
|
38
50
|
*/
|
|
39
51
|
get selfhref(): Href {
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
return new Href(
|
|
53
|
+
this._sourceReference._links.self.href,
|
|
54
|
+
"SourceReference",
|
|
55
|
+
this._origin,
|
|
56
|
+
this._contextPath,
|
|
57
|
+
);
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ConceptIndexModel from "../ConceptIndexModel";
|
|
2
|
+
import ModularUIResponse from "../../../modularui/ModularUIResponse";
|
|
3
|
+
|
|
4
|
+
import data from "./conceptindex_data.json";
|
|
5
|
+
import contributions from "./conceptindex_contributions.json";
|
|
6
|
+
|
|
7
|
+
const conceptIndexResponse = ModularUIResponse.create({
|
|
8
|
+
key: "ConceptSearch",
|
|
9
|
+
data,
|
|
10
|
+
contributions,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const conceptIndex = new ConceptIndexModel(conceptIndexResponse);
|
|
14
|
+
|
|
15
|
+
export { conceptIndex };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ConceptSearch": {
|
|
3
|
+
"label": "Concept search",
|
|
4
|
+
"resourcetype": "ConceptSearch",
|
|
5
|
+
"filter": [
|
|
6
|
+
{
|
|
7
|
+
"index": {
|
|
8
|
+
"type": "choicefilter",
|
|
9
|
+
"label": "Index",
|
|
10
|
+
"layouthint": ["combobox"],
|
|
11
|
+
"multiplechoice": false,
|
|
12
|
+
"optionMode": "dynamic"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"label": {
|
|
17
|
+
"type": "stringfilter",
|
|
18
|
+
"label": "Label",
|
|
19
|
+
"multiplechoice": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": {
|
|
24
|
+
"type": "choicefilter",
|
|
25
|
+
"label": "Type",
|
|
26
|
+
"layouthint": ["checkbox"],
|
|
27
|
+
"multiplechoice": true,
|
|
28
|
+
"optionMode": "lookup"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"modelCategory": {
|
|
33
|
+
"type": "choicefilter",
|
|
34
|
+
"label": "Model category",
|
|
35
|
+
"layouthint": ["checkbox"],
|
|
36
|
+
"multiplechoice": true,
|
|
37
|
+
"optionMode": "static",
|
|
38
|
+
"options": [
|
|
39
|
+
{
|
|
40
|
+
"key": "BusinessDesign",
|
|
41
|
+
"label": "Business design"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"key": "FLINT",
|
|
45
|
+
"label": "FLINT"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"key": "Requirements",
|
|
49
|
+
"label": "Requirements"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"key": "Scenarios",
|
|
53
|
+
"label": "Scenarios"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"entryDate": {
|
|
60
|
+
"type": "datefilter",
|
|
61
|
+
"label": "Entry date",
|
|
62
|
+
"format": "dd-MM-yyyy",
|
|
63
|
+
"formatlabel": "dd-mm-yyyy",
|
|
64
|
+
"operator": "greater-than-or-equal"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"results": {
|
|
69
|
+
"concept": {
|
|
70
|
+
"metadata": {
|
|
71
|
+
"_id": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"attributes": [
|
|
76
|
+
{
|
|
77
|
+
"label": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"label": "concept label"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|