@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
|
@@ -46,7 +46,8 @@ class ModularUIRequest {
|
|
|
46
46
|
|
|
47
47
|
_progressEvent: ProgressEventHandler;
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
_origin: string = "";
|
|
50
|
+
_contextPath: string = getBasePath();
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
53
|
*/
|
|
@@ -60,8 +61,6 @@ class ModularUIRequest {
|
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
this._basePath = getBasePath();
|
|
64
|
-
|
|
65
64
|
this.options = options;
|
|
66
65
|
|
|
67
66
|
this._response = new ModularUIResponse();
|
|
@@ -73,6 +72,18 @@ class ModularUIRequest {
|
|
|
73
72
|
// self links are missing the request parameters
|
|
74
73
|
this._response.parameters = this.href.parameters;
|
|
75
74
|
|
|
75
|
+
if (options.contextPath) {
|
|
76
|
+
this.contextPath = options.contextPath;
|
|
77
|
+
} else if (this.href.contextPath) {
|
|
78
|
+
this.contextPath = this.href.contextPath;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (options.origin) {
|
|
82
|
+
this.origin = options.origin;
|
|
83
|
+
} else if (this.href.origin) {
|
|
84
|
+
this.origin = this.href.origin;
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
if (options.targetModel) {
|
|
77
88
|
this.targetModel = options.targetModel;
|
|
78
89
|
}
|
|
@@ -84,6 +95,32 @@ class ModularUIRequest {
|
|
|
84
95
|
}
|
|
85
96
|
}
|
|
86
97
|
|
|
98
|
+
/**
|
|
99
|
+
*/
|
|
100
|
+
get origin(): string {
|
|
101
|
+
return this._origin;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
*/
|
|
106
|
+
set origin(origin: ?string) {
|
|
107
|
+
this._origin = origin ?? "";
|
|
108
|
+
this._response.origin = origin ?? "";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
*/
|
|
113
|
+
get contextPath(): string {
|
|
114
|
+
return this._contextPath;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
*/
|
|
119
|
+
set contextPath(contextPath: ?string) {
|
|
120
|
+
this._contextPath = contextPath ?? getBasePath();
|
|
121
|
+
this._response.contextPath = contextPath ?? getBasePath();
|
|
122
|
+
}
|
|
123
|
+
|
|
87
124
|
/**
|
|
88
125
|
*/
|
|
89
126
|
get contributionsHref(): string {
|
|
@@ -284,7 +321,11 @@ class ModularUIRequest {
|
|
|
284
321
|
handleDataError(error: Object): void {
|
|
285
322
|
if (error.properties) {
|
|
286
323
|
const errorMessage = error.properties?.message ?? "Error in data";
|
|
287
|
-
throw new ModularUIError(
|
|
324
|
+
throw new ModularUIError(
|
|
325
|
+
errorMessage,
|
|
326
|
+
error,
|
|
327
|
+
this.href.absolutepath.toString(),
|
|
328
|
+
);
|
|
288
329
|
}
|
|
289
330
|
|
|
290
331
|
throw new IllegalArgumentException(error);
|
|
@@ -332,7 +373,7 @@ class ModularUIRequest {
|
|
|
332
373
|
}
|
|
333
374
|
|
|
334
375
|
return universalFetch({
|
|
335
|
-
url: `${this.
|
|
376
|
+
url: `${this.origin}${this.contextPath}${this.contributionsHref}`,
|
|
336
377
|
cache: true,
|
|
337
378
|
locale: this.options.locale,
|
|
338
379
|
});
|
|
@@ -343,7 +384,7 @@ class ModularUIRequest {
|
|
|
343
384
|
fetchDataService(): Promise<any> {
|
|
344
385
|
return universalFetch({
|
|
345
386
|
...this.requestOptions,
|
|
346
|
-
url: `${this.
|
|
387
|
+
url: `${this.origin}${this.contextPath}${this.href.path}`,
|
|
347
388
|
params: this.href.getQuerystringForModularUI(),
|
|
348
389
|
locale: this.options.locale,
|
|
349
390
|
onProgress: this.onProgress,
|
|
@@ -520,7 +561,7 @@ class ModularUIRequest {
|
|
|
520
561
|
|
|
521
562
|
return universalFetch({
|
|
522
563
|
...this.requestOptions,
|
|
523
|
-
url: `${this.
|
|
564
|
+
url: `${this.origin}${this.contextPath}${href}`,
|
|
524
565
|
})
|
|
525
566
|
.then((response: Object) => {
|
|
526
567
|
if (isPlainObject(response)) {
|
|
@@ -588,7 +629,7 @@ class ModularUIRequest {
|
|
|
588
629
|
const validationHref = this.href.setParameter("commit", "false");
|
|
589
630
|
return universalFetch({
|
|
590
631
|
...this.requestOptions,
|
|
591
|
-
url: `${this.
|
|
632
|
+
url: `${this.origin}${this.contextPath}${this.href.path}`,
|
|
592
633
|
params: validationHref.getQuerystringForModularUI(),
|
|
593
634
|
data: this.getDynamicValidationData(model),
|
|
594
635
|
}).then((data) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { has } from "../utils/helpers/objects";
|
|
3
|
+
import { getBasePath } from "../constants";
|
|
3
4
|
|
|
4
5
|
import type Parameter from "../models/parameter/Parameter";
|
|
5
6
|
|
|
@@ -11,6 +12,8 @@ class ModularUIResponse {
|
|
|
11
12
|
_contributions: Object;
|
|
12
13
|
_locale: string = "en";
|
|
13
14
|
_parameters: Array<Parameter> = [];
|
|
15
|
+
_contextPath: string = getBasePath();
|
|
16
|
+
_origin: string = "";
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
*/
|
|
@@ -18,6 +21,8 @@ class ModularUIResponse {
|
|
|
18
21
|
key: string,
|
|
19
22
|
data: Object,
|
|
20
23
|
contributions: Object,
|
|
24
|
+
origin?: string,
|
|
25
|
+
contextPath?: string,
|
|
21
26
|
}): ModularUIResponse {
|
|
22
27
|
const response = new ModularUIResponse();
|
|
23
28
|
|
|
@@ -28,11 +33,37 @@ class ModularUIResponse {
|
|
|
28
33
|
response.key = input.key ?? contributionsKey;
|
|
29
34
|
response.data = input.data?.[dataKey];
|
|
30
35
|
response.contributions = input.contributions?.[contributionsKey];
|
|
36
|
+
response.origin = input.origin;
|
|
37
|
+
response.contextPath = input.contextPath;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
return response;
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
/**
|
|
44
|
+
*/
|
|
45
|
+
set origin(origin: ?string) {
|
|
46
|
+
this._origin = origin ?? "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*/
|
|
51
|
+
get origin(): string {
|
|
52
|
+
return this._origin;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
set contextPath(contextPath: ?string) {
|
|
58
|
+
this._contextPath = contextPath ?? getBasePath();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*/
|
|
63
|
+
get contextPath(): string {
|
|
64
|
+
return this._contextPath;
|
|
65
|
+
}
|
|
66
|
+
|
|
36
67
|
/**
|
|
37
68
|
*/
|
|
38
69
|
set locale(locale: string) {
|
|
@@ -100,9 +131,13 @@ class ModularUIResponse {
|
|
|
100
131
|
locale: string,
|
|
101
132
|
data: Object,
|
|
102
133
|
contributions: Object,
|
|
134
|
+
origin?: string,
|
|
135
|
+
contextPath?: string,
|
|
103
136
|
}): ModularUIResponse {
|
|
104
137
|
const modelData = new ModularUIResponse();
|
|
105
138
|
|
|
139
|
+
modelData.origin = data.origin;
|
|
140
|
+
modelData.contextPath = data.contextPath;
|
|
106
141
|
modelData.locale = data.locale;
|
|
107
142
|
modelData.key = data.key;
|
|
108
143
|
modelData.data = data.data;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import xhrMock from "xhr-mock";
|
|
2
|
+
|
|
3
|
+
import ModularUIRequest from "../ModularUIRequest";
|
|
4
|
+
|
|
5
|
+
import dataJSON from "./data.json";
|
|
6
|
+
import contributionsJSON from "./contributions.json";
|
|
7
|
+
|
|
8
|
+
import ApplicationModel from "../../models/application/ApplicationModel";
|
|
9
|
+
|
|
10
|
+
const JSON_TYPE = "application/json";
|
|
11
|
+
|
|
12
|
+
describe("modularUIRequest", () => {
|
|
13
|
+
// replace the real XHR object with the mock XHR object before each test
|
|
14
|
+
// eslint-disable-next-line jest/no-hooks
|
|
15
|
+
beforeEach(() => xhrMock.setup());
|
|
16
|
+
|
|
17
|
+
// put the real XHR object back and clear the mocks after each test
|
|
18
|
+
// eslint-disable-next-line jest/no-hooks
|
|
19
|
+
afterEach(() => xhrMock.teardown());
|
|
20
|
+
|
|
21
|
+
it("creates a model from a response with custom origin and contextPath", async () => {
|
|
22
|
+
expect.assertions(12);
|
|
23
|
+
xhrMock.get("http://www.example.com/custom-path/", (req, res) => {
|
|
24
|
+
expect(req.header("accept")).toBe(JSON_TYPE);
|
|
25
|
+
expect(req.header("Content-Type")).toBe(JSON_TYPE);
|
|
26
|
+
expect(req.header("accept-language")).toBe("en");
|
|
27
|
+
|
|
28
|
+
return res.status(200).body(dataJSON);
|
|
29
|
+
});
|
|
30
|
+
xhrMock.get(
|
|
31
|
+
"http://www.example.com/custom-path/contributions/",
|
|
32
|
+
(req, res) => {
|
|
33
|
+
expect(req.header("accept")).toBe(JSON_TYPE);
|
|
34
|
+
expect(req.header("Content-Type")).toBe(JSON_TYPE);
|
|
35
|
+
expect(req.header("accept-language")).toBe("en");
|
|
36
|
+
|
|
37
|
+
return res.status(200).body(contributionsJSON);
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const request = new ModularUIRequest("/", {
|
|
42
|
+
origin: "http://www.example.com",
|
|
43
|
+
contextPath: "/custom-path",
|
|
44
|
+
childmodels: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const model = await request.fetch();
|
|
48
|
+
expect(model).toBeInstanceOf(ApplicationModel);
|
|
49
|
+
expect(model.origin).toBe("http://www.example.com");
|
|
50
|
+
expect(model.contextPath).toBe("/custom-path");
|
|
51
|
+
expect(model.selfhref.absolutehref).toBe(
|
|
52
|
+
"http://www.example.com/custom-path/",
|
|
53
|
+
);
|
|
54
|
+
expect(model.modelcatalog.href.absolutehref).toBe(
|
|
55
|
+
"http://www.example.com/custom-path/modelcatalog",
|
|
56
|
+
);
|
|
57
|
+
expect(model.tabs.first.href.absolutehref).toBe(
|
|
58
|
+
"http://www.example.com/custom-path/books",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
{
|
|
2
|
+
"webapplication": {
|
|
3
|
+
"label": "Webapp",
|
|
4
|
+
"resourcetype": "Application",
|
|
5
|
+
"_links": {
|
|
6
|
+
"tab": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Books",
|
|
9
|
+
"label": "Books",
|
|
10
|
+
"resourcetype": "Tab",
|
|
11
|
+
"components": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Books",
|
|
14
|
+
"label": "Books",
|
|
15
|
+
"layouthint": ["CardView", "ListView", "TableView"],
|
|
16
|
+
"resourcetype": "CaseList"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "BooksByPersonRole",
|
|
20
|
+
"label": "Books by person role",
|
|
21
|
+
"resourcetype": "CaseList"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "BookPrints",
|
|
25
|
+
"label": "Book prints",
|
|
26
|
+
"resourcetype": "DatastoreList"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "LatestBooks",
|
|
30
|
+
"label": "Latest books",
|
|
31
|
+
"resourcetype": "DatastoreList"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Persons",
|
|
37
|
+
"label": "Persons",
|
|
38
|
+
"resourcetype": "Tab",
|
|
39
|
+
"components": [
|
|
40
|
+
{
|
|
41
|
+
"name": "Persons",
|
|
42
|
+
"label": "Persons",
|
|
43
|
+
"resourcetype": "CaseList"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "AuthorsAndCo_authors",
|
|
47
|
+
"label": "Authors and co-authors",
|
|
48
|
+
"resourcetype": "CaseList"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "InformationAboutAuthors",
|
|
52
|
+
"label": "Information about authors",
|
|
53
|
+
"resourcetype": "DatastoreList"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "PublishingHouses",
|
|
59
|
+
"label": "Publishing houses",
|
|
60
|
+
"resourcetype": "Tab",
|
|
61
|
+
"components": [
|
|
62
|
+
{
|
|
63
|
+
"name": "PublishingHouses",
|
|
64
|
+
"label": "Publishing houses",
|
|
65
|
+
"resourcetype": "CaseList"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "UT_Books",
|
|
71
|
+
"label": "UT_Books",
|
|
72
|
+
"resourcetype": "Tab",
|
|
73
|
+
"components": [
|
|
74
|
+
{
|
|
75
|
+
"name": "Books",
|
|
76
|
+
"label": "Books",
|
|
77
|
+
"resourcetype": "CaseList"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "BooksByPerson",
|
|
81
|
+
"label": "Books by person",
|
|
82
|
+
"resourcetype": "CaseList"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "BooksByPersonAndFormat",
|
|
86
|
+
"label": "Books by person and format",
|
|
87
|
+
"resourcetype": "CaseList"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "BooksByPersonRoleAndFormat",
|
|
91
|
+
"label": "Books by person role and format",
|
|
92
|
+
"resourcetype": "CaseList"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "BooksByPersonByLanguage",
|
|
96
|
+
"label": "Books by person by language",
|
|
97
|
+
"resourcetype": "CaseList"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "BooksByFormat",
|
|
101
|
+
"label": "Books by format",
|
|
102
|
+
"resourcetype": "CaseList"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "BooksByPublishingHouse",
|
|
106
|
+
"label": "Books by publishing house",
|
|
107
|
+
"resourcetype": "CaseList"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "BooksByYoungAuthors",
|
|
111
|
+
"label": "Books by young authors",
|
|
112
|
+
"resourcetype": "CaseList"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "BooksByYoungAuthorsNamedCoupland",
|
|
116
|
+
"label": "Books by young authors named Coupland",
|
|
117
|
+
"resourcetype": "CaseList"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "BooksPublishedByPublishingHouseLocatedInLondon",
|
|
121
|
+
"label": "Books published by publishing house located in London",
|
|
122
|
+
"resourcetype": "CaseList"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "BooksWithPublishingHouseCategoryYoungAdults",
|
|
126
|
+
"label": "Books with publishing house category Young adults",
|
|
127
|
+
"resourcetype": "CaseList"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "BooksByDeceasedAuthors",
|
|
131
|
+
"label": "Books by deceased authors",
|
|
132
|
+
"resourcetype": "CaseList"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "BooksWithLargeEditions",
|
|
136
|
+
"label": "Books with large editions",
|
|
137
|
+
"resourcetype": "CaseList"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "BooksWithPrintAssignments",
|
|
141
|
+
"label": "Books with print assignments",
|
|
142
|
+
"resourcetype": "CaseList"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "BooksFromAuthorsFromNewYork",
|
|
146
|
+
"label": "Books from authors from New York",
|
|
147
|
+
"resourcetype": "CaseList"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "BooksByAuthorFromNewYork",
|
|
151
|
+
"label": "Books by author from New York",
|
|
152
|
+
"resourcetype": "CaseList"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "BookPrints",
|
|
156
|
+
"label": "Book prints",
|
|
157
|
+
"resourcetype": "DatastoreList"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "LatestBooks",
|
|
161
|
+
"label": "Latest books",
|
|
162
|
+
"resourcetype": "DatastoreList"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "LatestBooksMultipleRecordTypes",
|
|
166
|
+
"label": "Latest books multiple record types",
|
|
167
|
+
"resourcetype": "DatastoreList"
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "UT_Persons",
|
|
173
|
+
"label": "UT_Persons",
|
|
174
|
+
"resourcetype": "Tab",
|
|
175
|
+
"components": [
|
|
176
|
+
{
|
|
177
|
+
"name": "Persons",
|
|
178
|
+
"label": "Persons",
|
|
179
|
+
"resourcetype": "CaseList"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "PersonsWithDetails",
|
|
183
|
+
"label": "Persons with details",
|
|
184
|
+
"resourcetype": "CaseList"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "PersonsByBookIndividual",
|
|
188
|
+
"label": "Persons by book (individual)",
|
|
189
|
+
"resourcetype": "CaseList"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "PersonsByBookDistinct",
|
|
193
|
+
"label": "Persons by book (distinct)",
|
|
194
|
+
"resourcetype": "CaseList"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "AuthorsByBookIndividual",
|
|
198
|
+
"label": "Authors by book (individual)",
|
|
199
|
+
"resourcetype": "CaseList"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "PersonsWithBooks",
|
|
203
|
+
"label": "Persons with books",
|
|
204
|
+
"resourcetype": "CaseList"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "PersonsLivingInLondon",
|
|
208
|
+
"label": "Persons living in London",
|
|
209
|
+
"resourcetype": "CaseList"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "AuthorsLivingInNewYork",
|
|
213
|
+
"label": "Authors living in New York",
|
|
214
|
+
"resourcetype": "CaseList"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "BooksAndPersonsRestrictedToNewYork",
|
|
218
|
+
"label": "Books and Persons restricted to New York",
|
|
219
|
+
"resourcetype": "CaseList"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "AuthorsByPublishingHouseFromLonden",
|
|
223
|
+
"label": "Authors by Publishing house from Londen",
|
|
224
|
+
"resourcetype": "CaseList"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "AuthorsByPublishingHouseFromLondenOrNrOfPages350",
|
|
228
|
+
"label": "Authors by Publishing house from Londen or Nr of Pages > 350",
|
|
229
|
+
"resourcetype": "CaseList"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "AuthorsWithBooksWithEditionPublishedAfter2013",
|
|
233
|
+
"label": "Authors with books with edition published after 2013",
|
|
234
|
+
"resourcetype": "CaseList"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "UT_PublishingHouses",
|
|
240
|
+
"label": "UT_Publishing houses",
|
|
241
|
+
"resourcetype": "Tab",
|
|
242
|
+
"components": [
|
|
243
|
+
{
|
|
244
|
+
"name": "PublishingHouses",
|
|
245
|
+
"label": "Publishing houses",
|
|
246
|
+
"resourcetype": "CaseList"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "UTBookPrints",
|
|
252
|
+
"label": "UT Book prints",
|
|
253
|
+
"resourcetype": "Tab",
|
|
254
|
+
"components": [
|
|
255
|
+
{
|
|
256
|
+
"name": "BookPrints",
|
|
257
|
+
"label": "Book prints",
|
|
258
|
+
"resourcetype": "DatastoreList"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": "BookPrintsOnePerPage",
|
|
262
|
+
"label": "Book prints (one per page)",
|
|
263
|
+
"resourcetype": "DatastoreList"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"name": "BookPrintsMaxOneResultInDetailMode",
|
|
267
|
+
"label": "Book prints (max one result in detail mode)",
|
|
268
|
+
"resourcetype": "DatastoreList"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "BookPrintsMaxOneResultInTableMode",
|
|
272
|
+
"label": "Book prints (max one result in table mode)",
|
|
273
|
+
"resourcetype": "DatastoreList"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"name": "BookPrintsSortedByPrintingHouse",
|
|
277
|
+
"label": "Book prints (sorted by printing house)",
|
|
278
|
+
"resourcetype": "DatastoreList"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "BookPrintsGroupedByBooksPrintedPrintingHouse",
|
|
282
|
+
"label": "Book prints (grouped by BooksPrinted, Printing house)",
|
|
283
|
+
"resourcetype": "DatastoreList"
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "UsersAndOrganizations",
|
|
289
|
+
"label": "Users and organizations",
|
|
290
|
+
"resourcetype": "Tab"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "RebuildDB",
|
|
294
|
+
"label": "Rebuild DB",
|
|
295
|
+
"resourcetype": "Tab"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"authentication": [
|
|
299
|
+
{
|
|
300
|
+
"name": "login",
|
|
301
|
+
"label": "Login",
|
|
302
|
+
"resourcetype": null
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"name": "UserServices",
|
|
306
|
+
"label": "Gebruikerservices",
|
|
307
|
+
"resourcetype": "user_services"
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|