orc-shared 1.2.0-dev.1 → 1.2.0-dev.13
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/actions/applications.js +1 -1
- package/dist/actions/authentication.js +1 -1
- package/dist/actions/countries.js +1 -1
- package/dist/actions/locale.js +1 -1
- package/dist/actions/makeApiAction.js +3 -3
- package/dist/actions/makeOrcApiAction.js +2 -2
- package/dist/actions/metadata.js +3 -3
- package/dist/actions/modules.js +63 -1
- package/dist/actions/navigation.js +3 -3
- package/dist/actions/requestsApi.js +8 -8
- package/dist/actions/scopes.js +59 -22
- package/dist/actions/timezones.js +1 -1
- package/dist/actions/toasts.js +1 -1
- package/dist/actions/versionInfo.js +1 -1
- package/dist/actions/view.js +1 -1
- package/dist/buildStore.js +3 -3
- package/dist/components/AppFrame/About.js +11 -6
- package/dist/components/AppFrame/MenuItem.js +6 -15
- package/dist/components/AppFrame/Preferences.js +3 -3
- package/dist/components/AppFrame/Sidebar.js +20 -9
- package/dist/components/AppFrame/Topbar.js +1 -1
- package/dist/components/ApplicationModuleLoader.js +143 -0
- package/dist/components/Authenticate.js +13 -13
- package/dist/components/CategoryList.js +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/DropMenu/Menu.js +1 -1
- package/dist/components/DropMenu/index.js +1 -1
- package/dist/components/Form/FieldList.js +3 -3
- package/dist/components/Form/Form.js +1 -1
- package/dist/components/Form/Inputs/Button.js +1 -1
- package/dist/components/Form/Inputs/FieldButtons.js +1 -1
- package/dist/components/Form/Inputs/Number.js +1 -1
- package/dist/components/Form/Inputs/ReadOnly.js +1 -1
- package/dist/components/Form/Inputs/SmallButton.js +1 -1
- package/dist/components/Form/Inputs/Text.js +1 -1
- package/dist/components/Form/Inputs/Time.js +1 -1
- package/dist/components/Form/Inputs/Toggles.js +1 -1
- package/dist/components/Form/Inputs/Translation.js +3 -3
- package/dist/components/List/HeadCell.js +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/List/Row.js +1 -1
- package/dist/components/List/enhanceColumnDefs.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/Table.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +3 -3
- package/dist/components/MaterialUI/Feedback/useNotification.js +1 -1
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/InputBase.js +42 -5
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/RadioProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/Select.js +2 -2
- package/dist/components/MaterialUI/Inputs/SelectProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +3 -3
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/TimePicker.js +1 -1
- package/dist/components/MaterialUI/Inputs/createInput.js +3 -3
- package/dist/components/MaterialUI/Inputs/index.js +1 -1
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +1 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +1 -1
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +113 -0
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +8 -2
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +1 -1
- package/dist/components/MaterialUI/Surfaces/paperProps.js +1 -1
- package/dist/components/MaterialUI/muiThemes.js +7 -2
- package/dist/components/MaterialUI/textProps.js +1 -1
- package/dist/components/Modules.js +126 -41
- package/dist/components/MultiSelector.js +1 -1
- package/dist/components/Navigation/Bar.js +3 -3
- package/dist/components/Navigation/Tab.js +1 -1
- package/dist/components/Navigation/useNavigationState.js +3 -3
- package/dist/components/Placeholder.js +1 -1
- package/dist/components/Routing/FullPage.js +3 -1
- package/dist/components/Routing/Page.js +5 -3
- package/dist/components/Routing/Segment.js +1 -1
- package/dist/components/Routing/SegmentPage.js +1 -1
- package/dist/components/Routing/withWaypointing.js +8 -4
- package/dist/components/Scope/ScopeNode.js +1 -1
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +3 -3
- package/dist/components/Scope/useScopeConfirmationModalState.js +7 -16
- package/dist/components/Scope/useScopeData.js +4 -13
- package/dist/components/Scope/useScopeSelect.js +1 -1
- package/dist/components/Selector.js +1 -1
- package/dist/components/Spritesheet.js +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/ToastList.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Treeview/Label.js +1 -1
- package/dist/components/Treeview/Leaf.js +1 -1
- package/dist/components/Treeview/Node.js +3 -3
- package/dist/components/Treeview/index.js +2 -2
- package/dist/components/Treeview/settings.js +1 -1
- package/dist/constants.js +19 -2
- package/dist/content/icons/lock.svg +3 -0
- package/dist/content/icons/orckestra-icon.svg +5 -0
- package/dist/content/icons/unlock.svg +3 -0
- package/dist/content/iconsSheet.svg +11 -0
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/getThemeOverrides.js +2 -2
- package/dist/hocs/withInfiniteScroll.js +1 -1
- package/dist/hocs/withUpdateHandler.js +2 -2
- package/dist/hooks/useDispatchWithModulesData.js +1 -1
- package/dist/hooks/useEditState.js +3 -3
- package/dist/hooks/useEntityLoader.js +2 -2
- package/dist/hooks/useFullEntityEditState.js +3 -3
- package/dist/hooks/useLabelMessage.js +3 -3
- package/dist/hooks/useMultipleFieldEditState.js +2 -2
- package/dist/hooks/useNavigationHandler.js +1 -1
- package/dist/hooks/useNotificationRequestState.js +2 -2
- package/dist/hooks/useSelectorAndUnwrap.js +1 -1
- package/dist/reducers/metadata.js +1 -1
- package/dist/reducers/modules.js +39 -1
- package/dist/reducers/scopes.js +27 -0
- package/dist/reducers/settings.js +31 -2
- package/dist/schemas/countries.js +1 -1
- package/dist/schemas/definitions.js +1 -1
- package/dist/schemas/metadata.js +1 -1
- package/dist/schemas/productDefinitions.js +1 -1
- package/dist/schemas/timezones.js +1 -1
- package/dist/selectors/applications.js +1 -1
- package/dist/selectors/authentication.js +57 -18
- package/dist/selectors/countries.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +16 -6
- package/dist/selectors/modules.js +15 -1
- package/dist/selectors/navigation.js +1 -1
- package/dist/selectors/requests.js +1 -1
- package/dist/selectors/scope.js +8 -1
- package/dist/selectors/settings.js +13 -1
- package/dist/selectors/versionInfo.js +1 -1
- package/dist/selectors/view.js +1 -1
- package/dist/spawnerMiddleware.js +1 -1
- package/dist/utils/displayModeHelper.js +1 -1
- package/dist/utils/flatten.js +2 -2
- package/dist/utils/localizationHelper.js +1 -1
- package/dist/utils/mapHelper.js +1 -1
- package/dist/utils/modelValidationHelper.js +1 -1
- package/dist/utils/parseHelper.js +1 -1
- package/dist/utils/propertyHelper.js +2 -2
- package/dist/utils/propertyValidator.js +1 -1
- package/dist/utils/setTranslation.js +27 -1
- package/dist/utils/setTranslationWithFallback.js +31 -2
- package/dist/utils/testUtils.js +2 -1
- package/dist/utils/unwrapImmutable.js +1 -1
- package/dist/utils/urlHelper.js +1 -1
- package/package.json +6 -5
- package/src/actions/modules.js +30 -0
- package/src/actions/modules.test.js +50 -1
- package/src/actions/scopes.js +33 -7
- package/src/actions/scopes.test.js +84 -14
- package/src/components/AppFrame/About.js +10 -3
- package/src/components/AppFrame/AppFrame.test.js +9 -0
- package/src/components/AppFrame/MenuItem.js +3 -5
- package/src/components/AppFrame/MenuItem.test.js +2 -24
- package/src/components/AppFrame/Sidebar.js +11 -12
- package/src/components/AppFrame/Sidebar.test.js +18 -0
- package/src/components/ApplicationModuleLoader.js +52 -0
- package/src/components/ApplicationModuleLoader.test.js +149 -0
- package/src/components/Authenticate.js +5 -4
- package/src/components/Authenticate.test.js +23 -4
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +7 -1
- package/src/components/MaterialUI/Inputs/InputBase.js +19 -2
- package/src/components/MaterialUI/Inputs/InputBase.test.js +68 -0
- package/src/components/MaterialUI/Navigation/ExternalLink.js +25 -0
- package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +5 -1
- package/src/components/MaterialUI/muiThemes.js +5 -0
- package/src/components/Modules.js +103 -20
- package/src/components/Modules.test.js +315 -28
- package/src/components/Provision.test.js +34 -0
- package/src/components/Routing/FullPage.js +2 -1
- package/src/components/Routing/FullPage.test.js +23 -0
- package/src/components/Routing/Page.js +2 -2
- package/src/components/Routing/Page.test.js +20 -0
- package/src/components/Routing/Segment.js +1 -1
- package/src/components/Routing/withWaypointing.js +2 -2
- package/src/components/Routing/withWaypointing.test.js +33 -5
- package/src/components/Scope/Scope.test.js +4 -0
- package/src/components/Scope/useScopeConfirmationModalState.js +5 -16
- package/src/components/Scope/useScopeConfirmationModalState.test.js +39 -13
- package/src/components/Scope/useScopeData.js +0 -3
- package/src/components/Scope/useScopeData.test.js +0 -27
- package/src/constants.js +15 -0
- package/src/content/icons/lock.svg +3 -0
- package/src/content/icons/orckestra-icon.svg +5 -0
- package/src/content/icons/unlock.svg +3 -0
- package/src/content/iconsSheet.svg +11 -0
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hocs/withScopeData.test.js +0 -31
- package/src/reducers/modules.js +48 -2
- package/src/reducers/modules.test.js +117 -2
- package/src/reducers/scopes.js +30 -0
- package/src/reducers/scopes.test.js +45 -1
- package/src/reducers/settings.js +26 -2
- package/src/reducers/settings.test.js +74 -6
- package/src/selectors/authentication.js +53 -27
- package/src/selectors/authentication.test.js +600 -12
- package/src/selectors/metadata.js +18 -7
- package/src/selectors/metadata.test.js +221 -283
- package/src/selectors/modules.js +7 -0
- package/src/selectors/modules.test.js +16 -1
- package/src/selectors/scope.js +3 -1
- package/src/selectors/scope.test.js +5 -0
- package/src/selectors/settings.js +6 -0
- package/src/translations/en-US.json +1 -1
- package/src/translations/fr-CA.json +1 -1
- package/src/utils/setTranslation.js +16 -1
- package/src/utils/setTranslation.test.js +24 -0
- package/src/utils/setTranslationWithFallback.js +18 -1
- package/src/utils/setTranslationWithFallback.test.js +108 -0
|
@@ -96,4 +96,28 @@ describe("setTranslation", () => {
|
|
|
96
96
|
hat: { name: "it-name" },
|
|
97
97
|
}),
|
|
98
98
|
));
|
|
99
|
+
|
|
100
|
+
it("returns first not empty match by language if language-culture not found", () =>
|
|
101
|
+
expect(
|
|
102
|
+
setTranslation,
|
|
103
|
+
"when called with",
|
|
104
|
+
[
|
|
105
|
+
"en-US",
|
|
106
|
+
Immutable.fromJS({
|
|
107
|
+
hat: {
|
|
108
|
+
name: {
|
|
109
|
+
"en-CA": "",
|
|
110
|
+
"fr-CA": "fr CA name",
|
|
111
|
+
"en-GB": "en GB name",
|
|
112
|
+
"it-IT": "it-name",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
["hat", "name"],
|
|
117
|
+
],
|
|
118
|
+
"to equal",
|
|
119
|
+
Immutable.fromJS({
|
|
120
|
+
hat: { name: "en GB name" },
|
|
121
|
+
}),
|
|
122
|
+
));
|
|
99
123
|
});
|
|
@@ -2,7 +2,24 @@ import { flatten } from "./flatten";
|
|
|
2
2
|
|
|
3
3
|
export const setTranslationWithFallbackValue = (locale, obj, fallbackValue, ...field) => {
|
|
4
4
|
if (!obj) return obj;
|
|
5
|
-
|
|
5
|
+
let localeValue = obj.getIn(flatten([field, locale]));
|
|
6
|
+
if (!localeValue && locale.includes("-")) {
|
|
7
|
+
let fieldValue = obj.getIn(flatten([field]));
|
|
8
|
+
if (fieldValue) {
|
|
9
|
+
let fieldKeys = fieldValue.keys();
|
|
10
|
+
let language = locale.substring(0, locale.indexOf("-"));
|
|
11
|
+
|
|
12
|
+
for (let key of fieldKeys) {
|
|
13
|
+
if (key !== locale && key.startsWith(language)) {
|
|
14
|
+
localeValue = obj.getIn(flatten([field, key]));
|
|
15
|
+
if (localeValue) {
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const value = localeValue || fallbackValue || "";
|
|
6
23
|
return obj.setIn(flatten([field]), value);
|
|
7
24
|
};
|
|
8
25
|
|
|
@@ -147,4 +147,112 @@ describe("setTranslationWithFallbackValue", () => {
|
|
|
147
147
|
"to equal",
|
|
148
148
|
null,
|
|
149
149
|
));
|
|
150
|
+
|
|
151
|
+
it("returns value matched by language-culture when exist", () =>
|
|
152
|
+
expect(
|
|
153
|
+
setTranslationWithFallbackValue,
|
|
154
|
+
"when called with",
|
|
155
|
+
[
|
|
156
|
+
"en-US",
|
|
157
|
+
Immutable.fromJS({
|
|
158
|
+
hat: { name: { "en-US": "en-US Name", "en-GB": "en-GB Name" } },
|
|
159
|
+
}),
|
|
160
|
+
"fallbakValue",
|
|
161
|
+
["hat", "name"],
|
|
162
|
+
],
|
|
163
|
+
"to equal",
|
|
164
|
+
Immutable.fromJS({
|
|
165
|
+
hat: { name: "en-US Name" },
|
|
166
|
+
}),
|
|
167
|
+
));
|
|
168
|
+
|
|
169
|
+
it("returns value matched by language when match by language-culture does not exist", () =>
|
|
170
|
+
expect(
|
|
171
|
+
setTranslationWithFallbackValue,
|
|
172
|
+
"when called with",
|
|
173
|
+
[
|
|
174
|
+
"en-US",
|
|
175
|
+
Immutable.fromJS({
|
|
176
|
+
hat: { name: { "en-GB": "en-GB Name" } },
|
|
177
|
+
}),
|
|
178
|
+
"fallbakValue",
|
|
179
|
+
["hat", "name"],
|
|
180
|
+
],
|
|
181
|
+
"to equal",
|
|
182
|
+
Immutable.fromJS({
|
|
183
|
+
hat: { name: "en-GB Name" },
|
|
184
|
+
}),
|
|
185
|
+
));
|
|
186
|
+
|
|
187
|
+
it("returns first not empty value matched by language when match by language-culture does not exist", () =>
|
|
188
|
+
expect(
|
|
189
|
+
setTranslationWithFallbackValue,
|
|
190
|
+
"when called with",
|
|
191
|
+
[
|
|
192
|
+
"en-US",
|
|
193
|
+
Immutable.fromJS({
|
|
194
|
+
hat: { name: { "en-GB": "", "en-CA": "en-CA Name" } },
|
|
195
|
+
}),
|
|
196
|
+
"fallbakValue",
|
|
197
|
+
["hat", "name"],
|
|
198
|
+
],
|
|
199
|
+
"to equal",
|
|
200
|
+
Immutable.fromJS({
|
|
201
|
+
hat: { name: "en-CA Name" },
|
|
202
|
+
}),
|
|
203
|
+
));
|
|
204
|
+
|
|
205
|
+
it("returns value fallback value when match by language-culture and language does not exist", () =>
|
|
206
|
+
expect(
|
|
207
|
+
setTranslationWithFallbackValue,
|
|
208
|
+
"when called with",
|
|
209
|
+
[
|
|
210
|
+
"en-GB",
|
|
211
|
+
Immutable.fromJS({
|
|
212
|
+
hat: { name: { "fr-CA": "fr-CA Name" } },
|
|
213
|
+
}),
|
|
214
|
+
"fallbakValue",
|
|
215
|
+
["hat", "name"],
|
|
216
|
+
],
|
|
217
|
+
"to equal",
|
|
218
|
+
Immutable.fromJS({
|
|
219
|
+
hat: { name: "fallbakValue" },
|
|
220
|
+
}),
|
|
221
|
+
));
|
|
222
|
+
|
|
223
|
+
it("returns fallbak Value when field value is empty ", () =>
|
|
224
|
+
expect(
|
|
225
|
+
setTranslationWithFallbackValue,
|
|
226
|
+
"when called with",
|
|
227
|
+
[
|
|
228
|
+
"en-GB",
|
|
229
|
+
Immutable.fromJS({
|
|
230
|
+
hat: { name: {} },
|
|
231
|
+
}),
|
|
232
|
+
"fallbakValue",
|
|
233
|
+
["hat", "name"],
|
|
234
|
+
],
|
|
235
|
+
"to equal",
|
|
236
|
+
Immutable.fromJS({
|
|
237
|
+
hat: { name: "fallbakValue" },
|
|
238
|
+
}),
|
|
239
|
+
));
|
|
240
|
+
|
|
241
|
+
it("returns fallbakValue when field is undefined ", () =>
|
|
242
|
+
expect(
|
|
243
|
+
setTranslationWithFallbackValue,
|
|
244
|
+
"when called with",
|
|
245
|
+
[
|
|
246
|
+
"en-GB",
|
|
247
|
+
Immutable.fromJS({
|
|
248
|
+
hat: { name: {} },
|
|
249
|
+
}),
|
|
250
|
+
"fallbakValue",
|
|
251
|
+
["hat", "name2"],
|
|
252
|
+
],
|
|
253
|
+
"to equal",
|
|
254
|
+
Immutable.fromJS({
|
|
255
|
+
hat: { name: {}, name2: "fallbakValue" },
|
|
256
|
+
}),
|
|
257
|
+
));
|
|
150
258
|
});
|