@orchestrator-ui/orchestrator-ui-components 1.38.2 → 2.0.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.
Files changed (93) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/.turbo/turbo-lint.log +5 -2
  3. package/.turbo/turbo-test.log +12 -12
  4. package/CHANGELOG.md +18 -0
  5. package/dist/index.d.ts +246 -170
  6. package/dist/index.js +4350 -3504
  7. package/package.json +1 -1
  8. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +6 -5
  9. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +3 -1
  10. package/src/components/WfoPageTemplate/WfoSidebar/WfoCopyright.tsx +1 -1
  11. package/src/components/WfoProcessList/WfoProcessesList.tsx +52 -51
  12. package/src/components/WfoRadioDropdown/WfoRadioDropdown.tsx +88 -0
  13. package/src/components/WfoRadioDropdown/index.ts +1 -0
  14. package/src/components/WfoSubscription/WfoInSyncField.tsx +13 -9
  15. package/src/components/WfoSubscription/WfoInUseByRelations.tsx +4 -2
  16. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +76 -29
  17. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +50 -56
  18. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +17 -9
  19. package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +18 -156
  20. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +113 -0
  21. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionFixedInputSection.tsx +28 -0
  22. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionMetadataSection.tsx +29 -0
  23. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionProductInfoSection.tsx +55 -0
  24. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/index.ts +4 -0
  25. package/src/components/WfoSubscription/index.ts +3 -0
  26. package/src/components/WfoSubscription/overrides/index.ts +1 -0
  27. package/src/components/WfoSubscription/styles.ts +4 -1
  28. package/src/components/WfoSubscription/utils/utils.spec.ts +0 -13
  29. package/src/components/WfoSubscription/utils/utils.ts +18 -5
  30. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +105 -100
  31. package/src/components/WfoTable/{WfoTableWithFilter/WfoTableWithFilter.tsx → WfoAdvancedTable/WfoAdvancedTable.tsx} +65 -123
  32. package/src/components/WfoTable/WfoAdvancedTable/getRowDetailData.tsx +55 -0
  33. package/src/components/WfoTable/WfoAdvancedTable/index.ts +4 -0
  34. package/src/components/WfoTable/WfoAdvancedTable/toSortedTableColumnConfig.ts +12 -0
  35. package/src/components/WfoTable/WfoAdvancedTable/types.ts +23 -0
  36. package/src/components/WfoTable/WfoStatusColorField/WfoStatusColorField.tsx +16 -0
  37. package/src/components/WfoTable/WfoStatusColorField/index.ts +1 -0
  38. package/src/components/WfoTable/WfoStatusColorField/styles.ts +20 -0
  39. package/src/components/WfoTable/WfoTable/WfoExpandedRow.tsx +33 -0
  40. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandableRow.tsx +48 -0
  41. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandedGroupRow.tsx +71 -0
  42. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTable.tsx +100 -0
  43. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTableGroups.tsx +74 -0
  44. package/src/components/WfoTable/WfoTable/WfoGroupedTable/styles.ts +39 -0
  45. package/src/components/WfoTable/WfoTable/WfoGroupedTable/useGroupedTableConfig.tsx +184 -0
  46. package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.spec.ts +133 -0
  47. package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.ts +41 -0
  48. package/src/components/WfoTable/WfoTable/WfoMultilineCell.tsx +13 -0
  49. package/src/components/WfoTable/WfoTable/WfoTable.tsx +201 -0
  50. package/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx +112 -0
  51. package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoSortDirectionIcon.tsx +3 -3
  52. package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoTableHeaderCell.tsx +4 -3
  53. package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/index.ts +2 -0
  54. package/src/components/WfoTable/WfoTable/WfoTableHeaderRow.tsx +114 -0
  55. package/src/components/WfoTable/WfoTable/WfoTruncateCell.tsx +23 -0
  56. package/src/components/WfoTable/WfoTable/constants.ts +1 -0
  57. package/src/components/WfoTable/WfoTable/index.ts +14 -0
  58. package/src/components/WfoTable/WfoTable/styles.ts +117 -0
  59. package/src/components/WfoTable/WfoTable/utils.spec.ts +79 -0
  60. package/src/components/WfoTable/WfoTable/utils.ts +78 -0
  61. package/src/components/WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx +13 -12
  62. package/src/components/WfoTable/WfoTableWithFilter/index.ts +1 -1
  63. package/src/components/WfoTable/index.ts +4 -5
  64. package/src/components/WfoTable/utils/columns.ts +1 -48
  65. package/src/components/WfoTable/utils/tableUtils.ts +13 -10
  66. package/src/components/WfoTree/WfoTreeBranch.tsx +10 -1
  67. package/src/components/WfoTree/WfoTreeNode.tsx +8 -57
  68. package/src/components/WfoTree/WfoTreeNodeListItem.tsx +65 -0
  69. package/src/components/WfoTree/styles.ts +28 -4
  70. package/src/components/index.ts +1 -0
  71. package/src/configuration/policy-resources.ts +1 -0
  72. package/src/configuration/version.ts +1 -1
  73. package/src/icons/WfoXMarkSmall.tsx +29 -0
  74. package/src/messages/en-GB.json +4 -0
  75. package/src/messages/nl-NL.json +4 -0
  76. package/src/pages/metadata/WfoProductBlocksPage.tsx +42 -59
  77. package/src/pages/metadata/WfoProductsPage.tsx +41 -47
  78. package/src/pages/metadata/WfoResourceTypesPage.tsx +26 -35
  79. package/src/pages/metadata/WfoTasksPage.tsx +35 -33
  80. package/src/pages/metadata/WfoWorkflowsPage.tsx +33 -29
  81. package/src/pages/tasks/WfoTasksListPage.tsx +25 -19
  82. package/src/utils/getObjectKeys.ts +3 -0
  83. package/src/utils/index.ts +5 -3
  84. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +0 -194
  85. package/src/components/WfoTable/WfoBasicTable/WfoStatusColorField.tsx +0 -21
  86. package/src/components/WfoTable/WfoBasicTable/index.ts +0 -5
  87. package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.stories.tsx +0 -136
  88. package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.tsx +0 -146
  89. package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts +0 -113
  90. package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.ts +0 -81
  91. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts +0 -52
  92. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +0 -23
  93. /package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/styles.ts +0 -0
