@beinformed/ui 1.57.4 → 1.58.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 +14 -0
- package/esm/hooks/useModelCatalog.js +36 -5
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +1 -1
- 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/content/ContentModel.js +1 -1
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +1 -1
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +2 -1
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +4 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/redux/actions/EntryDate.js +8 -0
- package/esm/redux/actions/EntryDate.js.map +1 -0
- package/esm/redux/actions/index.js +1 -0
- package/esm/redux/actions/index.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +36 -0
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -0
- package/esm/redux/reducers/createReducer.js +2 -0
- package/esm/redux/reducers/createReducer.js.map +1 -1
- package/esm/redux/reducers/index.js +1 -0
- package/esm/redux/reducers/index.js.map +1 -1
- package/esm/redux/selectors/index.js +1 -0
- package/esm/redux/selectors/index.js.map +1 -1
- package/esm/redux/selectors/modelcatalog.js +8 -0
- package/esm/redux/selectors/modelcatalog.js.map +1 -0
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/helpers/createHref.js +10 -7
- package/esm/utils/helpers/createHref.js.map +1 -1
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +7 -6
- package/lib/hooks/useModelCatalog.js +38 -6
- package/lib/hooks/useModelCatalog.js.flow +39 -5
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.flow +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +1 -1
- package/lib/models/content/ContentModel.js.flow +1 -1
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +1 -1
- package/lib/models/content/ContentTOCModel.js.flow +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +2 -1
- package/lib/models/user/UserServicesModel.js.flow +6 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +4 -1
- package/lib/modularui/Authenticate.js.flow +4 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/redux/actions/EntryDate.js +15 -0
- package/lib/redux/actions/EntryDate.js.flow +12 -0
- package/lib/redux/actions/EntryDate.js.map +1 -0
- package/lib/redux/actions/index.js +11 -0
- package/lib/redux/actions/index.js.flow +1 -0
- package/lib/redux/actions/index.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +43 -0
- package/lib/redux/reducers/ModelCatalogReducer.js.flow +46 -0
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -0
- package/lib/redux/reducers/createReducer.js +2 -0
- package/lib/redux/reducers/createReducer.js.flow +4 -0
- package/lib/redux/reducers/createReducer.js.map +1 -1
- package/lib/redux/reducers/index.js +8 -0
- package/lib/redux/reducers/index.js.flow +1 -0
- package/lib/redux/reducers/index.js.map +1 -1
- package/lib/redux/selectors/index.js +11 -0
- package/lib/redux/selectors/index.js.flow +1 -0
- package/lib/redux/selectors/index.js.map +1 -1
- package/lib/redux/selectors/modelcatalog.js +15 -0
- package/lib/redux/selectors/modelcatalog.js.flow +11 -0
- package/lib/redux/selectors/modelcatalog.js.map +1 -0
- package/lib/redux/types.js.flow +11 -0
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -9
- package/lib/utils/helpers/createHref.js +10 -7
- package/lib/utils/helpers/createHref.js.flow +17 -9
- package/lib/utils/helpers/createHref.js.map +1 -1
- package/package.json +8 -8
- package/src/hooks/__tests__/useModelCatalog.spec.js +7 -6
- package/src/hooks/useModelCatalog.js +39 -5
- package/src/models/concepts/ConceptDetailModel.js +1 -1
- package/src/models/concepts/ConceptIndexModel.js +1 -1
- package/src/models/content/ContentModel.js +1 -1
- package/src/models/content/ContentTOCModel.js +1 -1
- package/src/models/user/UserServicesModel.js +6 -1
- package/src/modularui/Authenticate.js +4 -1
- package/src/redux/actions/EntryDate.js +12 -0
- package/src/redux/actions/index.js +1 -0
- package/src/redux/reducers/ModelCatalogReducer.js +46 -0
- package/src/redux/reducers/createReducer.js +4 -0
- package/src/redux/reducers/index.js +1 -0
- package/src/redux/selectors/index.js +1 -0
- package/src/redux/selectors/modelcatalog.js +11 -0
- package/src/redux/types.js +11 -0
- package/src/utils/helpers/__tests__/createHref.spec.js +13 -9
- package/src/utils/helpers/createHref.js +17 -9
- package/types/models/concepts/ConceptDetailModel.d.ts +1 -1
- package/types/models/concepts/ConceptIndexModel.d.ts +1 -1
- package/types/models/content/ContentModel.d.ts +1 -1
- package/types/models/content/ContentTOCModel.d.ts +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
+
import { useSelector, useDispatch } from "react-redux";
|
|
2
3
|
import { useLocation } from "./useRouter";
|
|
3
4
|
|
|
4
5
|
import { createHref, filterParameters } from "../utils/helpers/createHref";
|
|
@@ -14,8 +15,12 @@ import ContentModel from "../models/content/ContentModel";
|
|
|
14
15
|
import { useModularUIBasic } from "./useModularUIBasic";
|
|
15
16
|
import { ContentTypeModel } from "../models";
|
|
16
17
|
|
|
18
|
+
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
|
+
import { updateEntryDate } from "../redux/actions/EntryDate";
|
|
20
|
+
|
|
17
21
|
import type Href from "../models/href/Href";
|
|
18
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
|
+
import type { UpdateEntryDateAction } from "../redux";
|
|
19
24
|
export type SearchFilter = {
|
|
20
25
|
index?: string,
|
|
21
26
|
label?: string,
|
|
@@ -42,13 +47,15 @@ export const useConceptIndex = (
|
|
|
42
47
|
key?: string = "conceptindex",
|
|
43
48
|
options?: UseModularUIBasicOptions<ConceptIndexModel>,
|
|
44
49
|
): ?ConceptIndexModel => {
|
|
50
|
+
const { entryDate } = useEntryDate();
|
|
45
51
|
const url = filterParameters(href, [
|
|
46
|
-
"entryDate",
|
|
47
52
|
"index",
|
|
48
53
|
"label",
|
|
49
54
|
"modelcategory",
|
|
50
55
|
"type",
|
|
51
56
|
]);
|
|
57
|
+
url.setParameter("entryDate", entryDate);
|
|
58
|
+
|
|
52
59
|
return useModularUIBasic(key, url, {
|
|
53
60
|
expectedModels: ["ConceptIndex"],
|
|
54
61
|
targetModel: ConceptIndexModel,
|
|
@@ -65,9 +72,11 @@ export const useConceptDetail = (
|
|
|
65
72
|
ConceptDetailModel | BusinessScenarioModel,
|
|
66
73
|
>,
|
|
67
74
|
): ?ConceptDetailModel | ?BusinessScenarioModel => {
|
|
75
|
+
const { entryDate } = useEntryDate();
|
|
68
76
|
const location = useLocation();
|
|
69
77
|
|
|
70
|
-
const href = createHref("concepts", concept, location, [
|
|
78
|
+
const href = createHref("concepts", concept, entryDate, location, []);
|
|
79
|
+
|
|
71
80
|
return useModularUIBasic(key, href, {
|
|
72
81
|
expectedModels: ["ConceptDetail", "BusinessScenario"],
|
|
73
82
|
...options,
|
|
@@ -96,8 +105,11 @@ export const useContentTOC = (
|
|
|
96
105
|
key?: string = "contenttoc",
|
|
97
106
|
options?: UseModularUIBasicOptions<ContentTOCModel>,
|
|
98
107
|
): ?ContentTOCModel => {
|
|
108
|
+
const { entryDate } = useEntryDate();
|
|
99
109
|
const location = useLocation();
|
|
100
|
-
|
|
110
|
+
|
|
111
|
+
const href = createHref("content", content, entryDate, location, []);
|
|
112
|
+
|
|
101
113
|
return useModularUIBasic(key, href, {
|
|
102
114
|
expectedModels: ["ContentTOC"],
|
|
103
115
|
targetModel: ContentTOCModel,
|
|
@@ -112,7 +124,10 @@ export const useContent = (
|
|
|
112
124
|
key?: string = "content",
|
|
113
125
|
options?: UseModularUIBasicOptions<ContentModel>,
|
|
114
126
|
): ?ContentModel => {
|
|
115
|
-
const
|
|
127
|
+
const { entryDate } = useEntryDate();
|
|
128
|
+
|
|
129
|
+
const href = createHref("content", contentSection, entryDate, null, []);
|
|
130
|
+
|
|
116
131
|
return useModularUIBasic(key, href, {
|
|
117
132
|
expectedModels: ["Content"],
|
|
118
133
|
targetModel: ContentModel,
|
|
@@ -127,7 +142,10 @@ export const useContentType = (
|
|
|
127
142
|
key?: string = "contenttypes",
|
|
128
143
|
options?: UseModularUIBasicOptions<ContentTypeModel>,
|
|
129
144
|
): ?ContentTypeModel => {
|
|
130
|
-
const
|
|
145
|
+
const { entryDate } = useEntryDate();
|
|
146
|
+
|
|
147
|
+
const href = createHref("contenttypes", contentType, entryDate, null, []);
|
|
148
|
+
|
|
131
149
|
return useModularUIBasic(key, href, {
|
|
132
150
|
expectedModels: ["ContentType"],
|
|
133
151
|
targetModel: ContentTypeModel,
|
|
@@ -177,3 +195,19 @@ export const useContentSearch = (
|
|
|
177
195
|
const href = getSearchHref("/content", filters);
|
|
178
196
|
return useContentIndex(href, key, options);
|
|
179
197
|
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Retrieve and update the entrydate for the modelcatalog
|
|
201
|
+
*/
|
|
202
|
+
export const useEntryDate = (): ({
|
|
203
|
+
entryDate: ISO_DATE,
|
|
204
|
+
setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,
|
|
205
|
+
}) => {
|
|
206
|
+
const dispatch = useDispatch();
|
|
207
|
+
const entryDate = useSelector(getEntryDate);
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
entryDate,
|
|
211
|
+
setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),
|
|
212
|
+
};
|
|
213
|
+
};
|
|
@@ -328,7 +328,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
|
-
* Retrieve
|
|
331
|
+
* Retrieve modelcatalog.js
|
|
332
332
|
*/
|
|
333
333
|
get entryDate(): string | null {
|
|
334
334
|
return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;
|
|
@@ -125,7 +125,7 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Retrieve
|
|
128
|
+
* Retrieve modelcatalog.js of content toc
|
|
129
129
|
*/
|
|
130
130
|
get entryDate(): string | null {
|
|
131
131
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(
|
|
@@ -104,7 +104,7 @@ export default class ContentModel extends ResourceModel {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Retrieve
|
|
107
|
+
* Retrieve modelcatalog.js of content toc
|
|
108
108
|
*/
|
|
109
109
|
get entryDate(): ISO_DATE | null {
|
|
110
110
|
const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(
|
|
@@ -173,7 +173,7 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
* Retrieve
|
|
176
|
+
* Retrieve modelcatalog.js of content toc
|
|
177
177
|
*/
|
|
178
178
|
get entryDate(): ISO_DATE | null {
|
|
179
179
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
import UserModel from "../user/UserModel";
|
|
4
4
|
import ErrorResponse from "../error/ErrorResponse";
|
|
5
|
+
import Cache from "../../utils/browser/Cache";
|
|
5
6
|
|
|
6
7
|
import type { ModularUIModel } from "../types";
|
|
7
8
|
import type { ModularUIResponse } from "../../modularui";
|
|
@@ -112,7 +113,11 @@ class UserServicesModel extends ResourceModel {
|
|
|
112
113
|
const hasUser = this.user instanceof UserModel;
|
|
113
114
|
|
|
114
115
|
const UNSECURE_LINK_COUNT = 3;
|
|
115
|
-
return
|
|
116
|
+
return (
|
|
117
|
+
this.links.length > UNSECURE_LINK_COUNT ||
|
|
118
|
+
hasUser ||
|
|
119
|
+
Cache.getItem("basic-ok") === true
|
|
120
|
+
);
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
/**
|
|
@@ -158,7 +158,10 @@ class Authenticate {
|
|
|
158
158
|
doJaasAuthentication(username: string, password: string): Promise<any> {
|
|
159
159
|
return this.initLogin(true).then(() => {
|
|
160
160
|
if (this.isBasicAuthentication) {
|
|
161
|
-
|
|
161
|
+
Cache.removeItem("basic-ok");
|
|
162
|
+
return this.doBasicAuthentication(username, password).then(() => {
|
|
163
|
+
Cache.addItem("basic-ok", true);
|
|
164
|
+
});
|
|
162
165
|
}
|
|
163
166
|
return this.doFormLogin(username, password);
|
|
164
167
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import type { UpdateEntryDateAction } from "../types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Update the entry date being used in the modelcatalog
|
|
6
|
+
*/
|
|
7
|
+
export const updateEntryDate = (
|
|
8
|
+
entryDate: ISO_DATE,
|
|
9
|
+
): UpdateEntryDateAction => ({
|
|
10
|
+
type: "UPDATE_ENTRYDATE",
|
|
11
|
+
payload: entryDate,
|
|
12
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { DateUtil } from "../../utils";
|
|
3
|
+
import Cache from "../../utils/browser/Cache";
|
|
4
|
+
|
|
5
|
+
import type { Reducer } from "redux";
|
|
6
|
+
import type { ReduxAction, ModelCatalogState } from "../types";
|
|
7
|
+
|
|
8
|
+
const getQueryParam = (paramName: string): ?string => {
|
|
9
|
+
if (typeof window !== "undefined") {
|
|
10
|
+
const urlParams = new URLSearchParams(window.location?.search);
|
|
11
|
+
return urlParams.get(paramName);
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const initialState: ModelCatalogState = {
|
|
17
|
+
entryDate:
|
|
18
|
+
getQueryParam("entryDate") ||
|
|
19
|
+
Cache.getItem("ModelCatalogEntryDate") ||
|
|
20
|
+
DateUtil.now(),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Keep track of the entry date for the modelcatalog
|
|
25
|
+
*/
|
|
26
|
+
const ModelCatalogReducer: Reducer<ModelCatalogState, ReduxAction> = (
|
|
27
|
+
state = initialState,
|
|
28
|
+
action,
|
|
29
|
+
) => {
|
|
30
|
+
if (!action) {
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
switch (action.type) {
|
|
35
|
+
case "UPDATE_ENTRYDATE":
|
|
36
|
+
Cache.addItem("ModelCatalogEntryDate", action.payload);
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
entryDate: action.payload,
|
|
40
|
+
};
|
|
41
|
+
default:
|
|
42
|
+
return state;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default ModelCatalogReducer;
|
|
@@ -6,6 +6,7 @@ import { I18nReducer } from "../_i18n/I18nReducer";
|
|
|
6
6
|
import ModalsReducer from "./ModalsReducer";
|
|
7
7
|
import AuthReducer from "./AuthReducer";
|
|
8
8
|
import ErrorReducer from "./ErrorReducer";
|
|
9
|
+
import ModelCatalogReducer from "./ModelCatalogReducer";
|
|
9
10
|
import NotificationReducer from "./NotificationReducer";
|
|
10
11
|
import ProgressIndicatorReducer from "./ProgressIndicatorReducer";
|
|
11
12
|
import PreferencesReducer from "./PreferencesReducer";
|
|
@@ -19,6 +20,7 @@ import type {
|
|
|
19
20
|
ModalsState,
|
|
20
21
|
ErrorState,
|
|
21
22
|
AuthState,
|
|
23
|
+
ModelCatalogState,
|
|
22
24
|
} from "../types";
|
|
23
25
|
import type { RouterState } from "../_router/types";
|
|
24
26
|
import type { ModularUIState } from "../_modularui/types";
|
|
@@ -29,6 +31,7 @@ type Reducers = {
|
|
|
29
31
|
error: Reducer<ErrorState, ReduxAction>,
|
|
30
32
|
i18n: Reducer<I18nState, ReduxAction>,
|
|
31
33
|
modals: Reducer<ModalsState, ReduxAction>,
|
|
34
|
+
modelcatalog: Reducer<ModelCatalogState, ReduxAction>,
|
|
32
35
|
modularui: Reducer<ModularUIState, ReduxAction>,
|
|
33
36
|
notification: Reducer<NotificationState, ReduxAction>,
|
|
34
37
|
preferences: Reducer<PreferencesState, ReduxAction>,
|
|
@@ -45,6 +48,7 @@ export const createReducer = (): Reducers => ({
|
|
|
45
48
|
auth: AuthReducer,
|
|
46
49
|
error: ErrorReducer,
|
|
47
50
|
modals: ModalsReducer,
|
|
51
|
+
modelcatalog: ModelCatalogReducer,
|
|
48
52
|
notification: NotificationReducer,
|
|
49
53
|
progressindicator: ProgressIndicatorReducer,
|
|
50
54
|
preferences: PreferencesReducer,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export * from "./createReducer";
|
|
3
3
|
|
|
4
4
|
export { default as AuthReducer } from "./AuthReducer";
|
|
5
|
+
export { default as ModelCatalogReducer } from "./ModelCatalogReducer";
|
|
5
6
|
export { default as ErrorReducer } from "./ErrorReducer";
|
|
6
7
|
export { default as ModalsReducer } from "./ModalsReducer";
|
|
7
8
|
export { default as NotificationReducer } from "./NotificationReducer";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { DateUtil } from "../../utils";
|
|
3
|
+
|
|
4
|
+
import type { ReduxState } from "../types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve entrydate for the model catalog
|
|
8
|
+
*/
|
|
9
|
+
export const getEntryDate = (state: ReduxState): ISO_DATE => {
|
|
10
|
+
return state.modelcatalog?.entryDate ?? DateUtil.now();
|
|
11
|
+
};
|
package/src/redux/types.js
CHANGED
|
@@ -135,6 +135,11 @@ export type UpdateAutosaveAction = {
|
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
export type UpdateEntryDateAction = {
|
|
139
|
+
type: "UPDATE_ENTRYDATE",
|
|
140
|
+
payload: ISO_DATE,
|
|
141
|
+
};
|
|
142
|
+
|
|
138
143
|
export type ReduxAction =
|
|
139
144
|
| UpdateStatusAction
|
|
140
145
|
| SetModelAction
|
|
@@ -162,6 +167,7 @@ export type ReduxAction =
|
|
|
162
167
|
| ChangePasswordAction
|
|
163
168
|
| LogoutSuccessAction
|
|
164
169
|
| UpdateAutosaveAction
|
|
170
|
+
| UpdateEntryDateAction
|
|
165
171
|
| LocationChangeAction
|
|
166
172
|
| PushAction
|
|
167
173
|
| ReplaceAction
|
|
@@ -206,11 +212,16 @@ export type ProgressIndicatorState = {
|
|
|
206
212
|
+percentComplete: number,
|
|
207
213
|
};
|
|
208
214
|
|
|
215
|
+
export type ModelCatalogState = {
|
|
216
|
+
entryDate: ISO_DATE,
|
|
217
|
+
};
|
|
218
|
+
|
|
209
219
|
export type ReduxState = {
|
|
210
220
|
+router: RouterState,
|
|
211
221
|
+modularui: ModularUIState,
|
|
212
222
|
+i18n: I18nState,
|
|
213
223
|
+auth: AuthState,
|
|
224
|
+
+modelcatalog: ModelCatalogState,
|
|
214
225
|
+error: ErrorState,
|
|
215
226
|
+modals: ModalsState,
|
|
216
227
|
+notification: NotificationState,
|
|
@@ -7,25 +7,29 @@ describe("createHref", () => {
|
|
|
7
7
|
const location = {
|
|
8
8
|
search: "?entryDate=2024-03-08&index=C¬Allowed=true",
|
|
9
9
|
};
|
|
10
|
+
const expectedSearch = "?index=C¬Allowed=true&entryDate=2010-01-01";
|
|
10
11
|
|
|
11
12
|
expect(createHref("concepts", dynamicPart)).toEqual(
|
|
12
13
|
new Href("/concepts/" + dynamicPart),
|
|
13
14
|
);
|
|
14
|
-
expect(createHref("concepts", dynamicPart, location)).toEqual(
|
|
15
|
-
new Href("/concepts/" + dynamicPart +
|
|
15
|
+
expect(createHref("concepts", dynamicPart, "2010-01-01", location)).toEqual(
|
|
16
|
+
new Href("/concepts/" + dynamicPart + expectedSearch),
|
|
16
17
|
);
|
|
17
18
|
expect(
|
|
18
|
-
createHref("concepts", dynamicPart, location, ["
|
|
19
|
+
createHref("concepts", dynamicPart, "2010-01-01", location, ["index"]),
|
|
19
20
|
).toEqual(
|
|
20
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
21
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
21
22
|
);
|
|
22
23
|
expect(
|
|
23
|
-
createHref(
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
createHref(
|
|
25
|
+
"concepts",
|
|
26
|
+
dynamicPart + location.search,
|
|
27
|
+
"2010-01-01",
|
|
28
|
+
location,
|
|
29
|
+
["index"],
|
|
30
|
+
),
|
|
27
31
|
).toEqual(
|
|
28
|
-
new Href("/concepts/" + dynamicPart + "?entryDate=
|
|
32
|
+
new Href("/concepts/" + dynamicPart + "?index=C&entryDate=2010-01-01"),
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
expect(createHref("concepts", dynamicPart + "#hash")).toEqual(
|
|
@@ -77,6 +77,7 @@ export const filterParameters = (
|
|
|
77
77
|
export const createHref = (
|
|
78
78
|
context: string,
|
|
79
79
|
dynamicPart: string | Href,
|
|
80
|
+
entryDate?: ISO_DATE,
|
|
80
81
|
location?: ?Location,
|
|
81
82
|
allowedParameters?: Array<string>,
|
|
82
83
|
): Href => {
|
|
@@ -95,15 +96,22 @@ export const createHref = (
|
|
|
95
96
|
href = `${href}?${search}`;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
const finalHref =
|
|
100
|
+
dynamicPart instanceof Href
|
|
101
|
+
? filterParameters(
|
|
102
|
+
new Href(href, dynamicPart.resourcetype, {
|
|
103
|
+
origin: dynamicPart.origin,
|
|
104
|
+
contextPath: dynamicPart.contextPath,
|
|
105
|
+
}),
|
|
106
|
+
allowedParameters,
|
|
107
|
+
)
|
|
108
|
+
: filterParameters(href, allowedParameters);
|
|
109
|
+
|
|
110
|
+
if (entryDate) {
|
|
111
|
+
finalHref.setParameter("entryDate", entryDate);
|
|
112
|
+
} else {
|
|
113
|
+
finalHref.removeParameter("entryDate");
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
return
|
|
116
|
+
return finalHref;
|
|
109
117
|
};
|
|
@@ -60,7 +60,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
60
60
|
*/
|
|
61
61
|
getSourceReferencesForCurrentLanguage(availableLocales: Array<string>): Array<Object>;
|
|
62
62
|
/**
|
|
63
|
-
* Retrieve
|
|
63
|
+
* Retrieve modelcatalog.js
|
|
64
64
|
*/
|
|
65
65
|
get entryDate(): string;
|
|
66
66
|
/**
|