@orchestrator-ui/orchestrator-ui-components 0.1.2 → 0.2.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.
@@ -1,13 +1,11 @@
1
- yarn run v1.22.19
2
1
  $ tsup src/index.ts --format esm --dts
3
2
  CLI Building entry: src/index.ts
4
3
  CLI Using tsconfig: tsconfig.json
5
4
  CLI tsup v7.1.0
6
5
  CLI Target: node16
7
6
  ESM Build start
8
- ESM dist\index.js 107.51 KB
9
- ESM ⚡️ Build success in 63ms
7
+ ESM dist\index.js 111.65 KB
8
+ ESM ⚡️ Build success in 90ms
10
9
  DTS Build start
11
- DTS ⚡️ Build success in 3479ms
12
- DTS dist\index.d.ts 24.01 KB
13
- Done in 4.10s.
10
+ DTS ⚡️ Build success in 3670ms
11
+ DTS dist\index.d.ts 24.53 KB
@@ -1,4 +1,3 @@
1
- yarn run v1.22.19
2
1
  $ eslint "src/**/*.ts*"
3
2
 
4
3
  C:\development\surf\orchestrator-ui\packages\orchestrator-ui-components\src\components\OrchestratorPageTemplate\OrchestratorPageHeader\OrchestratorPageHeader.stories.tsx
@@ -8,10 +7,9 @@ C:\development\surf\orchestrator-ui\packages\orchestrator-ui-components\src\comp
8
7
  17:17 warning Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
9
8
 
10
9
  C:\development\surf\orchestrator-ui\packages\orchestrator-ui-components\src\components\Table\DataGridTable\DataGridTable.tsx
11
- (node:21240) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\development\surf\orchestrator-ui\node_modules\@orchestrator-ui\eslint-config-custom\package.json' of './dist/index.js'. Please either fix that or report it to the module author
12
- (Use `node --trace-deprecation ...` to show where the warning was created)
13
10
  103:28 warning 'props' is defined but never used @typescript-eslint/no-unused-vars
14
11
 
15
12
  ✖ 3 problems (0 errors, 3 warnings)
16
13
 
17
- Done in 2.65s.
14
+ (node:11940) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\development\surf\orchestrator-ui\node_modules\@orchestrator-ui\eslint-config-custom\package.json' of './dist/index.js'. Please either fix that or report it to the module author
15
+ (Use `node --trace-deprecation ...` to show where the warning was created)
@@ -1,19 +1,19 @@
1
1
  yarn run v1.22.19
2
2
  $ jest
3
- PASS Orchestrator UI Components Tests src/utils/getTokenName.spec.ts
4
- PASS Orchestrator UI Components Tests src/utils/date.spec.ts
5
- PASS Orchestrator UI Components Tests src/utils/uuid.spec.ts
6
- PASS Orchestrator UI Components Tests src/components/Table/utils/tableUtils.spec.ts
7
- PASS Orchestrator UI Components Tests src/components/Table/utils/tableConfigPersistence.spec.ts
8
- PASS Orchestrator UI Components Tests src/components/Table/DataGridTable/dataGridColumns.spec.ts
9
3
  PASS Orchestrator UI Components Tests src/utils/getTypedFieldFromObject.spec.ts
4
+ PASS Orchestrator UI Components Tests src/components/Table/DataGridTable/dataGridColumns.spec.ts
5
+ PASS Orchestrator UI Components Tests src/utils/uuid.spec.ts
10
6
  PASS Orchestrator UI Components Tests src/utils/string.spec.ts
7
+ PASS Orchestrator UI Components Tests src/components/Table/utils/tableConfigPersistence.spec.ts
11
8
  PASS Orchestrator UI Components Tests src/components/Table/utils/columns.spec.ts
9
+ PASS Orchestrator UI Components Tests src/utils/getTokenName.spec.ts
10
+ PASS Orchestrator UI Components Tests src/components/Table/utils/tableUtils.spec.ts
11
+ PASS Orchestrator UI Components Tests src/utils/date.spec.ts
12
12
  PASS Orchestrator UI Components Tests src/components/SubscriptionsTabs/getSubscriptionsTabTypeFromString.spec.ts
13
13
 
14
14
  Test Suites: 10 passed, 10 total
15
15
  Tests: 50 passed, 50 total
16
16
  Snapshots: 0 total
17
- Time: 3.948 s
17
+ Time: 4.16 s
18
18
  Ran all test suites.
19
- Done in 5.07s.
19
+ Done in 5.13s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @orchestrator-ui/orchestrator-ui-components
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6c4cb21: Added translation setup and next-inl configuration. Translation strings are now available when using the useTranslations hook. For more on how to add translations refer to apps/wfo-ui/translations/README.md
8
+
3
9
  ## 0.1.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { Criteria } from '@elastic/eui/src/components/basic_table/basic_table';
10
10
  import * as react_query from 'react-query';
11
11
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
12
12
  import { Variables } from 'graphql-request/build/cjs/types';
13
+ import { AbstractIntlMessages } from 'next-intl';
13
14
 