@@ -1,54 +1,7 @@
1
- import { ReactNode } from 'react';
2
-
3
- import { EuiBasicTableColumn } from '@elastic/eui';
4
-
5
- import { SortOrder } from '../../../types';
6
-
7
- // Todo need to Pick a few more props from EuiBasicTableColumn to prevent none-functioning props (truncateText)
8
- // https://github.com/workfloworchestrator/orchestrator-ui/issues/130
9
- export type WfoEuiBasicTableColumn<T extends object> = Omit<
10
- EuiBasicTableColumn<T>,
11
- 'render'
12
- >;
13
-
14
- export type WfoTableDataColumnConfig<
15
- T extends object,
16
- Property,
17
- > = WfoEuiBasicTableColumn<T> & {
18
- field: Property;
19
- name: string;
20
- sortable?: boolean;
21
- filterable?: boolean;
22
- truncateText?: boolean;
23
- };
1
+ import { SortOrder } from '@/types';
24
2
 
25
3
  export const WFO_STATUS_COLOR_FIELD = 'statusColorField';
26
4
 
27
- // Todo need to Pick a few props from EuiBasicTableColumn to prevent none-functioning props (truncateText)
28
- export type WfoTableColumnsWithExtraNonDataFields<T extends object> =
29
- WfoTableColumns<T> & {
30
- [key: string]: EuiBasicTableColumn<T> & {
31
- field: string;
32
- name?: string;
33
- };
34
- };
35
-
36
- export type WfoTableColumns<T extends object> = {
37
- [Property in keyof T]: WfoTableDataColumnConfig<T, Property> & {
38
- render?: (cellValue: T[Property], row: T) => ReactNode;
39
- renderDetails?: (cellValue: T[Property], row: T) => ReactNode;
40
- clipboardText?: (cellValue: T[Property], row: T) => string;
41
- };
42
- };
43
-
44
- export type WfoTableControlColumnConfig<T extends object> = {
45
- [key: string]: WfoEuiBasicTableColumn<T> & {
46
- field: string;
47
- name?: string;
48
- render: (cellValue: never, row: T) => ReactNode;
49
- };
50
- };
51
-
52
5
  export type TableColumnKeys<T> = Array<keyof T>;
