@beinformed/ui 1.56.0 → 1.57.0-contextpath.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 +19 -0
- package/esm/constants/Settings.js +4 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useForm.js +3 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +11 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +36 -25
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +2 -2
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js +27 -8
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +25 -3
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +2 -2
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +1 -0
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +2 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +2 -2
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +1 -0
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +1 -1
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +2 -0
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/form/FormModel.js +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/href/Href.js +50 -3
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js +1 -1
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/links/LinkCollection.js +3 -1
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js +10 -9
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/list/ListItemModel.js +3 -1
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +2 -2
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +4 -2
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +2 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +43 -7
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js +31 -0
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +3 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Application.js +2 -0
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +2 -0
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/Settings.js +4 -1
- package/lib/constants/Settings.js.flow +2 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useForm.js +3 -1
- package/lib/hooks/useForm.js.flow +2 -0
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +11 -1
- package/lib/hooks/useModularUIBasic.js.flow +14 -0
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +36 -24
- package/lib/hooks/useModularUIModel.js.flow +58 -11
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +2 -2
- package/lib/models/actions/ActionCollection.js.flow +14 -2
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js +31 -12
- package/lib/models/actions/ActionModel.js.flow +38 -16
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +1 -1
- package/lib/models/application/ApplicationModel.js.flow +7 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +24 -3
- package/lib/models/base/ResourceModel.js.flow +35 -10
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +2 -2
- package/lib/models/caseview/CaseViewModel.js.flow +3 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.flow +1 -0
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.flow +2 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +2 -2
- package/lib/models/content/ContentIndexModel.js.flow +2 -2
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -0
- package/lib/models/content/SectionModel.js.flow +1 -0
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +1 -1
- package/lib/models/detail/DetailModel.js.flow +2 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +2 -0
- package/lib/models/error/ErrorResponse.js.flow +2 -0
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -1
- package/lib/models/form/FormModel.js.flow +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/href/Href.js +50 -3
- package/lib/models/href/Href.js.flow +58 -3
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js +1 -1
- package/lib/models/href/ListHref.js.flow +1 -1
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/links/LinkCollection.js +3 -1
- package/lib/models/links/LinkCollection.js.flow +8 -2
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js +10 -9
- package/lib/models/links/LinkModel.js.flow +24 -16
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListItemModel.js +3 -1
- package/lib/models/list/ListItemModel.js.flow +4 -0
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js +1 -1
- package/lib/models/list/ListModel.js.flow +6 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +1 -1
- package/lib/models/panels/GroupingPanelModel.js.flow +2 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +2 -2
- package/lib/models/tab/TabModel.js.flow +4 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +4 -2
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +2 -1
- package/lib/modularui/Authenticate.js.flow +2 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +43 -7
- package/lib/modularui/ModularUIRequest.js.flow +49 -8
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js +31 -0
- package/lib/modularui/ModularUIResponse.js.flow +35 -0
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/__tests__/CustomContextPath.spec.js.flow +61 -0
- package/lib/redux/_modularui/ModularUIActions.js +3 -1
- package/lib/redux/_modularui/ModularUIActions.js.flow +6 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +6 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +10 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +2 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Application.js +2 -0
- package/lib/redux/actions/Application.js.flow +1 -0
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +2 -0
- package/lib/redux/connectors/PanelRenderer.js.flow +1 -0
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +2 -0
- package/lib/utils/fetch/types.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +2 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/Settings.js +2 -2
- package/src/hooks/useForm.js +2 -0
- package/src/hooks/useModularUIBasic.js +14 -0
- package/src/hooks/useModularUIModel.js +58 -11
- package/src/models/actions/ActionCollection.js +14 -2
- package/src/models/actions/ActionModel.js +38 -16
- package/src/models/application/ApplicationModel.js +7 -1
- package/src/models/base/ResourceModel.js +35 -10
- package/src/models/caseview/CaseViewModel.js +3 -1
- package/src/models/concepts/ConceptLinkModel.js +1 -0
- package/src/models/concepts/SourceReferenceModel.js +2 -1
- package/src/models/content/ContentIndexModel.js +2 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/content/SectionModel.js +1 -0
- package/src/models/detail/DetailModel.js +2 -0
- package/src/models/error/ErrorResponse.js +2 -0
- package/src/models/form/FormModel.js +1 -1
- package/src/models/href/Href.js +58 -3
- package/src/models/href/ListHref.js +1 -1
- package/src/models/links/LinkCollection.js +8 -2
- package/src/models/links/LinkModel.js +24 -16
- package/src/models/list/ListItemModel.js +4 -0
- package/src/models/list/ListModel.js +6 -1
- package/src/models/panels/GroupingPanelModel.js +2 -0
- package/src/models/tab/TabModel.js +4 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/modularui/Authenticate.js +2 -1
- package/src/modularui/ModularUIRequest.js +49 -8
- package/src/modularui/ModularUIResponse.js +35 -0
- package/src/modularui/__tests__/CustomContextPath.spec.js +61 -0
- package/src/modularui/__tests__/contributions.json +312 -0
- package/src/modularui/__tests__/data.json +263 -0
- package/src/redux/_modularui/ModularUIActions.js +6 -1
- package/src/redux/_modularui/ModularUIMiddleware.js +10 -0
- package/src/redux/_modularui/types.js +2 -0
- package/src/redux/actions/Application.js +1 -0
- package/src/redux/connectors/PanelRenderer.js +1 -0
- package/src/utils/fetch/types.js +2 -0
- package/src/utils/helpers/checkResource.js +2 -0
|
@@ -6,7 +6,12 @@ import ActionModel from "./ActionModel";
|
|
|
6
6
|
* Collection of actions
|
|
7
7
|
*/
|
|
8
8
|
export default class ActionCollection extends BaseCollection<ActionModel> {
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(
|
|
10
|
+
actions?: Object,
|
|
11
|
+
actionsContributions?: Object,
|
|
12
|
+
origin?: string,
|
|
13
|
+
contextPath?: string,
|
|
14
|
+
) {
|
|
10
15
|
super();
|
|
11
16
|
|
|
12
17
|
// no actions gives an empty collection
|
|
@@ -22,7 +27,14 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
|
|
|
22
27
|
);
|
|
23
28
|
|
|
24
29
|
if (actionContribution) {
|
|
25
|
-
actionModels.push(
|
|
30
|
+
actionModels.push(
|
|
31
|
+
new ActionModel(
|
|
32
|
+
actionData,
|
|
33
|
+
actionContribution,
|
|
34
|
+
origin,
|
|
35
|
+
contextPath,
|
|
36
|
+
),
|
|
37
|
+
);
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
|
|
@@ -6,12 +6,13 @@ import AttributeCollection from "../attributes/AttributeCollection";
|
|
|
6
6
|
import BaseModel from "../base/BaseModel";
|
|
7
7
|
import Href from "../href/Href";
|
|
8
8
|
|
|
9
|
-
import { HTTP_METHODS } from "../../constants/Constants";
|
|
10
9
|
import {
|
|
10
|
+
getBasePath,
|
|
11
|
+
HTTP_METHODS,
|
|
11
12
|
CREATE_ACTION,
|
|
12
13
|
UPDATE_ACTION,
|
|
13
14
|
DELETE_ACTION,
|
|
14
|
-
} from "../../constants
|
|
15
|
+
} from "../../constants";
|
|
15
16
|
|
|
16
17
|
import type { AttributeType } from "../types";
|
|
17
18
|
|
|
@@ -22,14 +23,23 @@ export default class ActionModel extends BaseModel {
|
|
|
22
23
|
_fieldCollection: AttributeCollection;
|
|
23
24
|
_href: Href;
|
|
24
25
|
_icon: string;
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
_origin: ?string;
|
|
27
|
+
_contextPath: ?string;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
data: Object,
|
|
31
|
+
contributions: Object,
|
|
32
|
+
origin?: string,
|
|
33
|
+
contextPath?: string,
|
|
34
|
+
) {
|
|
27
35
|
super(data, contributions);
|
|
28
36
|
|
|
29
37
|
this._fieldCollection = new AttributeCollection(
|
|
30
38
|
this.data.fields,
|
|
31
39
|
this.contributions.fields,
|
|
32
40
|
);
|
|
41
|
+
this._origin = origin;
|
|
42
|
+
this._contextPath = contextPath;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
/**
|
|
@@ -39,18 +49,12 @@ export default class ActionModel extends BaseModel {
|
|
|
39
49
|
href: string,
|
|
40
50
|
label: string,
|
|
41
51
|
type: string = "form",
|
|
52
|
+
origin?: string,
|
|
53
|
+
contextPath?: string,
|
|
42
54
|
): ActionModel {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
href,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name,
|
|
50
|
-
label: label || name,
|
|
51
|
-
type,
|
|
52
|
-
},
|
|
53
|
-
);
|
|
55
|
+
const data = { name, href };
|
|
56
|
+
const contributions = { name, label: label ?? name, type };
|
|
57
|
+
return new ActionModel(data, contributions, origin, contextPath);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
@@ -59,12 +63,30 @@ export default class ActionModel extends BaseModel {
|
|
|
59
63
|
return this.data.href == null;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
/**
|
|
67
|
+
*/
|
|
68
|
+
get origin(): string {
|
|
69
|
+
return this._origin ?? "";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
*/
|
|
74
|
+
get contextPath(): string {
|
|
75
|
+
return this._contextPath ?? getBasePath();
|
|
76
|
+
}
|
|
77
|
+
|
|
62
78
|
/**
|
|
63
79
|
* retrieve href of action
|
|
64
80
|
*/
|
|
65
81
|
get selfhref(): Href {
|
|
66
82
|
return (
|
|
67
|
-
this._href
|
|
83
|
+
this._href ??
|
|
84
|
+
new Href(
|
|
85
|
+
`${this.data.href}?${this.querystring}`,
|
|
86
|
+
"Form",
|
|
87
|
+
this.origin,
|
|
88
|
+
this.contextPath,
|
|
89
|
+
)
|
|
68
90
|
);
|
|
69
91
|
}
|
|
70
92
|
|
|
@@ -102,7 +102,13 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
102
102
|
* Get modelcatalog link
|
|
103
103
|
*/
|
|
104
104
|
get modelcatalog(): LinkModel {
|
|
105
|
-
return LinkModel.create(
|
|
105
|
+
return LinkModel.create(
|
|
106
|
+
"modelcatalog",
|
|
107
|
+
"/modelcatalog",
|
|
108
|
+
"Model catalog",
|
|
109
|
+
this.origin,
|
|
110
|
+
this.contextPath,
|
|
111
|
+
);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
/**
|
|
@@ -13,6 +13,7 @@ import type LinkModel from "../links/LinkModel";
|
|
|
13
13
|
import type Href from "../href/Href";
|
|
14
14
|
import type { ModularUIModel, IModelWithChildModels } from "../types";
|
|
15
15
|
import type ErrorResponse from "../error/ErrorResponse";
|
|
16
|
+
import { getBasePath } from "../../constants";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Base model, this the foundation for models that represent modular ui services, e.g. application, tab, caseview, etc
|
|
@@ -23,6 +24,8 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
23
24
|
_childModels: Array<ModularUIModel>;
|
|
24
25
|
_links: LinkCollection;
|
|
25
26
|
_lastServerUpdate: number;
|
|
27
|
+
_origin: string = "";
|
|
28
|
+
_contextPath: string = getBasePath();
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
31
|
* constructor
|
|
@@ -32,10 +35,12 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
32
35
|
|
|
33
36
|
this._key = modularuiResponse.key;
|
|
34
37
|
this._locale = modularuiResponse.locale;
|
|
35
|
-
|
|
36
38
|
this._childModels = [];
|
|
37
39
|
|
|
38
40
|
this._lastServerUpdate = Date.now();
|
|
41
|
+
|
|
42
|
+
this._origin = modularuiResponse.origin;
|
|
43
|
+
this._contextPath = modularuiResponse.contextPath;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
@@ -109,21 +114,39 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
109
114
|
return this.getContribution("label", "");
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
/**
|
|
118
|
+
*/
|
|
119
|
+
get origin(): string {
|
|
120
|
+
return this._origin;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*/
|
|
125
|
+
get contextPath(): string {
|
|
126
|
+
return this._contextPath;
|
|
127
|
+
}
|
|
128
|
+
|
|
112
129
|
/**
|
|
113
130
|
* Getting the links of the resource
|
|
114
131
|
*/
|
|
115
132
|
get links(): LinkCollection {
|
|
116
133
|
if (!this._links) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
...this.contributions._links,
|
|
134
|
+
const linksData = Array.isArray(this.data._links)
|
|
135
|
+
? this.data._links[0]
|
|
136
|
+
: this.data._links;
|
|
137
|
+
|
|
138
|
+
const linksContrubtions = {
|
|
139
|
+
self: {
|
|
140
|
+
resourcetype: this.resourcetype,
|
|
126
141
|
},
|
|
142
|
+
...this.contributions._links,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
this._links = new LinkCollection(
|
|
146
|
+
linksData,
|
|
147
|
+
linksContrubtions,
|
|
148
|
+
this.origin,
|
|
149
|
+
this.contextPath,
|
|
127
150
|
);
|
|
128
151
|
}
|
|
129
152
|
return this._links;
|
|
@@ -231,6 +254,8 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
231
254
|
childModels: this._childModels.map<ModularUIModel>(
|
|
232
255
|
(childModel: ModularUIModel) => childModel.dehydrate(),
|
|
233
256
|
),
|
|
257
|
+
origin: this._origin,
|
|
258
|
+
contextPath: this._contextPath,
|
|
234
259
|
};
|
|
235
260
|
}
|
|
236
261
|
}
|
|
@@ -134,7 +134,7 @@ export default class CaseViewModel extends DetailModel {
|
|
|
134
134
|
throw new IllegalStateException("No self href available");
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return selfLink.href;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
@@ -160,6 +160,8 @@ export default class CaseViewModel extends DetailModel {
|
|
|
160
160
|
taskgroup.name,
|
|
161
161
|
taskgroup,
|
|
162
162
|
taskgroupContributions,
|
|
163
|
+
this.origin,
|
|
164
|
+
this.contextPath,
|
|
163
165
|
);
|
|
164
166
|
});
|
|
165
167
|
}
|
|
@@ -73,7 +73,7 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
73
73
|
* Getting the self link of this list
|
|
74
74
|
*/
|
|
75
75
|
get selfhref(): Href {
|
|
76
|
-
const href =
|
|
76
|
+
const href = this.selflink.href;
|
|
77
77
|
|
|
78
78
|
this.filterCollection.forEach((filter) => {
|
|
79
79
|
filter.params.forEach((param) => {
|
|
@@ -150,6 +150,6 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
150
150
|
)[0].code;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
return new Href(this.selfhref
|
|
153
|
+
return new Href(this.selfhref).addParameter("index", firstChar);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
@@ -102,6 +102,7 @@ export default class ContentLinkModel
|
|
|
102
102
|
/**
|
|
103
103
|
*/
|
|
104
104
|
createEncodedHref(): Href {
|
|
105
|
+
// TODO SBO: origin and context
|
|
105
106
|
const startURI = "/content/";
|
|
106
107
|
const selfHref = new Href(this.data._links.self.href);
|
|
107
108
|
const href = selfHref.path;
|
|
@@ -139,6 +140,7 @@ export default class ContentLinkModel
|
|
|
139
140
|
*/
|
|
140
141
|
get links(): LinkCollection {
|
|
141
142
|
if (!this._links) {
|
|
143
|
+
// TODO SBO: origin and context
|
|
142
144
|
this._links = new LinkCollection(
|
|
143
145
|
Array.isArray(this.data._links)
|
|
144
146
|
? this.data._links[0]
|
|
@@ -161,6 +161,7 @@ export default class ErrorResponse {
|
|
|
161
161
|
* Return response error redirect href
|
|
162
162
|
*/
|
|
163
163
|
get redirectHref(): Href {
|
|
164
|
+
// TODO SBO: origin and context
|
|
164
165
|
if (this.response.redirect?.href) {
|
|
165
166
|
return new Href(this.response.redirect?.href);
|
|
166
167
|
}
|
|
@@ -290,6 +291,7 @@ export default class ErrorResponse {
|
|
|
290
291
|
* Get response url
|
|
291
292
|
*/
|
|
292
293
|
get changePasswordHref(): ?Href {
|
|
294
|
+
// TODO SBO: origin and context
|
|
293
295
|
return this.properties.redirect ? new Href(this.properties.redirect) : null;
|
|
294
296
|
}
|
|
295
297
|
|
|
@@ -605,7 +605,7 @@ class FormModel extends ResourceModel {
|
|
|
605
605
|
*/
|
|
606
606
|
get successRedirect(): Href | null {
|
|
607
607
|
return this.isFinished && this.success
|
|
608
|
-
? new Href(this.success.redirect)
|
|
608
|
+
? new Href(this.success.redirect, "", this.origin, this.contextPath)
|
|
609
609
|
: null;
|
|
610
610
|
}
|
|
611
611
|
|
package/src/models/href/Href.js
CHANGED
|
@@ -29,11 +29,18 @@ class Href {
|
|
|
29
29
|
_method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;
|
|
30
30
|
_state: any = null;
|
|
31
31
|
_referenceHash: ?number;
|
|
32
|
+
_origin: string = "";
|
|
33
|
+
_contextPath: string = getBasePath();
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Create a Href
|
|
35
37
|
*/
|
|
36
|
-
constructor(
|
|
38
|
+
constructor(
|
|
39
|
+
href?: HrefInput,
|
|
40
|
+
resourcetype?: string,
|
|
41
|
+
origin?: string,
|
|
42
|
+
contextPath?: string,
|
|
43
|
+
) {
|
|
37
44
|
this.resourcetype = resourcetype ?? "";
|
|
38
45
|
|
|
39
46
|
if (href instanceof Href) {
|
|
@@ -43,12 +50,22 @@ class Href {
|
|
|
43
50
|
} else if (typeof href === "object") {
|
|
44
51
|
this.setFromLocationOrObject(href);
|
|
45
52
|
}
|
|
53
|
+
|
|
54
|
+
if (typeof origin === "string") {
|
|
55
|
+
this.origin = origin;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof contextPath === "string") {
|
|
59
|
+
this.contextPath = contextPath;
|
|
60
|
+
}
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
/**
|
|
49
64
|
* Set parameters from Href model input
|
|
50
65
|
*/
|
|
51
66
|
setFromHref(href: Href) {
|
|
67
|
+
this.origin = href.origin;
|
|
68
|
+
this.contextPath = href.contextPath;
|
|
52
69
|
this.path = href.path;
|
|
53
70
|
this.parameters = href.parameters;
|
|
54
71
|
this.hash = href.hash;
|
|
@@ -58,6 +75,15 @@ class Href {
|
|
|
58
75
|
/**
|
|
59
76
|
*/
|
|
60
77
|
setFromLocationOrObject(href: LocationShape | HrefObject) {
|
|
78
|
+
// $FlowFixMe
|
|
79
|
+
if (typeof href._origin === "string") {
|
|
80
|
+
this.origin = href._origin;
|
|
81
|
+
}
|
|
82
|
+
// $FlowFixMe
|
|
83
|
+
if (typeof href._contextPath === "string") {
|
|
84
|
+
this.contextPath = href._contextPath;
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
if (typeof href["pathname"] === "string") {
|
|
62
88
|
this.path = href.pathname;
|
|
63
89
|
} else if (typeof href._path === "string") {
|
|
@@ -303,7 +329,36 @@ class Href {
|
|
|
303
329
|
* Retrieve the path
|
|
304
330
|
*/
|
|
305
331
|
get path(): string {
|
|
306
|
-
return this._path
|
|
332
|
+
return this._path ?? "";
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Retrieve the origin (e.g. http://example.com:18080)<br>
|
|
337
|
+
* Empty when the default must be used
|
|
338
|
+
*/
|
|
339
|
+
get origin(): string {
|
|
340
|
+
return this._origin ?? "";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Set the origin (e.g. http://example.com:18080)
|
|
345
|
+
*/
|
|
346
|
+
set origin(origin: string) {
|
|
347
|
+
this._origin = origin;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Get the context path
|
|
352
|
+
*/
|
|
353
|
+
get contextPath(): string {
|
|
354
|
+
return this._contextPath;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Set the context path if different from default
|
|
359
|
+
*/
|
|
360
|
+
set contextPath(contextPath: string) {
|
|
361
|
+
this._contextPath = contextPath;
|
|
307
362
|
}
|
|
308
363
|
|
|
309
364
|
/**
|
|
@@ -362,7 +417,7 @@ class Href {
|
|
|
362
417
|
return this.path;
|
|
363
418
|
}
|
|
364
419
|
|
|
365
|
-
return
|
|
420
|
+
return this.origin + this.contextPath + this.path;
|
|
366
421
|
}
|
|
367
422
|
|
|
368
423
|
/**
|
|
@@ -14,12 +14,18 @@ export default class LinkCollection extends BaseCollection<LinkModel> {
|
|
|
14
14
|
/**
|
|
15
15
|
* Constructs the link collection
|
|
16
16
|
*/
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
linkData: Object = {},
|
|
19
|
+
linkContributions: Object = {},
|
|
20
|
+
origin?: string,
|
|
21
|
+
contextPath?: string,
|
|
22
|
+
) {
|
|
18
23
|
super();
|
|
19
24
|
|
|
20
25
|
// There can be links in data and/or contributions (e.g. concept link is available through contributions)
|
|
21
26
|
this.collection = normalizeLinkJSON(linkData, linkContributions).map(
|
|
22
|
-
({ data, contributions }) =>
|
|
27
|
+
({ data, contributions }) =>
|
|
28
|
+
new LinkModel(data, contributions, origin, contextPath),
|
|
23
29
|
);
|
|
24
30
|
}
|
|
25
31
|
|
|
@@ -27,10 +27,15 @@ class LinkModel extends BaseModel {
|
|
|
27
27
|
/**
|
|
28
28
|
* Create a Link
|
|
29
29
|
*/
|
|
30
|
-
constructor(
|
|
30
|
+
constructor(
|
|
31
|
+
data: Object,
|
|
32
|
+
contributions: Object,
|
|
33
|
+
origin?: string,
|
|
34
|
+
contextPath?: string,
|
|
35
|
+
) {
|
|
31
36
|
super(data, contributions);
|
|
32
37
|
|
|
33
|
-
this.createHref();
|
|
38
|
+
this.createHref(origin, contextPath);
|
|
34
39
|
|
|
35
40
|
this._isCacheable = false;
|
|
36
41
|
}
|
|
@@ -38,24 +43,27 @@ class LinkModel extends BaseModel {
|
|
|
38
43
|
/**
|
|
39
44
|
* Create a simple Link Model
|
|
40
45
|
*/
|
|
41
|
-
static create(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
46
|
+
static create(
|
|
47
|
+
name: string,
|
|
48
|
+
href: string | Href,
|
|
49
|
+
label: string,
|
|
50
|
+
origin?: string,
|
|
51
|
+
contextPath?: string,
|
|
52
|
+
): LinkModel {
|
|
53
|
+
const data = { name, href };
|
|
54
|
+
const contributions = { label };
|
|
55
|
+
return new LinkModel(data, contributions, origin, contextPath);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
59
|
*/
|
|
55
|
-
createHref() {
|
|
56
|
-
const href = new Href(
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
createHref(origin?: string, contextPath?: string) {
|
|
61
|
+
const href = new Href(
|
|
62
|
+
this.data.href,
|
|
63
|
+
this.resourcetype,
|
|
64
|
+
origin,
|
|
65
|
+
contextPath,
|
|
66
|
+
);
|
|
59
67
|
this.handleInitialFilters(href);
|
|
60
68
|
|
|
61
69
|
this.href = href;
|
|
@@ -20,11 +20,15 @@ export default class ListItemModel extends DetailModel {
|
|
|
20
20
|
key: string,
|
|
21
21
|
data: Object,
|
|
22
22
|
contributions: Object,
|
|
23
|
+
origin?: string,
|
|
24
|
+
contextPath?: string,
|
|
23
25
|
): ListItemModel {
|
|
24
26
|
const listitemInput = new ModularUIResponse();
|
|
25
27
|
listitemInput.key = key;
|
|
26
28
|
listitemInput.data = data;
|
|
27
29
|
listitemInput.contributions = contributions;
|
|
30
|
+
listitemInput.origin = origin;
|
|
31
|
+
listitemInput.contextPath = contextPath;
|
|
28
32
|
|
|
29
33
|
return new ListItemModel(listitemInput);
|
|
30
34
|
}
|
|
@@ -313,7 +313,12 @@ export default class ListModel extends ResourceModel {
|
|
|
313
313
|
/**
|
|
314
314
|
*/
|
|
315
315
|
setActionCollection(): ActionCollection {
|
|
316
|
-
return new ActionCollection(
|
|
316
|
+
return new ActionCollection(
|
|
317
|
+
this.data.actions,
|
|
318
|
+
this.contributions.actions,
|
|
319
|
+
this.origin,
|
|
320
|
+
this.contextPath,
|
|
321
|
+
);
|
|
317
322
|
}
|
|
318
323
|
|
|
319
324
|
/**
|
|
@@ -26,6 +26,8 @@ export default class TabModel extends ResourceModel {
|
|
|
26
26
|
this._actionCollection = new ActionCollection(
|
|
27
27
|
this.data.actions,
|
|
28
28
|
this.contributions.actions,
|
|
29
|
+
this.origin,
|
|
30
|
+
this.contextPath,
|
|
29
31
|
);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -93,6 +95,8 @@ export default class TabModel extends ResourceModel {
|
|
|
93
95
|
taskgroup.name,
|
|
94
96
|
taskgroup,
|
|
95
97
|
taskgroupContributions,
|
|
98
|
+
this.origin,
|
|
99
|
+
this.contextPath,
|
|
96
100
|
);
|
|
97
101
|
}
|
|
98
102
|
|
|
@@ -19,6 +19,8 @@ export default class TaskGroupModel extends ResourceModel {
|
|
|
19
19
|
this._actionCollection = new ActionCollection(
|
|
20
20
|
this.data.actions,
|
|
21
21
|
this.contributions.actions,
|
|
22
|
+
this.origin,
|
|
23
|
+
this.contextPath,
|
|
22
24
|
);
|
|
23
25
|
|
|
24
26
|
const selfHref = this.links.getLinkByKey("self")
|
|
@@ -36,11 +38,15 @@ export default class TaskGroupModel extends ResourceModel {
|
|
|
36
38
|
key: string,
|
|
37
39
|
data: Object,
|
|
38
40
|
contributions: Object,
|
|
41
|
+
origin?: string,
|
|
42
|
+
contextPath?: string,
|
|
39
43
|
): TaskGroupModel {
|
|
40
44
|
const taskgroup = new ModularUIResponse();
|
|
41
45
|
taskgroup.key = key;
|
|
42
46
|
taskgroup.data = data;
|
|
43
47
|
taskgroup.contributions = contributions;
|
|
48
|
+
taskgroup.origin = origin;
|
|
49
|
+
taskgroup.contextPath = contextPath;
|
|
44
50
|
|
|
45
51
|
return new TaskGroupModel(taskgroup);
|
|
46
52
|
}
|
|
@@ -109,8 +109,9 @@ class Authenticate {
|
|
|
109
109
|
getFormLoginUrl(): string {
|
|
110
110
|
switch (this.authenticationType) {
|
|
111
111
|
case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
|
|
112
|
+
return `${getBasePath()}${loginPath("DirectBasicAuthClient")}`;
|
|
112
113
|
case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
|
|
113
|
-
return `${getBasePath()}${loginPath()}`;
|
|
114
|
+
return `${getBasePath()}${loginPath("FormClient")}`;
|
|
114
115
|
default:
|
|
115
116
|
return `${getBasePath()}/j_security_check`;
|
|
116
117
|
}
|