14
15
  type BadgeProps = EuiBadgeProps & {
15
16
  textColor: TextColor | string;
@@ -202,6 +203,10 @@ type GraphqlQueryVariables<Type> = {
202
203
  interface CacheOption {
203
204
  value: string;
204
205
  label: string;
206
+ }
207
+ declare enum Locale {
208
+ enUS = "en-Us",
209
+ nlNL = "nl-NL"
205
210
  }
206
211
 
207
212
  interface Subscription {
@@ -248,6 +253,7 @@ declare const SubscriptionBlock: (title: string, data: object) => _emotion_react
248
253
 
249
254
  declare const SubscriptionDetailTree: () => _emotion_react_jsx_runtime.JSX.Element | null;
250
255
 
256
+ /** TODO: Adding a useTranslations hook here leads to an hooks error. https://github.com/workfloworchestrator/orchestrator-ui/issues/177 */
251
257
  declare const SubscriptionGeneral: () => _emotion_react_jsx_runtime.JSX.Element;
252
258
 
253
259
  declare enum SubscriptionsTabType {
@@ -262,7 +268,7 @@ type FilterQuery = {
262
268
  };
263
269
  type SubscriptionsTab = {
264
270
  id: SubscriptionsTabType;
265
- name: string;
271
+ translationKey: string;
266
272
  alwaysOnFilters?: FilterQuery[];
267
273
  };
268
274
  declare const defaultSubscriptionsTabs: SubscriptionsTab[];
@@ -618,4 +624,7 @@ type TreeProviderProps = {
618
624
  };
619
625
  declare const TreeProvider: React.FC<TreeProviderProps>;
620
626
 
621
- export { ArrowNarrowDown, ArrowNarrowUp, Badge, BadgeProps, BasicTableColumn, Breadcrumbs, CacheNames, CacheOption, CheckmarkCircleFill, ChevronDown, ColumnConfig, ControlColumn, CustomerBase, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZES, DUTCH_LOCALE, DataDisplayParams, DataDisplayReturnValues, DataGridTable, DataGridTableColumns, DataGridTableProps, DataSorting, EngineStatus, EngineStatusBadge, EngineStatusValue, Environment, EnvironmentBadge, ExternalServiceBase, FailedTasksBadge, Field, FilterQuery, FixedInputBlock, FixedInputsBase, FrequentlyUsed, FrequentlyUsedProps, GlobalStatus, GraphQLSort, GraphqlFilter, GraphqlQueryVariables, HeaderBadge, HeaderBadgeProps, IconProps, ItemsList, ListItemStartPage, ListItemStartPageProps, Loading, LocalStorageTableConfig, LogoutIcon, MinusCircleOutline, MultiListSection, NewProcessPanel, Nullable, OrchestratorConfig, OrchestratorConfigContext, OrchestratorConfigProvider, OrchestratorConfigProviderProps, OrchestratorPageHeader, OrchestratorPageHeaderProps, OrchestratorPageTemplate, OrchestratorPageTemplateProps, OrchestratorSidebar, Pagination, PlusCircleFill, Process$1 as Process, ProcessStatus, ProcessStatusBadge, ProcessStatusBadgeProps, ProcessStatusCounts, ProcessesTimeline, ProcessesTimelineProps, Product, ProductBase, ProductBlock, ProductBlockBase, RenderField, ResourceTypeBase, SearchField, SearchFieldProps, Settings, SettingsModal, SettingsModalProps, SortOrder, StatCards, StatusDotIcon, SubscriptionAction, SubscriptionActions$1 as SubscriptionActions, SubscriptionActionsProps, SubscriptionBlock, SubscriptionContext, SubscriptionContextType, SubscriptionDetailBase, SubscriptionDetailTree, SubscriptionGeneral, SubscriptionProcess, SubscriptionProvider, SubscriptionProviderProps, SubscriptionsTab, SubscriptionsTabType, SubscriptionsTabs, SubscriptionsTabsProps, Table, TableColumnKeys, TableColumns, TableColumnsWithControlColumns, TableColumnsWithExtraNonDataFields, TableConfig, TableControlColumnConfig, TableDataColumnConfig, TableHeaderCell, TableHeaderCellProps, TableProps, TableSettingsModal, TableSettingsModalProps, TableWithFilter, TableWithFilterProps, TotalStat, TreeBlock, TreeContext, TreeContextType, TreeProvider, TreeProviderProps, WFOProductBlockBadge, WFOProductBlockBadgeProps, WFOStatusBadge, WFOStatusBadgeProps, XCircleFill, clearTableConfigFromLocalStorage, defaultOrchestratorTheme, defaultSubscriptionsTabs, determineNewSortOrder, determinePageIndex, getDataSortHandler, getEsQueryStringHandler, getFirstUuidPart, getInitialColumnOrder, getPageChangeHandler, getSortDirectionFromString, getStatusBadgeColor, getSubscriptionsTabTypeFromString, getTableConfigFromLocalStorage, getTypedFieldFromObject, isUuid4, isValidLocalStorageTableConfig, mapColumnSortToEuiDataGridSorting, parseDate, parseDateToLocaleString, removeSuffix, setTableConfigToLocalStorage, upperCaseFirstChar, useCacheNames, useDataDisplayParams, useEngineStatusMutation, useEngineStatusQuery, useFavouriteSubscriptions, useOrchestratorConfig, useOrchestratorTheme, useProcessStatusCountsQuery, useProcessesAttention, useQueryWithGraphql, useRecentProcesses, useSubscriptionActions, useSubscriptionProcesses };
627
+ type TranslationMessagesMap = Map<Locale, AbstractIntlMessages>;
628
+ declare const getTranslationMessages: (locale: string | undefined, messages?: TranslationMessagesMap) => AbstractIntlMessages | undefined;
629
+
630
+ export { ArrowNarrowDown, ArrowNarrowUp, Badge, BadgeProps, BasicTableColumn, Breadcrumbs, CacheNames, CacheOption, CheckmarkCircleFill, ChevronDown, ColumnConfig, ControlColumn, CustomerBase, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZES, DUTCH_LOCALE, DataDisplayParams, DataDisplayReturnValues, DataGridTable, DataGridTableColumns, DataGridTableProps, DataSorting, EngineStatus, EngineStatusBadge, EngineStatusValue, Environment, EnvironmentBadge, ExternalServiceBase, FailedTasksBadge, Field, FilterQuery, FixedInputBlock, FixedInputsBase, FrequentlyUsed, FrequentlyUsedProps, GlobalStatus, GraphQLSort, GraphqlFilter, GraphqlQueryVariables, HeaderBadge, HeaderBadgeProps, IconProps, ItemsList, ListItemStartPage, ListItemStartPageProps, Loading, LocalStorageTableConfig, Locale, LogoutIcon, MinusCircleOutline, MultiListSection, NewProcessPanel, Nullable, OrchestratorConfig, OrchestratorConfigContext, OrchestratorConfigProvider, OrchestratorConfigProviderProps, OrchestratorPageHeader, OrchestratorPageHeaderProps, OrchestratorPageTemplate, OrchestratorPageTemplateProps, OrchestratorSidebar, Pagination, PlusCircleFill, Process$1 as Process, ProcessStatus, ProcessStatusBadge, ProcessStatusBadgeProps, ProcessStatusCounts, ProcessesTimeline, ProcessesTimelineProps, Product, ProductBase, ProductBlock, ProductBlockBase, RenderField, ResourceTypeBase, SearchField, SearchFieldProps, Settings, SettingsModal, SettingsModalProps, SortOrder, StatCards, StatusDotIcon, SubscriptionAction, SubscriptionActions$1 as SubscriptionActions, SubscriptionActionsProps, SubscriptionBlock, SubscriptionContext, SubscriptionContextType, SubscriptionDetailBase, SubscriptionDetailTree, SubscriptionGeneral, SubscriptionProcess, SubscriptionProvider, SubscriptionProviderProps, SubscriptionsTab, SubscriptionsTabType, SubscriptionsTabs, SubscriptionsTabsProps, Table, TableColumnKeys, TableColumns, TableColumnsWithControlColumns, TableColumnsWithExtraNonDataFields, TableConfig, TableControlColumnConfig, TableDataColumnConfig, TableHeaderCell, TableHeaderCellProps, TableProps, TableSettingsModal, TableSettingsModalProps, TableWithFilter, TableWithFilterProps, TotalStat, TranslationMessagesMap, TreeBlock, TreeContext, TreeContextType, TreeProvider, TreeProviderProps, WFOProductBlockBadge, WFOProductBlockBadgeProps, WFOStatusBadge, WFOStatusBadgeProps, XCircleFill, clearTableConfigFromLocalStorage, defaultOrchestratorTheme, defaultSubscriptionsTabs, determineNewSortOrder, determinePageIndex, getDataSortHandler, getEsQueryStringHandler, getFirstUuidPart, getInitialColumnOrder, getPageChangeHandler, getSortDirectionFromString, getStatusBadgeColor, getSubscriptionsTabTypeFromString, getTableConfigFromLocalStorage, getTranslationMessages, getTypedFieldFromObject, isUuid4, isValidLocalStorageTableConfig, mapColumnSortToEuiDataGridSorting, parseDate, parseDateToLocaleString, removeSuffix, setTableConfigToLocalStorage, upperCaseFirstChar, useCacheNames, useDataDisplayParams, useEngineStatusMutation, useEngineStatusQuery, useFavouriteSubscriptions, useOrchestratorConfig, useOrchestratorTheme, useProcessStatusCountsQuery, useProcessesAttention, useQueryWithGraphql, useRecentProcesses, useSubscriptionActions, useSubscriptionProcesses };
package/dist/index.js CHANGED
@@ -1718,6 +1718,7 @@ import {
1718
1718
  EuiSpacer as EuiSpacer10,
1719
1719
  EuiText as EuiText7
1720
1720
  } from "@elastic/eui";
1721
+ import { useTranslations } from "next-intl";
1721
1722
 
1722
1723
  // src/components/Subscription/styles.ts
1723
1724
  import { css } from "@emotion/react";
@@ -1748,6 +1749,7 @@ var RenderField = (field, data) => {
1748
1749
  return /* @__PURE__ */ jsx36("div", { children: data[field] });
1749
1750
  };
1750
1751
  var SubscriptionBlock = (title, data) => {
1752
+ const t = useTranslations("common");
1751
1753
  const keys = [];
1752
1754
  for (const key in data) {
1753
1755
  if (typeof data[key] !== "object") {
@@ -1761,7 +1763,7 @@ var SubscriptionBlock = (title, data) => {
1761
1763
  /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsxs25("div", { style: { marginTop: 5 }, children: [
1762
1764
  /* @__PURE__ */ jsxs25(EuiFlexGroup7, { justifyContent: "spaceBetween", children: [
1763
1765
  /* @__PURE__ */ jsx36(EuiFlexItem6, { children: /* @__PURE__ */ jsx36(EuiText7, { grow: false, children: /* @__PURE__ */ jsx36("h3", { children: title }) }) }),
1764
- /* @__PURE__ */ jsx36(EuiFlexItem6, { grow: false, children: /* @__PURE__ */ jsx36(EuiButtonEmpty2, { size: "s", iconType: "starEmpty", children: "Add to favorites" }) })
1766
+ /* @__PURE__ */ jsx36(EuiFlexItem6, { grow: false, children: /* @__PURE__ */ jsx36(EuiButtonEmpty2, { size: "s", iconType: "starEmpty", children: t("addToFavorites") }) })
1765
1767
  ] }),
1766
1768
  /* @__PURE__ */ jsx36(EuiSpacer10, { size: "s" }),
1767
1769
  /* @__PURE__ */ jsx36("table", { width: "100%", children: /* @__PURE__ */ jsxs25("tbody", { children: [
@@ -1771,7 +1773,7 @@ var SubscriptionBlock = (title, data) => {
1771
1773
  {
1772
1774
  valign: "top",
1773
1775
  css: subscriptionDefinitionCellStyle,
1774
- children: /* @__PURE__ */ jsx36("b", { children: "Product" })
1776
+ children: /* @__PURE__ */ jsx36("b", { children: t("product") })
1775
1777
  }
1776
1778
  ),
1777
1779
  /* @__PURE__ */ jsx36("td", { css: subscriptionValueCellStyle, children: data.product.name })
@@ -1915,7 +1917,6 @@ var ProcessesTimeline = ({
1915
1917
  subscriptionId
1916
1918
  }) => {
1917
1919
  const { data: subscriptionProcesses } = useSubscriptionProcesses(subscriptionId);
1918
- console.log("SUB", subscriptionProcesses);
1919
1920
  return /* @__PURE__ */ jsxs27(Fragment8, { children: [
1920
1921
  /* @__PURE__ */ jsx38(EuiSpacer12, { size: "m" }),
1921
1922
  !subscriptionProcesses && /* @__PURE__ */ jsx38(EuiLoadingContent, {}),
@@ -2208,12 +2209,14 @@ import {
2208
2209
  EuiTitle,
2209
2210
  EuiPopover
2210
2211
  } from "@elastic/eui";
2212
+ import { useTranslations as useTranslations2 } from "next-intl";
2211
2213
  import { Fragment as Fragment10, jsx as jsx42, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
2212
2214
  var MenuItem = ({ icon, description, key }) => /* @__PURE__ */ jsx42(EuiContextMenuItem, { icon: /* @__PURE__ */ jsx42(EuiAvatar3, { name: icon, size: "s" }), children: description }, key);
2213
2215
  var MenuBlock = ({ title }) => /* @__PURE__ */ jsx42(EuiTitle, { size: "xxxs", children: /* @__PURE__ */ jsx42("h3", { children: title }) });
2214
2216
  var SubscriptionActions = ({
2215
2217
  subscriptionId
2216
2218
  }) => {
2219
+ const t = useTranslations2("subscriptions.detail.workflow");
2217
2220
  const [isPopoverOpen, setPopover] = useState9(false);
2218
2221
  const { data: subscriptionActions } = useSubscriptionActions(subscriptionId);
2219
2222
  const onButtonClick = () => {
@@ -2242,7 +2245,7 @@ var SubscriptionActions = ({
2242
2245
  anchorPosition: "downLeft",
2243
2246
  children: /* @__PURE__ */ jsx42(EuiContextMenuPanel, { children: /* @__PURE__ */ jsxs29(EuiPanel8, { color: "transparent", paddingSize: "s", children: [
2244
2247
  subscriptionActions && subscriptionActions.create && /* @__PURE__ */ jsxs29(Fragment10, { children: [
2245
- /* @__PURE__ */ jsx42(MenuBlock, { title: "Create workflow" }),
2248
+ /* @__PURE__ */ jsx42(MenuBlock, { title: t("create") }),
2246
2249
  subscriptionActions.create.map((item, index) => /* @__PURE__ */ jsx42(
2247
2250
  MenuItem,
2248
2251
  {
@@ -2254,7 +2257,7 @@ var SubscriptionActions = ({
2254
2257
  ))
2255
2258
  ] }),
2256
2259
  subscriptionActions && subscriptionActions.modify && /* @__PURE__ */ jsxs29(Fragment10, { children: [
2257
- /* @__PURE__ */ jsx42(MenuBlock, { title: "Modify workflow" }),
2260
+ /* @__PURE__ */ jsx42(MenuBlock, { title: t("modify") }),
2258
2261
  subscriptionActions.modify.map((item, index) => /* @__PURE__ */ jsx42(
2259
2262
  MenuItem,
2260
2263
  {
@@ -2266,11 +2269,11 @@ var SubscriptionActions = ({
2266
2269
  ))
2267
2270
  ] }),
2268
2271
  subscriptionActions && subscriptionActions.system && /* @__PURE__ */ jsxs29(Fragment10, { children: [
2269
- /* @__PURE__ */ jsx42(MenuBlock, { title: "System workflow" }),
2272
+ /* @__PURE__ */ jsx42(MenuBlock, { title: t("system") }),
2270
2273
  subscriptionActions.system.map((item, index) => /* @__PURE__ */ jsx42(
2271
2274
  MenuItem,
2272
2275
  {
2273
- icon: "Syste",
2276
+ icon: "System",
2274
2277
  description: item.description,
2275
2278
  index
2276
2279
  },
@@ -2278,7 +2281,7 @@ var SubscriptionActions = ({
2278
2281
  ))
2279
2282
  ] }),
2280
2283
  subscriptionActions && subscriptionActions.terminate && /* @__PURE__ */ jsxs29(Fragment10, { children: [
2281
- /* @__PURE__ */ jsx42(MenuBlock, { title: "Terminate workflow" }),
2284
+ /* @__PURE__ */ jsx42(MenuBlock, { title: t("terminate") }),
2282
2285
  subscriptionActions.terminate.map(
2283
2286
  (item, index) => /* @__PURE__ */ jsx42(
2284
2287
  MenuItem,
@@ -2298,12 +2301,15 @@ var SubscriptionActions = ({
2298
2301
 
2299
2302
  // src/components/Subscription/SubscriptionDetailTree.tsx
2300
2303
  import React13, { useState as useState10 } from "react";
2304
+ import { useTranslations as useTranslations4 } from "next-intl";
2301
2305
 
2302
2306
  // src/components/Tree/TreeBranch.tsx
2303
2307
  import React12 from "react";
2308
+ import { EuiListGroup } from "@elastic/eui";
2304
2309
 
2305
2310
  // src/components/Tree/TreeNode.tsx
2306
2311
  import React11 from "react";
2312
+ import { useTranslations as useTranslations3 } from "next-intl";
2307
2313
  import {
2308
2314
  EuiFlexGroup as EuiFlexGroup10,
2309
2315
  EuiFlexItem as EuiFlexItem9,
@@ -2313,6 +2319,7 @@ import {
2313
2319
  } from "@elastic/eui";
2314
2320
  import { jsx as jsx43, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
2315
2321
  var TreeNode = ({ item, hasChildren, level }) => {
2322
+ const t = useTranslations3("common");
2316
2323
  const { expandedIds, toggleExpandedId, selectedIds, toggleSelectedId } = React11.useContext(TreeContext);
2317
2324
  const expanded = expandedIds.includes(item.id);
2318
2325
  const selected = selectedIds.includes(item.id);
@@ -2347,7 +2354,7 @@ var TreeNode = ({ item, hasChildren, level }) => {
2347
2354
  onClick: () => toggleSelectedId(item.id),
2348
2355
  iconType: "error",
2349
2356
  iconSize: "s",
2350
- "aria-label": "Deselect",
2357
+ "aria-label": t("deselect"),
2351
2358
  alwaysShow: true
2352
2359
  }
2353
2360
  }
@@ -2363,7 +2370,6 @@ var TreeNode = ({ item, hasChildren, level }) => {
2363
2370
  };
2364
2371
 
2365
2372
  // src/components/Tree/TreeBranch.tsx
2366
- import { EuiListGroup } from "@elastic/eui";
2367
2373
  import { Fragment as Fragment11, jsx as jsx44, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
2368
2374
  var TreeBranch = ({ item, level }) => {
2369
2375
  const { expandedIds } = React12.useContext(TreeContext);
@@ -2421,6 +2427,7 @@ function getProductBlockTitle(resourceType) {
2421
2427
  return ((_a = resourceType.title) == null ? void 0 : _a.length) > MAX_LABEL_LENGTH ? `${resourceType.title.substring(0, MAX_LABEL_LENGTH)}...` : resourceType.title;
2422
2428
  }
2423
2429
  var SubscriptionDetailTree = () => {
2430
+ const t = useTranslations4("subscriptions.detail");
2424
2431
  const [expandAllActive, setExpandAllActive] = useState10(false);
2425
2432
  const [selectedTreeNode, setSelectedTreeNode] = useState10(-1);
2426
2433
  const { subscriptionData, loadingStatus } = React13.useContext(
@@ -2461,14 +2468,13 @@ var SubscriptionDetailTree = () => {
2461
2468
  (_a = parentNode.children) == null ? void 0 : _a.push(shallowCopy);
2462
2469
  }
2463
2470
  });
2464
- console.log("Tree", tree);
2465
2471
  }
2466
2472
  if (!tree)
2467
2473
  return null;
2468
2474
  return /* @__PURE__ */ jsxs32(EuiFlexGroup11, { style: { marginTop: 15 }, children: [
2469
2475
  /* @__PURE__ */ jsx46(EuiFlexItem10, { style: { maxWidth: 450, width: 450 }, children: /* @__PURE__ */ jsxs32(EuiFlexGroup11, { direction: "column", children: [
2470
2476
  /* @__PURE__ */ jsx46(EuiFlexItem10, { grow: false, children: /* @__PURE__ */ jsxs32(EuiFlexGroup11, { children: [
2471
- /* @__PURE__ */ jsx46(EuiFlexItem10, { grow: false, children: /* @__PURE__ */ jsx46(EuiText10, { children: /* @__PURE__ */ jsx46("h3", { children: "Product blocks" }) }) }),
2477
+ /* @__PURE__ */ jsx46(EuiFlexItem10, { grow: false, children: /* @__PURE__ */ jsx46(EuiText10, { children: /* @__PURE__ */ jsx46("h3", { children: t("productBlocks") }) }) }),
2472
2478
  /* @__PURE__ */ jsx46(EuiFlexItem10, { grow: false, children: /* @__PURE__ */ jsx46(
2473
2479
  EuiButtonIcon3,
2474
2480
  {
@@ -2499,9 +2505,12 @@ var SubscriptionDetailTree = () => {
2499
2505
  minHeight: 600
2500
2506
  },
2501
2507
  size: "m",
2502
- title: "No product block selected",
2508
+ title: t("noProductBlockSelected"),
2503
2509
  iconType: "inspect",
2504
- children: /* @__PURE__ */ jsx46("p", { children: "Select one or more product blocks to view their details" })
2510
+ children: /* @__PURE__ */ jsxs32("p", { children: [
2511
+ t("ctaSelectProductBlock"),
2512
+ " "
2513
+ ] })
2505
2514
  }
2506
2515
  ),
2507
2516
  selectedIds.length !== 0 && selectedIds.reverse().map(
@@ -2537,15 +2546,16 @@ var SubscriptionGeneral = () => {
2537
2546
  subscriptionData
2538
2547
  ) }),
2539
2548
  /* @__PURE__ */ jsx47(EuiFlexItem11, { children: FixedInputBlock(
2540
- "Fixed inputs",
2549
+ "Fixed Inputs",
2541
2550
  subscriptionData.fixedInputs
2542
2551
  ) }),
2543
- /* @__PURE__ */ jsx47(EuiFlexItem11, { children: FixedInputBlock("Product info", subscriptionData.product) })
2552
+ /* @__PURE__ */ jsx47(EuiFlexItem11, { children: FixedInputBlock("Product Info", subscriptionData.product) })
2544
2553
  ] }) });
2545
2554
  };
2546
2555
 
2547
2556
  // src/components/SubscriptionsTabs/SubscriptionsTabs.tsx
2548
2557
  import { EuiTab, EuiTabs } from "@elastic/eui";
2558
+ import { useTranslations as useTranslations5 } from "next-intl";
2549
2559
  import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
2550
2560
  var SubscriptionsTabType = /* @__PURE__ */ ((SubscriptionsTabType2) => {
2551
2561
  SubscriptionsTabType2["ACTIVE"] = "ACTIVE";
@@ -2557,7 +2567,7 @@ var SubscriptionsTabType = /* @__PURE__ */ ((SubscriptionsTabType2) => {
2557
2567
  var defaultSubscriptionsTabs = [
2558
2568
  {
2559
2569
  id: "ACTIVE" /* ACTIVE */,
2560
- name: "Active",
2570
+ translationKey: "active",
2561
2571
  alwaysOnFilters: [
2562
2572
  {
2563
2573
  field: "status",
@@ -2567,7 +2577,7 @@ var defaultSubscriptionsTabs = [
2567
2577
  },
2568
2578
  {
2569
2579
  id: "TERMINATED" /* TERMINATED */,
2570
- name: "Terminated",
2580
+ translationKey: "terminated",
2571
2581
  alwaysOnFilters: [
2572
2582
  {
2573
2583
  field: "status",
@@ -2577,7 +2587,7 @@ var defaultSubscriptionsTabs = [
2577
2587
  },
2578
2588
  {
2579
2589
  id: "TRANSIENT" /* TRANSIENT */,
2580
- name: "Transient",
2590
+ translationKey: "transient",
2581
2591
  alwaysOnFilters: [
2582
2592
  {
2583
2593
  field: "status",
@@ -2587,22 +2597,25 @@ var defaultSubscriptionsTabs = [
2587
2597
  },
2588
2598
  {
2589
2599
  id: "ALL" /* ALL */,
2590
- name: "All"
2600
+ translationKey: "all"
2591
2601
  }
2592
2602
  ];
2593
2603
  var SubscriptionsTabs = ({
2594
2604
  tabs,
2595
2605
  selectedSubscriptionsTab,
2596
2606
  onChangeSubscriptionsTab
2597
- }) => /* @__PURE__ */ jsx48(EuiTabs, { children: tabs.map(({ id, name }) => /* @__PURE__ */ jsx48(
2598
- EuiTab,
2599
- {
2600
- isSelected: id === selectedSubscriptionsTab,
2601
- onClick: () => id !== selectedSubscriptionsTab && onChangeSubscriptionsTab(id),
2602
- children: name
2603
- },
2604
- id
2605
- )) });
2607
+ }) => {
2608
+ const t = useTranslations5("subscriptions.tabs");
2609
+ return /* @__PURE__ */ jsx48(EuiTabs, { children: tabs.map(({ id, translationKey: name }) => /* @__PURE__ */ jsx48(
2610
+ EuiTab,
2611
+ {
2612
+ isSelected: id === selectedSubscriptionsTab,
2613
+ onClick: () => id !== selectedSubscriptionsTab && onChangeSubscriptionsTab(id),
2614
+ children: t(name)
2615
+ },
2616
+ id
2617
+ )) });
2618
+ };
2606
2619
 
2607
2620
  // src/components/SubscriptionsTabs/getSubscriptionsTabTypeFromString.ts
2608
2621
  var getSubscriptionsTabTypeFromString = (tabId) => {
@@ -2635,6 +2648,11 @@ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
2635
2648
  SortOrder2["DESC"] = "DESC";
2636
2649
  return SortOrder2;
2637
2650
  })(SortOrder || {});
2651
+ var Locale = /* @__PURE__ */ ((Locale2) => {
2652
+ Locale2["enUS"] = "en-Us";
2653
+ Locale2["nlNL"] = "nl-NL";
2654
+ return Locale2;
2655
+ })(Locale || {});
2638
2656
 
2639
2657
  // src/components/Table/DataGridTable/dataGridColumns.ts
2640
2658
  var getInitialColumnOrder = (columns, initialColumnOrder) => {
@@ -3194,6 +3212,148 @@ var defaultOrchestratorTheme = {
3194
3212
  }
3195
3213
  }
3196
3214
  };
3215
+
3216
+ // src/messages/nl-NL.json
3217
+ var nl_NL_default = {
3218
+ main: {
3219
+ title: "Welcome to example-orchestrator-ui!"
3220
+ },
3221
+ metadata: {
3222
+ tabs: {
3223
+ products: "Producten",
3224
+ productBlocks: "Productblokken",
3225
+ resourceTypes: "Resource types",
3226
+ fixedInputs: "Vaste inputs",
3227
+ workflows: "Workflows"
3228
+ },
3229
+ product: {
3230
+ name: "Naam",
3231
+ description: "Beschrijving",
3232
+ tag: "Tag",
3233
+ productType: "Type",
3234
+ status: "Status",
3235
+ productBlocks: "Product blocks",
3236
+ createdAt: "Aangemaakt"
3237
+ }
3238
+ },
3239
+ subscriptions: {
3240
+ tabs: {
3241
+ active: "Actief",
3242
+ terminated: "Beeindigd",
3243
+ transient: "Tijdelijk",
3244
+ all: "Alles"
3245
+ },
3246
+ index: {
3247
+ id: "ID",
3248
+ description: "Beschrijving",
3249
+ status: "Status",
3250
+ insync: "In Sync",
3251
+ product: "Produkt",
3252
+ tag: "Tag",
3253
+ startDate: "Start datum",
3254
+ endDate: "Eind Datum",
3255
+ note: "Notitite"
3256
+ },
3257
+ detail: {
3258
+ tabs: {
3259
+ general: "Algemeen",
3260
+ serviceConfiguration: "Service configuratie",
3261
+ processes: "Processen",
3262
+ relatedSubscriptions: "Geralateerde subscriptions"
3263
+ }
3264
+ }
3265
+ }
3266
+ };
3267
+
3268
+ // src/messages/en-US.json
3269
+ var en_US_default = {
3270
+ main: {
3271
+ title: "Welcome to example-orchestrator-ui!"
3272
+ },
3273
+ common: {
3274
+ addToFavorites: "Add to favorites",
3275
+ product: "Product",
3276
+ deselect: "Deselect"
3277
+ },
3278
+ metadata: {
3279
+ tabs: {
3280
+ products: "Products",
3281
+ productBlocks: "Productblocks",
3282
+ resourceTypes: "Resource types",
3283
+ fixedInputs: "Fixed inputs",
3284
+ workflows: "Workflows"
3285
+ },
3286
+ product: {
3287
+ name: "Name",
3288
+ description: "Description",
3289
+ tag: "Tag",
3290
+ productType: "Type",
3291
+ status: "status",
3292
+ productBlocks: "Product blocks",
3293
+ createdAt: "Created"
3294
+ }
3295
+ },
3296
+ subscriptions: {
3297
+ tabs: {
3298
+ active: "Active",
3299
+ terminated: "Terminated",
3300
+ transient: "Transient",
3301
+ all: "All"
3302
+ },
3303
+ index: {
3304
+ id: "ID",
3305
+ description: "Description",
3306
+ status: "Status",
3307
+ insync: "In Sync",
3308
+ product: "Product",
3309
+ tag: "Tag",
3310
+ startDate: "Start Date",
3311
+ endDate: "End Date",
3312
+ note: "Note"
3313
+ },
3314
+ detail: {
3315
+ tabs: {
3316
+ general: "General",
3317
+ serviceConfiguration: "Service configuration",
3318
+ processes: "Processes",
3319
+ relatedSubscriptions: "Related subscriptions"
3320
+ },
3321
+ loadingStatus: "Loading status",
3322
+ workflow: {
3323
+ create: "Create workflow",
3324
+ modify: "Modify workflow",
3325
+ system: "System workflow",
3326
+ terminate: "Terminate workflow"
3327
+ },
3328
+ subscriptionDetails: "Subscription details",
3329
+ fixedInputs: "Fixed inputs",
3330
+ productInfo: "Product info",
3331
+ noProductBlockSelected: "No product block selected",
3332
+ productBlocks: "Product blocks",
3333
+ ctaSelectProductBlock: "Select one or more product blocks to view their details",
3334
+ startedBy: "Started by",
3335
+ startedAt: "Started at",
3336
+ status: "Status",
3337
+ id: "ID"
3338
+ }
3339
+ }
3340
+ };
3341
+
3342
+ // src/messages/getTranslationMessages.ts
3343
+ var standardMessageMap = /* @__PURE__ */ new Map([
3344
+ ["en-Us" /* enUS */, en_US_default],
3345
+ ["nl-NL" /* nlNL */, nl_NL_default]
3346
+ ]);
3347
+ var getTranslationMessages = (locale, messages = standardMessageMap) => {
3348
+ switch (locale) {
3349
+ case "en-Us" /* enUS */:
3350
+ return messages.get("en-Us" /* enUS */);
3351
+ case "nl-NL" /* nlNL */:
3352
+ return messages.get("nl-NL" /* nlNL */);
3353
+ default:
3354
+ return messages.get("en-Us" /* enUS */);
3355
+ }
3356
+ };
3197
3357
  export {
3198
3358
  ArrowNarrowDown,
3199
3359
  ArrowNarrowUp,
@@ -3214,6 +3374,7 @@ export {
3214
3374
  HeaderBadge,
3215
3375
  ListItemStartPage,
3216
3376
  Loading,
3377
+ Locale,
3217
3378
  LogoutIcon,
3218
3379
  MinusCircleOutline,
3219
3380
  MultiListSection,
@@ -3266,6 +3427,7 @@ export {
3266
3427
  getStatusBadgeColor,
3267
3428
  getSubscriptionsTabTypeFromString,
3268
3429
  getTableConfigFromLocalStorage,
3430
+ getTranslationMessages,
3269
3431
  getTypedFieldFromObject,
3270
3432
  isUuid4,
3271
3433
  isValidLocalStorageTableConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -10,6 +10,7 @@ import {
10
10
  import { ProcessStatusBadge } from '../Badges';
11
11
  import { SubscriptionProcess, useSubscriptionProcesses } from '../../hooks';
12
12
 
13
+ /** TODO: Adding a useTranslations hook here leads to an hooks error. https://github.com/workfloworchestrator/orchestrator-ui/issues/177 */
13
14
  const Card = (processInfo: SubscriptionProcess) => (
14
15
  <div style={{ marginTop: 5 }}>
15
16
  <table width="100%" bgcolor={'#F1F5F9'}>
@@ -87,7 +88,6 @@ export const ProcessesTimeline: FC<ProcessesTimelineProps> = ({
87
88
  }) => {
88
89
  const { data: subscriptionProcesses } =
89
90
  useSubscriptionProcesses(subscriptionId);
90
- console.log('SUB', subscriptionProcesses);
91
91
 
92
92
  return (
93
93
  <>
@@ -8,6 +8,7 @@ import {
8
8
  EuiTitle,
9
9
  EuiPopover,
10
10
  } from '@elastic/eui';
11
+ import { useTranslations } from 'next-intl';
11
12
  import { useSubscriptionActions } from '../../hooks/useSubscriptionActions';
12
13
 
13
14
  type MenuItemProps = {
@@ -39,6 +40,7 @@ export type SubscriptionActionsProps = {
39
40
  export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
40
41
  subscriptionId,
41
42
  }) => {
43
+ const t = useTranslations('subscriptions.detail.workflow');
42
44
  const [isPopoverOpen, setPopover] = useState(false);
43
45
  const { data: subscriptionActions } =
44
46
  useSubscriptionActions(subscriptionId);
@@ -74,7 +76,7 @@ export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
74
76
  <EuiPanel color="transparent" paddingSize="s">
75
77
  {subscriptionActions && subscriptionActions.create && (
76
78
  <>
77
- <MenuBlock title={'Create workflow'}></MenuBlock>
79
+ <MenuBlock title={t('create')}></MenuBlock>
78
80
  {subscriptionActions.create.map((item, index) => (
79
81
  <MenuItem
80
82
  key={`c_${index}`}
@@ -88,7 +90,7 @@ export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
88
90
 
89
91
  {subscriptionActions && subscriptionActions.modify && (
90
92
  <>
91
- <MenuBlock title={'Modify workflow'}></MenuBlock>
93
+ <MenuBlock title={t('modify')}></MenuBlock>
92
94
  {subscriptionActions.modify.map((item, index) => (
93
95
  <MenuItem
94
96
  key={`m_${index}`}
@@ -102,11 +104,11 @@ export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
102
104
 
103
105
  {subscriptionActions && subscriptionActions.system && (
104
106
  <>
105
- <MenuBlock title={'System workflow'}></MenuBlock>
107
+ <MenuBlock title={t('system')}></MenuBlock>
106
108
  {subscriptionActions.system.map((item, index) => (
107
109
  <MenuItem
108
110
  key={`s_${index}`}
109
- icon={'Syste'}
111
+ icon={'System'}
110
112
  description={item.description}
111
113
  index={index}
112
114
  />
@@ -116,7 +118,7 @@ export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
116
118
 
117
119
  {subscriptionActions && subscriptionActions.terminate && (
118
120
  <>
119
- <MenuBlock title={'Terminate workflow'}></MenuBlock>
121
+ <MenuBlock title={t('terminate')}></MenuBlock>
120
122
  {subscriptionActions.terminate.map(
121
123
  (item, index) => (
122
124
  <MenuItem
@@ -7,6 +7,7 @@ import {
7
7
  EuiSpacer,
8
8
  EuiText,
9
9
  } from '@elastic/eui';
10
+ import { useTranslations } from 'next-intl';
10
11
  import { CheckmarkCircleFill, MinusCircleOutline } from '../../icons';
11
12
  import { WFOStatusBadge } from '../Badges';
12
13
  import {
@@ -33,6 +34,7 @@ export const RenderField = (field: string, data: any) => {
33
34
  };
34
35
 
35
36
  export const SubscriptionBlock = (title: string, data: object) => {
37
+ const t = useTranslations('common');
36
38
  const keys = [];
37
39
  for (const key in data) {
38
40
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -56,7 +58,7 @@ export const SubscriptionBlock = (title: string, data: object) => {
56
58
  </EuiFlexItem>
57
59
  <EuiFlexItem grow={false}>
58
60
  <EuiButtonEmpty size={'s'} iconType={'starEmpty'}>
59
- Add to favorites
61
+ {t('addToFavorites')}
60
62
  </EuiButtonEmpty>
61
63
  </EuiFlexItem>
62
64
  </EuiFlexGroup>
@@ -69,7 +71,7 @@ export const SubscriptionBlock = (title: string, data: object) => {
69
71
  valign={'top'}
70
72
  css={subscriptionDefinitionCellStyle}
71
73
  >
72
- <b>Product</b>
74
+ <b>{t('product')}</b>
73
75
  </td>
74
76
  <td css={subscriptionValueCellStyle}>
75
77
  {/*
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react';
2
+ import { useTranslations } from 'next-intl';
2
3
  import { ProductBlockBase, ResourceTypeBase, TreeBlock } from '../../types';
3
4
  import { ProductBlock } from './ProductBlock';
4
5
  import {
@@ -40,6 +41,7 @@ function getProductBlockTitle(resourceType: ResourceTypeBase): string {
40
41
  }
41
42
 
42
43
  export const SubscriptionDetailTree = () => {
44
+ const t = useTranslations('subscriptions.detail');
43
45
  const [expandAllActive, setExpandAllActive] = useState(false);
44
46
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
47
  const [selectedTreeNode, setSelectedTreeNode] = useState(-1);
@@ -109,8 +111,8 @@ export const SubscriptionDetailTree = () => {
109
111
  parentNode.children?.push(shallowCopy);
110
112
  }
111
113
  });
112
- console.log('Tree', tree);
113
114
  }
115
+
114
116
  if (!tree) return null;
115
117
 
116
118
  return (
@@ -121,7 +123,7 @@ export const SubscriptionDetailTree = () => {
121
123
  <EuiFlexGroup>
122
124
  <EuiFlexItem grow={false}>
123
125
  <EuiText>
124
- <h3>Product blocks</h3>
126
+ <h3>{t('productBlocks')}</h3>
125
127
  </EuiText>
126
128
  </EuiFlexItem>
127
129
  <EuiFlexItem grow={false}>
@@ -158,13 +160,10 @@ export const SubscriptionDetailTree = () => {
158
160
  minHeight: 600,
159
161
  }}
160
162
  size="m"
161
- title="No product block selected"
163
+ title={t('noProductBlockSelected')}
162
164
  iconType="inspect"
163
165
  >
164
- <p>
165
- Select one or more product blocks to view their
166
- details
167
- </p>
166
+ <p>{t('ctaSelectProductBlock')} </p>
168
167
  </EuiCallOut>
169
168
  )}
170
169
  {selectedIds.length !== 0 &&
@@ -6,13 +6,17 @@ import {
6
6
  EuiLoadingContent,
7
7
  EuiSpacer,
8
8
  } from '@elastic/eui';
9
+ // import { useTranslations } from 'next-intl';
9
10
  import { SubscriptionContext } from '../../contexts/SubscriptionContext';
10
11
  import { SubscriptionBlock } from './SubscriptionBlock';
11
12
  import { FixedInputBlock } from './FixedInputBlock';
12
13
 
14
+ /** TODO: Adding a useTranslations hook here leads to an hooks error. https://github.com/workfloworchestrator/orchestrator-ui/issues/177 */
15
+
13
16
  export const SubscriptionGeneral = () => {
14
17
  const { subscriptionData, loadingStatus } =
15
18
  React.useContext(SubscriptionContext);
19
+
16
20
  if (!loadingStatus) {
17
21
  return (
18
22
  <>
@@ -33,12 +37,12 @@ export const SubscriptionGeneral = () => {
33
37
  </EuiFlexItem>
34
38
  <EuiFlexItem>
35
39
  {FixedInputBlock(
36
- 'Fixed inputs',
40
+ 'Fixed Inputs',
37
41
  subscriptionData.fixedInputs,
38
42
  )}
39
43
  </EuiFlexItem>
40
44
  <EuiFlexItem>
41
- {FixedInputBlock('Product info', subscriptionData.product)}
45
+ {FixedInputBlock('Product Info', subscriptionData.product)}
42
46
  </EuiFlexItem>
43
47
  </>
44
48
  </EuiFlexGrid>
@@ -1,5 +1,6 @@
1
1
  import { EuiTab, EuiTabs } from '@elastic/eui';
2
2
  import React, { FC } from 'react';
3
+ import { useTranslations } from 'next-intl';
3
4
 
4
5
  export enum SubscriptionsTabType {
5
6
  ACTIVE = 'ACTIVE',
@@ -15,14 +16,14 @@ export type FilterQuery = {
15
16
 
16
17
  export type SubscriptionsTab = {
17
18
  id: SubscriptionsTabType;
18
- name: string;
19
+ translationKey: string;
19
20
  alwaysOnFilters?: FilterQuery[];
20
21
  };
21
22
 
22
23
  export const defaultSubscriptionsTabs: SubscriptionsTab[] = [
23
24
  {
24
25
  id: SubscriptionsTabType.ACTIVE,
25
- name: 'Active',
26
+ translationKey: 'active',
26
27
  alwaysOnFilters: [
27
28
  {
28
29
  field: 'status',
@@ -32,7 +33,7 @@ export const defaultSubscriptionsTabs: SubscriptionsTab[] = [
32
33
  },
33
34
  {
34
35
  id: SubscriptionsTabType.TERMINATED,
35
- name: 'Terminated',
36
+ translationKey: 'terminated',
36
37
  alwaysOnFilters: [
37
38
  {
38
39
  field: 'status',
@@ -42,7 +43,7 @@ export const defaultSubscriptionsTabs: SubscriptionsTab[] = [
42
43
  },
43
44
  {
44
45
  id: SubscriptionsTabType.TRANSIENT,
45
- name: 'Transient',
46
+ translationKey: 'transient',
46
47
  alwaysOnFilters: [
47
48
  {
48
49
  field: 'status',
@@ -52,7 +53,7 @@ export const defaultSubscriptionsTabs: SubscriptionsTab[] = [
52
53
  },
53
54
  {
54
55
  id: SubscriptionsTabType.ALL,
55
- name: 'All',
56
+ translationKey: 'all',
56
57
  },
57
58
  ];
58
59
 
@@ -68,19 +69,22 @@ export const SubscriptionsTabs: FC<SubscriptionsTabsProps> = ({
68
69
  tabs,
69
70
  selectedSubscriptionsTab,
70
71
  onChangeSubscriptionsTab,
71
- }) => (
72
- <EuiTabs>
73
- {tabs.map(({ id, name }) => (
74
- <EuiTab
75
- key={id}
76
- isSelected={id === selectedSubscriptionsTab}
77
- onClick={() =>
78
- id !== selectedSubscriptionsTab &&
79
- onChangeSubscriptionsTab(id)
80
- }
81
- >
82
- {name}
83
- </EuiTab>
84
- ))}
85
- </EuiTabs>
86
- );
72
+ }) => {
73
+ const t = useTranslations('subscriptions.tabs');
74
+ return (
75
+ <EuiTabs>
76
+ {tabs.map(({ id, translationKey: name }) => (
77
+ <EuiTab
78
+ key={id}
79
+ isSelected={id === selectedSubscriptionsTab}
80
+ onClick={() =>
81
+ id !== selectedSubscriptionsTab &&
82
+ onChangeSubscriptionsTab(id)
83
+ }
84
+ >
85
+ {t(name)}
86
+ </EuiTab>
87
+ ))}
88
+ </EuiTabs>
89
+ );
90
+ };
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react';
2
+ import { EuiListGroup } from '@elastic/eui';
2
3
 
3
4
  import { TreeNode } from './TreeNode';
4
- import { EuiListGroup } from '@elastic/eui';
5
5
  import { TreeBlock } from '../../types';
6
6
  import { TreeContext, TreeContextType } from '../../contexts/TreeContext';
7
7
 
@@ -1,4 +1,5 @@
1
1
  import React, { FC } from 'react';
2
+ import { useTranslations } from 'next-intl';
2
3
  import {
3
4
  EuiFlexGroup,
4
5
  EuiFlexItem,
@@ -21,6 +22,7 @@ type TreeNodeProps = {
21
22
  };
22
23
 
23
24
  export const TreeNode: FC<TreeNodeProps> = ({ item, hasChildren, level }) => {
25
+ const t = useTranslations('common');
24
26
  const { expandedIds, toggleExpandedId, selectedIds, toggleSelectedId } =
25
27
  React.useContext(TreeContext) as TreeContextType;
26
28
  const expanded = expandedIds.includes(item.id);
@@ -59,7 +61,7 @@ export const TreeNode: FC<TreeNodeProps> = ({ item, hasChildren, level }) => {
59
61
  onClick: () => toggleSelectedId(item.id),
60
62
  iconType: 'error',
61
63
  iconSize: 's',
62
- 'aria-label': 'Deselect',
64
+ 'aria-label': t('deselect'),
63
65
  alwaysShow: true,
64
66
  }}
65
67
  />
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from './utils';
5
5
  export * from './contexts';
6
6
  export * from './types';
7
7
  export * from './hooks';
8
+ export * from './messages';
@@ -0,0 +1,72 @@
1
+ {
2
+ "main": {
3
+ "title": "Welcome to example-orchestrator-ui!"
4
+ },
5
+ "common": {
6
+ "addToFavorites": "Add to favorites",
7
+ "product": "Product",
8
+ "deselect": "Deselect"
9
+ },
10
+ "metadata": {
11
+ "tabs": {
12
+ "products": "Products",
13
+ "productBlocks": "Productblocks",
14
+ "resourceTypes": "Resource types",
15
+ "fixedInputs": "Fixed inputs",
16
+ "workflows": "Workflows"
17
+ },
18
+ "product": {
19
+ "name": "Name",
20
+ "description": "Description",
21
+ "tag": "Tag",
22
+ "productType": "Type",
23
+ "status": "status",
24
+ "productBlocks": "Product blocks",
25
+ "createdAt": "Created"
26
+ }
27
+ },
28
+ "subscriptions": {
29
+ "tabs": {
30
+ "active": "Active",
31
+ "terminated": "Terminated",
32
+ "transient": "Transient",
33
+ "all": "All"
34
+ },
35
+ "index": {
36
+ "id": "ID",
37
+ "description": "Description",
38
+ "status": "Status",
39
+ "insync": "In Sync",
40
+ "product": "Product",
41
+ "tag": "Tag",
42
+ "startDate": "Start Date",
43
+ "endDate": "End Date",
44
+ "note": "Note"
45
+ },
46
+ "detail": {
47
+ "tabs": {
48
+ "general": "General",
49
+ "serviceConfiguration": "Service configuration",
50
+ "processes": "Processes",
51
+ "relatedSubscriptions": "Related subscriptions"
52
+ },
53
+ "loadingStatus": "Loading status",
54
+ "workflow": {
55
+ "create": "Create workflow",
56
+ "modify": "Modify workflow",
57
+ "system": "System workflow",
58
+ "terminate": "Terminate workflow"
59
+ },
60
+ "subscriptionDetails": "Subscription details",
61
+ "fixedInputs": "Fixed inputs",
62
+ "productInfo": "Product info",
63
+ "noProductBlockSelected": "No product block selected",
64
+ "productBlocks": "Product blocks",
65
+ "ctaSelectProductBlock": "Select one or more product blocks to view their details",
66
+ "startedBy": "Started by",
67
+ "startedAt": "Started at",
68
+ "status": "Status",
69
+ "id": "ID"
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,51 @@
1
+ import { getTranslationMessages } from './getTranslationMessages';
2
+ import { Locale } from '../types';
3
+ import enUS from './en-US.json';
4
+ import nlNL from './nl-NL.json';
5
+
6
+ describe('getTransalationMessages', () => {
7
+ it('Returns nl-NL translation when nl-NL locale is requested', () => {
8
+ const translation = getTranslationMessages(Locale.nlNL);
9
+ expect(translation).toEqual(nlNL);
10
+ });
11
+
12
+ it('Returns en-US translation when en-US locale is requested', () => {
13
+ const translation = getTranslationMessages(Locale.enUS);
14
+ expect(translation).toEqual(enUS);
15
+ });
16
+
17
+ it('Returns en-US translation when no locale is requested', () => {
18
+ const translation = getTranslationMessages(undefined);
19
+ expect(translation).toEqual(enUS);
20
+ });
21
+ it('Returns en-US translation unknown locale is requested', () => {
22
+ const translation = getTranslationMessages('UNKNOWN-LOCALE');
23
+ expect(translation).toEqual(enUS);
24
+ });
25
+ it('Returns custom translation when custom translations map array is provided', () => {
26
+ const customEN = {
27
+ metadata: {
28
+ product: {
29
+ name: 'CUSTOM-EN-NAME',
30
+ },
31
+ },
32
+ };
33
+
34
+ const customMap = new Map([[Locale.enUS, customEN]]);
35
+ const translation = getTranslationMessages(Locale.enUS, customMap);
36
+ expect(translation).toEqual(customEN);
37
+ });
38
+ it('Returns en-Us translation if unknown locale is requested together with custom translations map', () => {
39
+ const customEN = {
40
+ metadata: {
41
+ product: {
42
+ name: 'CUSTOM-EN-NAME',
43
+ },
44
+ },
45
+ };
46
+
47
+ const customMap = new Map([[Locale.enUS, customEN]]);
48
+ const translation = getTranslationMessages('UNKNOWN-LOCALE', customMap);
49
+ expect(translation).toEqual(customEN);
50
+ });
51
+ });
@@ -0,0 +1,26 @@
1
+ import { AbstractIntlMessages } from 'next-intl';
2
+
3
+ import { Locale } from '../types';
4
+ import nlNL from './nl-NL.json';
5
+ import enUS from './en-US.json';
6
+
7
+ export type TranslationMessagesMap = Map<Locale, AbstractIntlMessages>;
8
+
9
+ const standardMessageMap: TranslationMessagesMap = new Map([
10
+ [Locale.enUS, enUS],
11
+ [Locale.nlNL, nlNL],
12
+ ]);
13
+
14
+ export const getTranslationMessages = (
15
+ locale: string | undefined,
16
+ messages: TranslationMessagesMap = standardMessageMap,
17
+ ) => {
18
+ switch (locale) {
19
+ case Locale.enUS:
20
+ return messages.get(Locale.enUS);
21
+ case Locale.nlNL:
22
+ return messages.get(Locale.nlNL);
23
+ default:
24
+ return messages.get(Locale.enUS);
25
+ }
26
+ };
@@ -0,0 +1 @@
1
+ export * from './getTranslationMessages';
@@ -0,0 +1,50 @@
1
+ {
2
+ "main": {
3
+ "title": "Welcome to example-orchestrator-ui!"
4
+ },
5
+ "metadata": {
6
+ "tabs": {
7
+ "products": "Producten",
8
+ "productBlocks": "Productblokken",
9
+ "resourceTypes": "Resource types",
10
+ "fixedInputs": "Vaste inputs",
11
+ "workflows": "Workflows"
12
+ },
13
+ "product": {
14
+ "name": "Naam",
15
+ "description": "Beschrijving",
16
+ "tag": "Tag",
17
+ "productType": "Type",
18
+ "status": "Status",
19
+ "productBlocks": "Product blocks",
20
+ "createdAt": "Aangemaakt"
21
+ }
22
+ },
23
+ "subscriptions": {
24
+ "tabs": {
25
+ "active": "Actief",
26
+ "terminated": "Beeindigd",
27
+ "transient": "Tijdelijk",
28
+ "all": "Alles"
29
+ },
30
+ "index": {
31
+ "id": "ID",
32
+ "description": "Beschrijving",
33
+ "status": "Status",
34
+ "insync": "In Sync",
35
+ "product": "Produkt",
36
+ "tag": "Tag",
37
+ "startDate": "Start datum",
38
+ "endDate": "Eind Datum",
39
+ "note": "Notitite"
40
+ },
41
+ "detail": {
42
+ "tabs": {
43
+ "general": "Algemeen",
44
+ "serviceConfiguration": "Service configuratie",
45
+ "processes": "Processen",
46
+ "relatedSubscriptions": "Geralateerde subscriptions"
47
+ }
48
+ }
49
+ }
50
+ }
package/src/types.ts CHANGED
@@ -144,3 +144,9 @@ export interface CacheOption {
144
144
  value: string;
145
145
  label: string;
146
146
  }
147
+ ``;
148
+
149
+ export enum Locale {
150
+ enUS = 'en-Us',
151
+ nlNL = 'nl-NL',
152
+ }