53
6
 
54
7
  export type WfoDataSorting<T> = {
@@ -1,7 +1,6 @@
1
- import type { Criteria } from '@elastic/eui';
1
+ import type { DataDisplayReturnValues } from '@/hooks';
2
+ import { SortOrder } from '@/types';
2
3
 
3
- import type { DataDisplayReturnValues } from '../../../hooks';
4
- import { SortOrder } from '../../../types';
5
4
  import { WfoDataSorting } from './columns';
6
5
 
7
6
  export const determinePageIndex = (pageIndex: number, pageSize: number) =>
@@ -32,16 +31,20 @@ export const getDataSortHandler =
32
31
  });
33
32
  };
34
33
 
35
- export const getPageChangeHandler =
34
+ export const getPageSizeChangeHandler =
36
35
  <Type>(
37
36
  setDataDisplayParam: DataDisplayReturnValues<Type>['setDataDisplayParam'],
38
37
  ) =>
39
- (page: Criteria<Type>['page']) => {
40
- if (page) {
41
- const { index, size } = page;
42
- setDataDisplayParam('pageSize', size);
43
- setDataDisplayParam('pageIndex', index);
44
- }
38
+ (pageSize: number) => {
39
+ setDataDisplayParam('pageSize', pageSize);
40
+ };
41
+
42
+ export const getPageIndexChangeHandler =
43
+ <Type>(
44
+ setDataDisplayParam: DataDisplayReturnValues<Type>['setDataDisplayParam'],
45
+ ) =>
46
+ (pageIndex: number) => {
47
+ setDataDisplayParam('pageIndex', pageIndex);
45
48
  };
46
49
 
47
50
  export const getQueryStringHandler =
@@ -2,7 +2,9 @@ import React, { FC } from 'react';
2
2
 
3
3
  import { EuiListGroup } from '@elastic/eui';
4
4
 
5
+ import { getSubscriptionDetailStyles } from '@/components/WfoSubscription/styles';
5
6
  import { TreeContext, TreeContextType } from '@/contexts';
7
+ import { useWithOrchestratorTheme } from '@/hooks';
6
8
  import { TreeBlock } from '@/types';
7
9
 
8
10
  import { WfoTreeNode } from './WfoTreeNode';
@@ -15,6 +17,9 @@ type WfoTreeBranchProps = {
15
17
  export const WfoTreeBranch: FC<WfoTreeBranchProps> = ({ item, level }) => {
16
18
  const { expandedIds } = React.useContext(TreeContext) as TreeContextType;
17
19
  const selected = expandedIds.includes(item.id);
20
+ const { productBlockTreeWidth } = useWithOrchestratorTheme(
21
+ getSubscriptionDetailStyles,
22
+ );
18
23
 
19
24
  const hasChildren = item.children && item.children.length !== 0;
20
25
 
@@ -32,7 +37,11 @@ export const WfoTreeBranch: FC<WfoTreeBranchProps> = ({ item, level }) => {
32
37
 
33
38
  return (
34
39
  <>
35
- <EuiListGroup flush={true} color="primary" maxWidth={455}>
40
+ <EuiListGroup
41
+ flush={true}
42
+ color="primary"
43
+ maxWidth={productBlockTreeWidth}
44
+ >
36
45
  <WfoTreeNode
37
46
  item={item}
38
47
  hasChildren={hasChildren}
@@ -1,15 +1,8 @@
1
1
  import React, { FC } from 'react';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
-
5
- import {
6
- EuiFlexGroup,
7
- EuiFlexItem,
8
- EuiIcon,
9
- EuiListGroupItem,
10
- EuiToken,
11
- } from '@elastic/eui';
3
+ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiToken } from '@elastic/eui';
12
4
 
5
+ import { WfoTreeNodeListItem } from '@/components/WfoTree/WfoTreeNodeListItem';
13
6
  import { TreeContext, TreeContextType } from '@/contexts';
14
7
  import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
15
8
  import { TreeBlock } from '@/types';
@@ -28,19 +21,10 @@ export const WfoTreeNode: FC<WfoTreeNodeProps> = ({
28
21
  level,
29
22
  }) => {
30
23
  const { theme } = useOrchestratorTheme();
31
- const {
32
- expandIconContainerStyle,
33
- treeContainerStyle,
34
- treeItemOtherSubscriptionStyle,
35
- } = useWithOrchestratorTheme(getStyles);
36
- const t = useTranslations('common');
37
- const {
38
- expandedIds,
39
- collapseNode,
40
- expandNode,
41
- selectedIds,
42
- toggleSelectedId,
43
- } = React.useContext(TreeContext) as TreeContextType;
24
+ const { expandIconContainerStyle, treeContainerStyle } =
25
+ useWithOrchestratorTheme(getStyles);
26
+ const { expandedIds, collapseNode, expandNode, selectedIds } =
27
+ React.useContext(TreeContext) as TreeContextType;
44
28
  const expanded = expandedIds.includes(item.id);
45
29
  const selected = selectedIds.includes(item.id);
46
30
 
@@ -65,41 +49,8 @@ export const WfoTreeNode: FC<WfoTreeNodeProps> = ({
65
49
  <EuiToken iconType={item.icon} />
66
50
  )}
67
51
  </EuiFlexItem>
68
- <EuiFlexItem grow={true}>
69
- {selected ? (
70
- <EuiListGroupItem
71
- onClick={() => toggleSelectedId(item.id)}
72
- label={item.label}
73
- isActive={selected}
74
- color={'primary'}
75
- style={{ borderRadius: 6 }}
76
- extraAction={{
77
- color: 'primary',
78
- onClick: () => toggleSelectedId(item.id),
79
- iconType: 'error',
80
- iconSize: 's',
81
- 'aria-label': t('deselect'),
82
- alwaysShow: true,
83
- }}
84
- css={
85
- item.isOutsideCurrentSubscription &&
86
- treeItemOtherSubscriptionStyle
87
- }
88
- />
89
- ) : (
90
- <EuiListGroupItem
91
- onClick={() => toggleSelectedId(item.id)}
92
- label={item.label}
93
- isActive={selected}
94
- style={{
95
- borderRadius: 6,
96
- }}
97
- css={
98
- item.isOutsideCurrentSubscription &&
99
- treeItemOtherSubscriptionStyle
100
- }
101
- />
102
- )}
52
+ <EuiFlexItem>
53
+ <WfoTreeNodeListItem item={item} selected={selected} />
103
54
  </EuiFlexItem>
104
55
  </EuiFlexGroup>
105
56
  </div>
@@ -0,0 +1,65 @@
1
+ import React, { useContext } from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+
5
+ import {
6
+ EuiButtonIcon,
7
+ EuiFlexGroup,
8
+ EuiFlexItem,
9
+ EuiText,
10
+ EuiTextTruncate,
11
+ } from '@elastic/eui';
12
+
13
+ import { getStyles } from '@/components/WfoTree/styles';
14
+ import { TreeContext, TreeContextType } from '@/contexts';
15
+ import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
16
+ import { WfoXMarkSmall } from '@/icons/WfoXMarkSmall';
17
+ import { TreeBlock } from '@/types';
18
+
19
+ interface WfoTreeNodeListItemProps {
20
+ item: TreeBlock;
21
+ selected: boolean;
22
+ }
23
+
24
+ export const WfoTreeNodeListItem = ({
25
+ item,
26
+ selected,
27
+ }: WfoTreeNodeListItemProps) => {
28
+ const t = useTranslations('common');
29
+ const { toggleSelectedId } = useContext(TreeContext) as TreeContextType;
30
+ const { theme } = useOrchestratorTheme();
31
+ const { selectedTreeItemStyle, treeItemStyle } =
32
+ useWithOrchestratorTheme(getStyles);
33
+
34
+ const { isOutsideCurrentSubscription, id, label } = item;
35
+ const textLabel = label.toString();
36
+
37
+ return (
38
+ <EuiFlexGroup
39
+ alignItems="center"
40
+ css={
41
+ selected
42
+ ? selectedTreeItemStyle(isOutsideCurrentSubscription)
43
+ : treeItemStyle(isOutsideCurrentSubscription)
44
+ }
45
+ onClick={() => toggleSelectedId(id)}
46
+ gutterSize="xs"
47
+ justifyContent="spaceBetween"
48
+ >
49
+ <EuiFlexItem>
50
+ <EuiText title={textLabel}>
51
+ <EuiTextTruncate text={textLabel} />
52
+ </EuiText>
53
+ </EuiFlexItem>
54
+ <EuiFlexItem css={{ maxWidth: theme.size.l }}>
55
+ <EuiButtonIcon
56
+ color="primary"
57
+ iconType={() => <WfoXMarkSmall color="currentColor" />}
58
+ size="xs"
59
+ aria-label={t('deselect')}
60
+ css={{ display: selected ? 'block' : 'none' }}
61
+ />
62
+ </EuiFlexItem>
63
+ </EuiFlexGroup>
64
+ );
65
+ };
@@ -12,14 +12,38 @@ export const getStyles = (wfoTheme: WfoTheme) => {
12
12
  marginRight: `-${theme.size.s}`,
13
13
  };
14
14
 
15
- const treeItemOtherSubscriptionStyle = {
16
- backgroundColor: toSecondaryColor(theme.colors.lightestShade),
17
- border: `thin dashed ${theme.colors.lightShade}`,
15
+ const treeItemStyle = (isOutsideCurrentSubscription: boolean) => {
16
+ return {
17
+ cursor: 'pointer',
18
+ paddingBlock: theme.size.xs,
19
+ paddingInline: theme.size.s,
20
+ borderRadius: theme.base - 10,
21
+ textDecoration: 'none',
22
+ backgroundColor: 'transparent',
23
+ transition: 'background-color 0.2s ease, text-decoration 0.3s ease', // Smooth transition for background
24
+ '&:hover': {
25
+ textDecoration: 'underline',
26
+ },
27
+ border: isOutsideCurrentSubscription
28
+ ? `1px dashed ${theme.colors.lightShade}`
29
+ : 'none',
30
+ };
31
+ };
32
+
33
+ const selectedTreeItemStyle = (isOutsideCurrentSubscription: boolean) => {
34
+ return {
35
+ ...treeItemStyle(isOutsideCurrentSubscription),
36
+ backgroundColor: isOutsideCurrentSubscription
37
+ ? theme.colors.lightShade
38
+ : toSecondaryColor(theme.colors.primary),
39
+ color: theme.colors.primaryText,
40
+ };
18
41
  };
19
42
 
20
43
  return {
21
44
  expandIconContainerStyle: expandIconContainerStyle,
22
45
  treeContainerStyle: treeContainerStyle,
23
- treeItemOtherSubscriptionStyle,
46
+ selectedTreeItemStyle,
47
+ treeItemStyle,
24
48
  };
25
49
  };
@@ -29,3 +29,4 @@ export * from './WfoStartButton';
29
29
  export * from './WfoSubscriptionsList';
30
30
  export * from './WfoSummary';
31
31
  export * from './WfoTitleWithWebsocketBadge';
32
+ export * from './WfoRadioDropdown';
@@ -17,4 +17,5 @@ export enum PolicyResource {
17
17
  TASKS_CREATE = '/orchestrator/processes/create/task',
18
18
  TASKS_RETRY_ALL = '/orchestrator/processes/all-tasks/retry',
19
19
  SETTINGS_FLUSH_CACHE = '/orchestrator/settings/flush-cache',
20
+ SET_IN_SYNC = '/orchestrator/subscriptions/set-in-sync',
20
21
  }
@@ -1 +1 @@
1
- export const ORCHESTRATOR_UI_LIBRARY_VERSION = '1.38.2';
1
+ export const ORCHESTRATOR_UI_LIBRARY_VERSION = '2.0.0';
@@ -0,0 +1,29 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import { WfoIconProps } from './WfoIconProps';
4
+
5
+ export const WfoXMarkSmall: FC<WfoIconProps> = ({
6
+ width = 20,
7
+ height = 20,
8
+ }) => (
9
+ <svg
10
+ width={width}
11
+ height={height}
12
+ viewBox="0 -2 16 16"
13
+ version="1.1"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ >
16
+ <title>icon/x-mark</title>
17
+ <g
18
+ id="Symbols"
19
+ stroke="none"
20
+ strokeWidth="1"
21
+ fill="none"
22
+ fillRule="evenodd"
23
+ >
24
+ <g xmlns="http://www.w3.org/2000/svg" fill="currentColor">
25
+ <path d="M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z" />
26
+ </g>
27
+ </g>
28
+ </svg>
29
+ );
@@ -357,6 +357,10 @@
357
357
  "setInSyncSuccess": {
358
358
  "title": "Subscription set in sync",
359
359
  "text": "The subscription was successfully set in sync."
360
+ },
361
+ "workflowsTab": {
362
+ "startWithOldestLabel": "Start with oldest first",
363
+ "startWithNewestLabel": "Start with newest first"
360
364
  }
361
365
  }
362
366
  },
@@ -356,6 +356,10 @@
356
356
  "setInSyncSuccess": {
357
357
  "title": "Subscription inSync",
358
358
  "text": "De subscription is in sync gezet."
359
+ },
360
+ "workflowsTab": {
361
+ "startWithOldestLabel": "Start met oudste eerst",
362
+ "startWithNewestLabel": "Start met nieuwste eerst"
359
363
  }
360
364
  }
361
365
  },
@@ -3,7 +3,6 @@ import React, { useEffect, useState } from 'react';
3
3
  import { useTranslations } from 'next-intl';
4
4
 
5
5
  import { EuiBadgeGroup } from '@elastic/eui';
6
- import type { Pagination } from '@elastic/eui/src/components';
7
6
 
8
7
  import {
9
8
  DEFAULT_PAGE_SIZE,
@@ -15,13 +14,15 @@ import {
15
14
  WfoFirstPartUUID,
16
15
  WfoProductBlockBadge,
17
16
  WfoProductStatusBadge,
18
- WfoTableColumns,
19
- WfoTableWithFilter,
20
17
  getDataSortHandler,
21
- getPageChangeHandler,
18
+ getPageIndexChangeHandler,
19
+ getPageSizeChangeHandler,
22
20
  getQueryStringHandler,
23
- mapSortableAndFilterableValuesToTableColumnConfig,
24
21
  } from '@/components';
22
+ import { WfoAdvancedTable } from '@/components/WfoTable/WfoAdvancedTable';
23
+ import { WfoAdvancedTableColumnConfig } from '@/components/WfoTable/WfoAdvancedTable/types';
24
+ import { ColumnType, Pagination } from '@/components/WfoTable/WfoTable';
25
+ import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/WfoTable/utils';
25
26
  import {
26
27
  useDataDisplayParams,
27
28
  useShowToastMessage,
@@ -47,21 +48,8 @@ import {
47
48
 
48
49
  import { WfoMetadataPageLayout } from './WfoMetadataPageLayout';
49
50
 
50
- const PRODUCT_BLOCK_FIELD_ID: keyof ProductBlockDefinition = 'productBlockId';
51
51
  const PRODUCT_BLOCK_FIELD_NAME: keyof ProductBlockDefinition = 'name';
52
52
 
53
- const PRODUCT_BLOCK_FIELD_TAG: keyof ProductBlockDefinition = 'tag';
54
- const PRODUCT_BLOCK_FIELD_DESCRIPTION: keyof ProductBlockDefinition =
55
- 'description';
56
- const PRODUCT_BLOCK_FIELD_STATUS: keyof ProductBlockDefinition = 'status';
57
- const PRODUCT_BLOCK_FIELD_CREATED_AT: keyof ProductBlockDefinition =
58
- 'createdAt';
59
- const PRODUCT_BLOCK_FIELD_END_DATE: keyof ProductBlockDefinition = 'endDate';
60
- const PRODUCT_BLOCK_FIELD_RESOURCE_TYPES: keyof ProductBlockDefinition =
61
- 'resourceTypes';
62
- const PRODUCT_BLOCK_FIELD_PRODUCT_BLOCKS: keyof ProductBlockDefinition =
63
- 'dependsOn';
64
-
65
53
  type ProductBlockDefinitionExportItem = Omit<
66
54
  ProductBlockDefinition,
67
55
  'resourceTypes' | 'dependsOn'
@@ -103,44 +91,42 @@ export const WfoProductBlocksPage = () => {
103
91
  },
104
92
  });
105
93
 
106
- const tableColumns: WfoTableColumns<ProductBlockDefinition> = {
94
+ const tableColumns: WfoAdvancedTableColumnConfig<ProductBlockDefinition> = {
107
95
  productBlockId: {
108
- field: PRODUCT_BLOCK_FIELD_ID,
109
- name: t('id'),
96
+ columnType: ColumnType.DATA,
97
+ label: t('id'),
110
98
  width: '90',
111
- render: (value) => <WfoFirstPartUUID UUID={value} />,
99
+ renderData: (value) => <WfoFirstPartUUID UUID={value} />,
112
100
  renderDetails: (value) => value,
113
101
  },
114
102
  name: {
115
- field: PRODUCT_BLOCK_FIELD_NAME,
116
- name: t('name'),
117
- width: '200',
118
- render: (name) => (
103
+ columnType: ColumnType.DATA,
104
+ label: t('name'),
105
+ renderData: (name) => (
119
106
  <WfoProductBlockBadge badgeType={BadgeType.PRODUCT_BLOCK}>
120
107
  {name}
121
108
  </WfoProductBlockBadge>
122
109
  ),
123
110
  },
124
111
  tag: {
125
- field: PRODUCT_BLOCK_FIELD_TAG,
126
- name: t('tag'),
127
- width: '140',
112
+ columnType: ColumnType.DATA,
113
+ label: t('tag'),
128
114
  },
129
115
  description: {
130
- field: PRODUCT_BLOCK_FIELD_DESCRIPTION,
131
- name: t('description'),
132
- width: '400',
116
+ columnType: ColumnType.DATA,
117
+ label: t('description'),
118
+ width: '400px',
133
119
  },
134
120
  status: {
135
- field: PRODUCT_BLOCK_FIELD_STATUS,
136
- name: t('status'),
137
- width: '90',
138
- render: (value) => <WfoProductStatusBadge status={value} />,
121
+ columnType: ColumnType.DATA,
122
+ label: t('status'),
123
+ width: '90px',
124
+ renderData: (value) => <WfoProductStatusBadge status={value} />,
139
125
  },
140
126
  dependsOn: {
141
- field: PRODUCT_BLOCK_FIELD_PRODUCT_BLOCKS,
142
- name: t('dependingProductBlocks'),
143
- render: (dependsOn) => (
127
+ columnType: ColumnType.DATA,
128
+ label: t('dependingProductBlocks'),
129
+ renderData: (dependsOn) => (
144
130
  <>
145
131
  {dependsOn.map((productBlock, index) => (
146
132
  <WfoProductBlockBadge
@@ -154,9 +140,9 @@ export const WfoProductBlocksPage = () => {
154
140
  ),
155
141
  },
156
142
  resourceTypes: {
157
- field: PRODUCT_BLOCK_FIELD_RESOURCE_TYPES,
158
- name: t('resourceTypes'),
159
- render: (resourceTypes) => (
143
+ columnType: ColumnType.DATA,
144
+ label: t('resourceTypes'),
145
+ renderData: (resourceTypes) => (
160
146
  <>
161
147
  {resourceTypes.map((resourceType, index) => (
162
148
  <WfoProductBlockBadge
@@ -182,16 +168,16 @@ export const WfoProductBlocksPage = () => {
182
168
  ),
183
169
  },
184
170
  createdAt: {
185
- field: PRODUCT_BLOCK_FIELD_CREATED_AT,
186
- name: t('createdAt'),
187
- render: (date) => <WfoDateTime dateOrIsoString={date} />,
171
+ columnType: ColumnType.DATA,
172
+ label: t('createdAt'),
173
+ renderData: (date) => <WfoDateTime dateOrIsoString={date} />,
188
174
  renderDetails: parseIsoString(parseDateToLocaleDateTimeString),
189
175
  clipboardText: parseIsoString(parseDateToLocaleDateTimeString),
190
176
  },
191
177
  endDate: {
192
- field: PRODUCT_BLOCK_FIELD_END_DATE,
193
- name: t('endDate'),
194
- render: (date) => <WfoDateTime dateOrIsoString={date} />,
178
+ columnType: ColumnType.DATA,
179
+ label: t('endDate'),
180
+ renderData: (date) => <WfoDateTime dateOrIsoString={date} />,
195
181
  renderDetails: parseIsoString(parseDateToLocaleDateTimeString),
196
182
  clipboardText: parseIsoString(parseDateToLocaleDateTimeString),
197
183
  },
@@ -223,10 +209,12 @@ export const WfoProductBlocksPage = () => {
223
209
  const { totalItems, sortFields, filterFields } = data?.pageInfo ?? {};
224
210
 
225
211
  const pagination: Pagination = {
226
- pageSize: pageSize,
227
- pageIndex: pageIndex,
212
+ pageIndex,
213
+ pageSize,
228
214
  pageSizeOptions: DEFAULT_PAGE_SIZES,
229
215
  totalItemCount: totalItems ? totalItems : 0,
216
+ onChangePage: getPageIndexChangeHandler(setDataDisplayParam),
217
+ onChangeItemsPerPage: getPageSizeChangeHandler(setDataDisplayParam),
230
218
  };
231
219
 
232
220
  const mapToExportItems = (
@@ -245,21 +233,16 @@ export const WfoProductBlocksPage = () => {
245
233
 
246
234
  return (
247
235
  <WfoMetadataPageLayout>
248
- <WfoTableWithFilter<ProductBlockDefinition>
236
+ <WfoAdvancedTable
249
237
  data={data?.productBlocks || []}
250
- tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
238
+ tableColumnConfig={mapSortableAndFilterableValuesToTableColumnConfig(
251
239
  tableColumns,
252
240
  sortFields,
253
241
  filterFields,
254
242
  )}
255
- dataSorting={dataSorting}
243
+ dataSorting={[dataSorting]}
256
244
  defaultHiddenColumns={tableDefaults?.hiddenColumns}
257
- onUpdateDataSort={getDataSortHandler<ProductBlockDefinition>(
258
- setDataDisplayParam,
259
- )}
260
- onUpdatePage={getPageChangeHandler<ProductBlockDefinition>(
261
- setDataDisplayParam,
262
- )}
245
+ onUpdateDataSorting={getDataSortHandler(setDataDisplayParam)}
263
246
  onUpdateQueryString={getQueryStringHandler<ProductBlockDefinition>(
264
247
  setDataDisplayParam,
265
248
  )}