@orchestrator-ui/orchestrator-ui-components 1.38.2 → 2.1.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 (113) hide show
  1. package/.turbo/turbo-build.log +11 -9
  2. package/.turbo/turbo-lint.log +5 -2
  3. package/.turbo/turbo-test.log +14 -14
  4. package/CHANGELOG.md +30 -0
  5. package/dist/index.d.ts +329 -172
  6. package/dist/index.js +6152 -5545
  7. package/dist/index.js.map +1 -0
  8. package/package.json +2 -2
  9. package/src/components/WfoContentHeader/WfoContentHeader.tsx +55 -0
  10. package/src/components/WfoContentHeader/index.ts +1 -0
  11. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +6 -5
  12. package/src/components/WfoInlineNoteEdit/WfoInlineNoteEdit.tsx +105 -0
  13. package/src/components/WfoInlineNoteEdit/index.ts +1 -0
  14. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +3 -1
  15. package/src/components/WfoPageTemplate/WfoSidebar/WfoCopyright.tsx +1 -1
  16. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +6 -6
  17. package/src/components/WfoProcessList/WfoProcessesList.tsx +52 -51
  18. package/src/components/WfoRadioDropdown/WfoRadioDropdown.tsx +88 -0
  19. package/src/components/WfoRadioDropdown/index.ts +1 -0
  20. package/src/components/WfoRenderElementOrString/WfoRenderElementOrString.tsx +16 -0
  21. package/src/components/WfoRenderElementOrString/index.ts +1 -0
  22. package/src/components/WfoSubscription/WfoInSyncField.tsx +13 -9
  23. package/src/components/WfoSubscription/WfoInUseByRelations.tsx +4 -2
  24. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +76 -29
  25. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +92 -84
  26. package/src/components/WfoSubscription/WfoSubscription.tsx +19 -37
  27. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +17 -9
  28. package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +18 -156
  29. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +119 -0
  30. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionFixedInputSection.tsx +28 -0
  31. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionMetadataSection.tsx +29 -0
  32. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionProductInfoSection.tsx +55 -0
  33. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/index.ts +4 -0
  34. package/src/components/WfoSubscription/index.ts +3 -0
  35. package/src/components/WfoSubscription/overrides/index.ts +1 -0
  36. package/src/components/WfoSubscription/styles.ts +4 -1
  37. package/src/components/WfoSubscription/utils/relatedSubscriptionsListItemsObjectMappers.ts +62 -0
  38. package/src/components/WfoSubscription/utils/utils.spec.ts +0 -13
  39. package/src/components/WfoSubscription/utils/utils.ts +18 -5
  40. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +105 -100
  41. package/src/components/WfoTable/{WfoTableWithFilter/WfoTableWithFilter.tsx → WfoAdvancedTable/WfoAdvancedTable.tsx} +65 -123
  42. package/src/components/WfoTable/WfoAdvancedTable/getRowDetailData.tsx +55 -0
  43. package/src/components/WfoTable/WfoAdvancedTable/index.ts +4 -0
  44. package/src/components/WfoTable/WfoAdvancedTable/toSortedTableColumnConfig.ts +12 -0
  45. package/src/components/WfoTable/WfoAdvancedTable/types.ts +23 -0
  46. package/src/components/WfoTable/WfoStatusColorField/WfoStatusColorField.tsx +16 -0
  47. package/src/components/WfoTable/WfoStatusColorField/index.ts +1 -0
  48. package/src/components/WfoTable/WfoStatusColorField/styles.ts +20 -0
  49. package/src/components/WfoTable/WfoTable/WfoExpandedRow.tsx +33 -0
  50. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandableRow.tsx +48 -0
  51. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandedGroupRow.tsx +71 -0
  52. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTable.tsx +100 -0
  53. package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTableGroups.tsx +74 -0
  54. package/src/components/WfoTable/WfoTable/WfoGroupedTable/styles.ts +39 -0
  55. package/src/components/WfoTable/WfoTable/WfoGroupedTable/useGroupedTableConfig.tsx +184 -0
  56. package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.spec.ts +133 -0
  57. package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.ts +41 -0
  58. package/src/components/WfoTable/WfoTable/WfoMultilineCell.tsx +13 -0
  59. package/src/components/WfoTable/WfoTable/WfoTable.tsx +201 -0
  60. package/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx +112 -0
  61. package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoSortDirectionIcon.tsx +3 -3
  62. package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoTableHeaderCell.tsx +4 -3
  63. package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/index.ts +2 -0
  64. package/src/components/WfoTable/WfoTable/WfoTableHeaderRow.tsx +114 -0
  65. package/src/components/WfoTable/WfoTable/WfoTruncateCell.tsx +23 -0
  66. package/src/components/WfoTable/WfoTable/constants.ts +1 -0
  67. package/src/components/WfoTable/WfoTable/index.ts +14 -0
  68. package/src/components/WfoTable/WfoTable/styles.ts +117 -0
  69. package/src/components/WfoTable/WfoTable/utils.spec.ts +79 -0
  70. package/src/components/WfoTable/WfoTable/utils.ts +78 -0
  71. package/src/components/WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx +13 -12
  72. package/src/components/WfoTable/WfoTableWithFilter/index.ts +1 -1
  73. package/src/components/WfoTable/index.ts +4 -5
  74. package/src/components/WfoTable/utils/columns.ts +1 -48
  75. package/src/components/WfoTable/utils/tableUtils.ts +13 -10
  76. package/src/components/WfoTree/WfoTreeBranch.tsx +10 -1
  77. package/src/components/WfoTree/WfoTreeNode.tsx +8 -57
  78. package/src/components/WfoTree/WfoTreeNodeListItem.tsx +65 -0
  79. package/src/components/WfoTree/styles.ts +28 -4
  80. package/src/components/index.ts +4 -0
  81. package/src/configuration/policy-resources.ts +1 -0
  82. package/src/configuration/version.ts +1 -1
  83. package/src/icons/WfoXMarkSmall.tsx +29 -0
  84. package/src/messages/en-GB.json +4 -0
  85. package/src/messages/nl-NL.json +4 -0
  86. package/src/pages/metadata/WfoMetadataPageLayout.tsx +4 -4
  87. package/src/pages/metadata/WfoProductBlocksPage.tsx +42 -59
  88. package/src/pages/metadata/WfoProductsPage.tsx +41 -47
  89. package/src/pages/metadata/WfoResourceTypesPage.tsx +26 -35
  90. package/src/pages/metadata/WfoTasksPage.tsx +35 -33
  91. package/src/pages/metadata/WfoWorkflowsPage.tsx +33 -29
  92. package/src/pages/processes/WfoProcessDetail.tsx +47 -55
  93. package/src/pages/settings/WfoSettingsPage.tsx +9 -4
  94. package/src/pages/startPage/WfoStartPage.tsx +17 -1
  95. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +4 -5
  96. package/src/pages/tasks/WfoTasksListPage.tsx +44 -52
  97. package/src/pages/workflows/WfoWorkflowsListPage.tsx +4 -5
  98. package/src/rtk/endpoints/index.ts +1 -0
  99. package/src/rtk/endpoints/relatedSubscriptions.ts +5 -4
  100. package/src/rtk/endpoints/subscriptionActions.ts +11 -1
  101. package/src/utils/getObjectKeys.ts +3 -0
  102. package/src/utils/index.ts +5 -3
  103. package/tsup.config.ts +10 -0
  104. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +0 -194
  105. package/src/components/WfoTable/WfoBasicTable/WfoStatusColorField.tsx +0 -21
  106. package/src/components/WfoTable/WfoBasicTable/index.ts +0 -5
  107. package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.stories.tsx +0 -136
  108. package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.tsx +0 -146
  109. package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts +0 -113
  110. package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.ts +0 -81
  111. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts +0 -52
  112. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +0 -23
  113. /package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/styles.ts +0 -0
@@ -15,7 +15,7 @@ import { useWithOrchestratorTheme } from '@/hooks';
15
15
  import { useGetInUseByRelationDetailsQuery } from '@/rtk';
16
16
  import { InUseByRelation, InUseByRelationDetail } from '@/types';
17
17
 
18
- import { getStyles } from './styles';
18
+ import { getSubscriptionDetailStyles } from './styles';
19
19
 
20
20
  interface WfoInUseByRelationsProps {
21
21
  inUseByRelations: InUseByRelation[];
@@ -25,7 +25,9 @@ export const WfoInUseByRelations = ({
25
25
  inUseByRelations,
26
26
  }: WfoInUseByRelationsProps) => {
27
27
  const t = useTranslations('subscriptions.detail');
28
- const { inUseByRelationDetailsStyle } = useWithOrchestratorTheme(getStyles);
28
+ const { inUseByRelationDetailsStyle } = useWithOrchestratorTheme(
29
+ getSubscriptionDetailStyles,
30
+ );
29
31
  const subscriptionIds = inUseByRelations
30
32
  .map((relation) => relation.subscription_id)
31
33
  .join('|');
@@ -2,17 +2,28 @@ import React from 'react';
2
2
 
3
3
  import { useTranslations } from 'next-intl';
4
4
 
5
- import { EuiComment, EuiCommentList, EuiSpacer, EuiText } from '@elastic/eui';
5
+ import {
6
+ EuiComment,
7
+ EuiCommentList,
8
+ EuiFlexGroup,
9
+ EuiSpacer,
10
+ EuiText,
11
+ } from '@elastic/eui';
12
+
13
+ import { WfoLoading, WfoRadioDropdownOption } from '@/components';
14
+ import { PATH_TASKS, PATH_WORKFLOWS } from '@/components';
15
+ import { WfoRadioDropdown, sortProcessesByDate } from '@/components';
16
+ import { useWithOrchestratorTheme } from '@/hooks';
17
+ import { SortOrder, SubscriptionDetailProcess } from '@/types';
18
+ import {
19
+ parseDate,
20
+ parseDateToLocaleDateTimeString,
21
+ upperCaseFirstChar,
22
+ } from '@/utils';
6
23
 
7
- import { useWithOrchestratorTheme } from '../../hooks';
8
- import { SubscriptionDetailProcess } from '../../types';
9
- import { parseDate, parseDateToLocaleDateTimeString } from '../../utils';
10
- import { upperCaseFirstChar } from '../../utils';
11
24
  import { WfoProcessStatusBadge } from '../WfoBadges';
12
- import { WfoLoading } from '../WfoLoading';
13
- import { PATH_TASKS, PATH_WORKFLOWS } from '../WfoPageTemplate';
14
25
  import { WfoTargetTypeIcon } from './WfoTargetTypeIcon';
15
- import { getStyles } from './styles';
26
+ import { getSubscriptionDetailStyles } from './styles';
16
27
 
17
28
  interface WfoProcessCardProps {
18
29
  subscriptionDetailProcess: SubscriptionDetailProcess;
@@ -27,7 +38,7 @@ const WfoProcessCard = ({ subscriptionDetailProcess }: WfoProcessCardProps) => {
27
38
  emptyCellStyle,
28
39
  lastContentCellStyle,
29
40
  lastHeaderCellStyle,
30
- } = useWithOrchestratorTheme(getStyles);
41
+ } = useWithOrchestratorTheme(getSubscriptionDetailStyles);
31
42
  const processUrl = subscriptionDetailProcess.isTask
32
43
  ? PATH_TASKS
33
44
  : PATH_WORKFLOWS;
@@ -90,8 +101,9 @@ interface WfoRenderSubscriptionProcess {
90
101
  const WfoRenderSubscriptionProcess = ({
91
102
  subscriptionDetailProcess,
92
103
  }: WfoRenderSubscriptionProcess) => {
93
- const { timeLineStyle, workflowTargetStyle } =
94
- useWithOrchestratorTheme(getStyles);
104
+ const { timeLineStyle, workflowTargetStyle } = useWithOrchestratorTheme(
105
+ getSubscriptionDetailStyles,
106
+ );
95
107
 
96
108
  return (
97
109
  <EuiComment
@@ -103,14 +115,19 @@ const WfoRenderSubscriptionProcess = ({
103
115
  />
104
116
  }
105
117
  >
106
- <div css={timeLineStyle}>
118
+ <EuiFlexGroup
119
+ alignItems="center"
120
+ gutterSize="s"
121
+ css={timeLineStyle}
122
+ >
107
123
  <EuiText css={workflowTargetStyle}>
108
124
  {upperCaseFirstChar(
109
125
  subscriptionDetailProcess.workflowTarget,
110
126
  )}
111
127
  </EuiText>
128
+ <EuiText>-</EuiText>
112
129
  <EuiText>{subscriptionDetailProcess.workflowName}</EuiText>
113
- </div>
130
+ </EuiFlexGroup>
114
131
 
115
132
  <WfoProcessCard
116
133
  subscriptionDetailProcess={subscriptionDetailProcess}
@@ -126,26 +143,56 @@ interface WfoProcessesTimelineProps {
126
143
  export const WfoProcessesTimeline = ({
127
144
  subscriptionDetailProcesses,
128
145
  }: WfoProcessesTimelineProps) => {
146
+ const t = useTranslations('subscriptions.detail.workflowsTab');
147
+ const options: WfoRadioDropdownOption<SortOrder>[] = [
148
+ {
149
+ label: t('startWithOldestLabel'),
150
+ id: 'radioButtonOldest',
151
+ value: SortOrder.ASC,
152
+ },
153
+ {
154
+ label: t('startWithNewestLabel'),
155
+ id: 'radioButtonNewest',
156
+ value: SortOrder.DESC,
157
+ },
158
+ ];
159
+
160
+ const [selectedOption, setSelectedOption] = React.useState(options[0]);
161
+
162
+ const handleOnSelectOption = (
163
+ option: WfoRadioDropdownOption<SortOrder>,
164
+ ) => {
165
+ setSelectedOption(option);
166
+ };
167
+
168
+ const sortedProcesses = sortProcessesByDate(
169
+ subscriptionDetailProcesses,
170
+ selectedOption.value,
171
+ );
172
+
129
173
  return (
130
174
  <>
131
175
  <EuiSpacer size={'m'} />
132
176
  {!subscriptionDetailProcesses && <WfoLoading />}
133
- <EuiCommentList aria-label="Processes">
134
- {subscriptionDetailProcesses && (
135
- <EuiCommentList aria-label="Processes">
136
- {subscriptionDetailProcesses
137
- .filter((process) => !process.isTask)
138
- .map((subscriptionDetailProcess, index) => (
139
- <WfoRenderSubscriptionProcess
140
- key={index}
141
- subscriptionDetailProcess={
142
- subscriptionDetailProcess
143
- }
144
- />
145
- ))}
146
- </EuiCommentList>
147
- )}
148
- </EuiCommentList>
177
+ <WfoRadioDropdown
178
+ options={options}
179
+ onUpdateOption={handleOnSelectOption}
180
+ selectedOption={selectedOption}
181
+ />
182
+ {sortedProcesses && (
183
+ <EuiCommentList aria-label="Processes">
184
+ {sortedProcesses
185
+ .filter((process) => !process.isTask)
186
+ .map((subscriptionDetailProcess, index) => (
187
+ <WfoRenderSubscriptionProcess
188
+ key={index}
189
+ subscriptionDetailProcess={
190
+ subscriptionDetailProcess
191
+ }
192
+ />
193
+ ))}
194
+ </EuiCommentList>
195
+ )}
149
196
  </>
150
197
  );
151
198
  };
@@ -4,32 +4,51 @@ import { useTranslations } from 'next-intl';
4
4
  import Link from 'next/link';
5
5
 
6
6
  import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiSwitch } from '@elastic/eui';
7
- import type { Criteria, Pagination } from '@elastic/eui';
8
7
 
9
8
  import {
10
- DEFAULT_PAGE_SIZE,
11
9
  DEFAULT_PAGE_SIZES,
12
- WfoBasicTable,
10
+ SubscriptionListItem,
13
11
  WfoDataSorting,
14
12
  WfoFirstPartUUID,
15
13
  WfoInsyncIcon,
16
14
  WfoNoResults,
17
15
  WfoSubscriptionStatusBadge,
18
- WfoTableColumns,
19
16
  getDataSortHandler,
20
- getPageChangeHandler,
17
+ getPageIndexChangeHandler,
18
+ getPageSizeChangeHandler,
21
19
  } from '@/components';
22
20
  import { PATH_SUBSCRIPTIONS } from '@/components';
21
+ import {
22
+ graphQlRelatedSubscriptionsSortMapper,
23
+ graphQlRelatedSubscriptionsTerminatedSubscriptionsFilterMapper,
24
+ mapRelatedSubscriptionsResponseToRelatedSubscriptionsListItems,
25
+ } from '@/components/WfoSubscription/utils/relatedSubscriptionsListItemsObjectMappers';
26
+ import {
27
+ ColumnType,
28
+ Pagination,
29
+ WfoTable,
30
+ WfoTableColumnConfig,
31
+ } from '@/components/WfoTable/WfoTable';
32
+ import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/WfoTable/utils';
23
33
  import { useDataDisplayParams, useOrchestratorTheme } from '@/hooks';
24
34
  import { WfoSearchStrikethrough } from '@/icons';
25
- import { useGetRelatedSubscriptionsQuery } from '@/rtk';
26
35
  import {
27
- GraphqlFilter,
28
- RelatedSubscription,
29
- SortOrder,
30
- SubscriptionStatus,
31
- } from '@/types';
32
- import { parseDate, parseDateToLocaleDateString } from '@/utils';
36
+ RelatedSubscriptionVariables,
37
+ useGetRelatedSubscriptionsQuery,
38
+ } from '@/rtk';
39
+ import { GraphqlFilter, SortOrder, SubscriptionStatus } from '@/types';
40
+ import { parseDateToLocaleDateString } from '@/utils';
41
+
42
+ export type RelatedSubscriptionListItem = Pick<
43
+ SubscriptionListItem,
44
+ | 'subscriptionId'
45
+ | 'description'
46
+ | 'status'
47
+ | 'insync'
48
+ | 'customerFullname'
49
+ | 'tag'
50
+ | 'startDate'
51
+ >;
33
52
 
34
53
  interface WfoRelatedSubscriptionsProps {
35
54
  subscriptionId: string;
@@ -43,45 +62,50 @@ export const WfoRelatedSubscriptions = ({
43
62
  const t = useTranslations('subscriptions.detail');
44
63
  const { theme } = useOrchestratorTheme();
45
64
 
46
- const terminatedSubscriptionsFilter: GraphqlFilter<RelatedSubscription> = {
47
- field: 'status',
48
- value: `${SubscriptionStatus.ACTIVE}-${SubscriptionStatus.DISABLED}-${SubscriptionStatus.INITIAL}-${SubscriptionStatus.MIGRATING}-${SubscriptionStatus.PROVISIONING}`,
49
- };
65
+ const terminatedSubscriptionsFilter: GraphqlFilter<RelatedSubscriptionListItem> =
66
+ {
67
+ field: 'status',
68
+ value: `${SubscriptionStatus.ACTIVE}-${SubscriptionStatus.DISABLED}-${SubscriptionStatus.INITIAL}-${SubscriptionStatus.MIGRATING}-${SubscriptionStatus.PROVISIONING}`,
69
+ };
50
70
 
51
71
  const { dataDisplayParams, setDataDisplayParam } =
52
- useDataDisplayParams<RelatedSubscription>({
53
- pageSize: DEFAULT_PAGE_SIZE,
72
+ useDataDisplayParams<RelatedSubscriptionListItem>({
54
73
  sortBy: {
55
74
  field: 'startDate',
56
75
  order: SortOrder.DESC,
57
76
  },
58
77
  });
59
78
 
60
- const { data, isFetching, isLoading } = useGetRelatedSubscriptionsQuery({
79
+ const graphqlQueryVariables: RelatedSubscriptionVariables = {
61
80
  first: dataDisplayParams.pageSize,
62
81
  after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
63
82
  subscriptionId: subscriptionId,
64
- sortBy: dataDisplayParams.sortBy,
83
+ sortBy: graphQlRelatedSubscriptionsSortMapper(dataDisplayParams.sortBy),
65
84
  terminatedSubscriptionFilter: hideTerminatedSubscriptions
66
- ? terminatedSubscriptionsFilter
85
+ ? graphQlRelatedSubscriptionsTerminatedSubscriptionsFilterMapper(
86
+ terminatedSubscriptionsFilter,
87
+ )
67
88
  : undefined,
68
- });
89
+ };
90
+
91
+ const { data, isFetching, isLoading } = useGetRelatedSubscriptionsQuery(
92
+ graphqlQueryVariables,
93
+ );
69
94
 
70
- const relatedSubscriptions = data?.relatedSubscriptions;
95
+ const relatedSubscriptions =
96
+ mapRelatedSubscriptionsResponseToRelatedSubscriptionsListItems(data);
71
97
  const relatedSubscriptionsPageInfo = data?.pageInfo;
72
98
 
73
- const tableColumns: WfoTableColumns<RelatedSubscription> = {
99
+ const tableColumns: WfoTableColumnConfig<RelatedSubscriptionListItem> = {
74
100
  subscriptionId: {
75
- field: 'subscriptionId',
76
- name: t('id'),
77
- width: '100',
78
- render: (value) => <WfoFirstPartUUID UUID={value} />,
79
- filterable: false,
101
+ columnType: ColumnType.DATA,
102
+ label: t('id'),
103
+ renderData: (value) => <WfoFirstPartUUID UUID={value} />,
80
104
  },
81
105
  description: {
82
- field: 'description',
83
- name: t('description'),
84
- render: (value, record) => (
106
+ columnType: ColumnType.DATA,
107
+ label: t('description'),
108
+ renderData: (value, record) => (
85
109
  <Link
86
110
  target="_blank"
87
111
  href={`${PATH_SUBSCRIPTIONS}/${record.subscriptionId}`}
@@ -89,67 +113,52 @@ export const WfoRelatedSubscriptions = ({
89
113
  {value}
90
114
  </Link>
91
115
  ),
92
- filterable: false,
93
116
  },
94
117
  status: {
95
- field: 'status',
96
- name: t('status'),
97
- width: '130',
98
- render: (value) => <WfoSubscriptionStatusBadge status={value} />,
99
- filterable: false,
118
+ columnType: ColumnType.DATA,
119
+ label: t('status'),
120
+ renderData: (value) => (
121
+ <WfoSubscriptionStatusBadge status={value} />
122
+ ),
100
123
  },
101
124
  insync: {
102
- field: 'insync',
103
- name: t('insync'),
104
- width: '60',
105
- render: (value) => <WfoInsyncIcon inSync={value} />,
106
- filterable: false,
125
+ columnType: ColumnType.DATA,
126
+ label: t('insync'),
127
+ renderData: (value) => <WfoInsyncIcon inSync={value} />,
107
128
  },
108
- customer: {
109
- field: 'customer',
110
- name: t('customer'),
111
- render: (customer) => customer.fullname,
112
- sortable: false,
113
- filterable: false,
129
+ customerFullname: {
130
+ columnType: ColumnType.DATA,
131
+ label: t('customer'),
114
132
  },
115
- product: {
116
- field: 'product',
117
- name: t('tag'),
118
- width: '150',
119
- render: (product) => product.tag,
120
- filterable: false,
133
+ tag: {
134
+ columnType: ColumnType.DATA,
135
+ label: t('tag'),
136
+ width: '150px',
121
137
  },
122
138
  startDate: {
123
- field: 'startDate',
124
- name: t('startDate'),
125
- width: '100',
126
- render: (value) => parseDateToLocaleDateString(parseDate(value)),
127
- filterable: false,
139
+ columnType: ColumnType.DATA,
140
+ label: t('startDate'),
141
+ renderData: parseDateToLocaleDateString,
128
142
  },
129
143
  };
130
144
 
131
145
  const pagination: Pagination = {
132
146
  pageSize: dataDisplayParams.pageSize,
133
147
  pageIndex: dataDisplayParams.pageIndex,
134
- pageSizeOptions: DEFAULT_PAGE_SIZES,
135
148
  totalItemCount: relatedSubscriptionsPageInfo?.totalItems ?? 0,
149
+ pageSizeOptions: DEFAULT_PAGE_SIZES,
150
+ onChangeItemsPerPage: getPageSizeChangeHandler(setDataDisplayParam),
151
+ onChangePage: getPageIndexChangeHandler(setDataDisplayParam),
136
152
  };
137
153
 
138
- const dataSorting: WfoDataSorting<RelatedSubscription> = {
154
+ const dataSorting: WfoDataSorting<RelatedSubscriptionListItem> = {
139
155
  field: dataDisplayParams.sortBy?.field,
140
156
  sortOrder: dataDisplayParams.sortBy?.order,
141
157
  };
142
158
 
143
- const onUpdatePage =
144
- getPageChangeHandler<RelatedSubscription>(setDataDisplayParam);
145
-
146
- const handleCriteriaChange = (criterion: Criteria<RelatedSubscription>) =>
147
- criterion.page && onUpdatePage(criterion.page);
148
-
149
159
  const toggleTerminatedSubscriptions = () => {
150
160
  setHideTerminatedSubscriptions((currentValue) => !currentValue);
151
161
  };
152
-
153
162
  return (
154
163
  <>
155
164
  <EuiSpacer size="xl" />
@@ -165,26 +174,25 @@ export const WfoRelatedSubscriptions = ({
165
174
  </EuiFlexItem>
166
175
  </EuiFlexGroup>
167
176
  <EuiSpacer size="m" />
168
- {(relatedSubscriptions &&
169
- relatedSubscriptions.length > 0 &&
177
+ {(relatedSubscriptions?.length > 0 &&
170
178
  (!isLoading ||
171
179
  // This situation represents the situation where the hideRelatedsubscriptions is being toggled
172
180
  // in which case we don't want to show the loadingState because it makes the page flicker
173
181
  (!hideTerminatedSubscriptions &&
174
182
  relatedSubscriptions.length > 0)) && (
175
- <>
176
- <WfoBasicTable<RelatedSubscription>
177
- data={relatedSubscriptions}
178
- columns={tableColumns}
179
- pagination={pagination}
180
- isLoading={isFetching}
181
- onUpdateDataSorting={getDataSortHandler(
182
- setDataDisplayParam,
183
- )}
184
- dataSorting={dataSorting}
185
- onCriteriaChange={handleCriteriaChange}
186
- />
187
- </>
183
+ <WfoTable
184
+ data={relatedSubscriptions}
185
+ columnConfig={mapSortableAndFilterableValuesToTableColumnConfig<RelatedSubscriptionListItem>(
186
+ tableColumns,
187
+ data?.pageInfo.sortFields ?? [],
188
+ )}
189
+ pagination={pagination}
190
+ isLoading={isFetching}
191
+ onUpdateDataSorting={getDataSortHandler(
192
+ setDataDisplayParam,
193
+ )}
194
+ dataSorting={[dataSorting]}
195
+ />
188
196
  )) || (
189
197
  <WfoNoResults
190
198
  text={t('noRelatedSubscriptions')}
@@ -2,13 +2,6 @@ import React from 'react';
2
2
 
3
3
  import { StringParam, useQueryParam, withDefault } from 'use-query-params';
4
4
 
5
- import {
6
- EuiBadgeGroup,
7
- EuiFlexGroup,
8
- EuiFlexItem,
9
- EuiSpacer,
10
- } from '@elastic/eui';
11
-
12
5
  import {
13
6
  WfoFilterTabs,
14
7
  WfoLoading,
@@ -23,7 +16,7 @@ import {
23
16
  WfoSubscriptionSyncStatusBadge,
24
17
  WfoTitleWithWebsocketBadge,
25
18
  } from '@/components';
26
- import { useOrchestratorTheme } from '@/hooks';
19
+ import { WfoContentHeader } from '@/components/WfoContentHeader/WfoContentHeader';
27
20
  import { useGetSubscriptionDetailQuery } from '@/rtk/endpoints/subscriptionDetail';
28
21
 
29
22
  import { WfoError } from '../WfoError';
@@ -43,8 +36,6 @@ export const WfoSubscription = ({ subscriptionId }: WfoSubscriptionProps) => {
43
36
  ),
44
37
  );
45
38
 
46
- const { multiplyByBaseUnit } = useOrchestratorTheme();
47
-
48
39
  const selectedTab = ((): SubscriptionDetailTab => {
49
40
  return (
50
41
  subscriptionDetailTabs.find(({ id }) => id === activeTab)?.id ||
@@ -68,36 +59,27 @@ export const WfoSubscription = ({ subscriptionId }: WfoSubscriptionProps) => {
68
59
  (isLoading && <WfoLoading />) ||
69
60
  (subscriptionDetail && subscriptionDetail.subscriptionId && (
70
61
  <>
71
- <EuiFlexGroup
72
- style={{ marginBottom: 10 }}
73
- justifyContent="spaceBetween"
74
- >
75
- <EuiFlexItem grow={true}>
62
+ <WfoContentHeader
63
+ title={
76
64
  <WfoTitleWithWebsocketBadge
77
65
  title={subscriptionDetail.description}
78
66
  />
79
- <EuiSpacer size="xs" />
80
- <EuiBadgeGroup
81
- css={{ marginRight: multiplyByBaseUnit(1) }}
82
- >
83
- <EuiFlexItem grow={false}>
84
- <WfoSubscriptionStatusBadge
85
- status={subscriptionDetail.status}
86
- />
87
- </EuiFlexItem>
88
- <EuiFlexItem grow={false}>
89
- <WfoSubscriptionSyncStatusBadge
90
- insync={subscriptionDetail.insync}
91
- />
92
- </EuiFlexItem>
93
- </EuiBadgeGroup>
94
- </EuiFlexItem>
95
- <EuiFlexItem grow={false}>
96
- <WfoSubscriptionActions
97
- subscriptionId={subscriptionId}
98
- />
99
- </EuiFlexItem>
100
- </EuiFlexGroup>
67
+ }
68
+ subtitle={
69
+ <>
70
+ <WfoSubscriptionStatusBadge
71
+ status={subscriptionDetail.status}
72
+ />
73
+ <WfoSubscriptionSyncStatusBadge
74
+ insync={subscriptionDetail.insync}
75
+ />
76
+ </>
77
+ }
78
+ >
79
+ <WfoSubscriptionActions
80
+ subscriptionId={subscriptionId}
81
+ />
82
+ </WfoContentHeader>
101
83
 
102
84
  <WfoFilterTabs
103
85
  tabs={subscriptionDetailTabs}
@@ -6,6 +6,7 @@ import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
6
6
 
7
7
  import { WfoLoading, WfoTextAnchor } from '@/components';
8
8
  import { TreeContext, TreeContextType } from '@/contexts';
9
+ import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
9
10
  import {
10
11
  ProductBlockInstance,
11
12
  Subscription,
@@ -17,6 +18,7 @@ import { getTokenName } from '../../utils/getTokenName';
17
18
  import { WfoTree, getPositionInTree, sortTreeBlockByLabel } from '../WfoTree';
18
19
  import { getWfoTreeNodeDepth } from '../WfoTree';
19
20
  import { WfoSubscriptionProductBlock } from './WfoSubscriptionProductBlock';
21
+ import { getSubscriptionDetailStyles } from './styles';
20
22
  import { getProductBlockTitle } from './utils';
21
23
 
22
24
  interface WfoSubscriptionDetailTreeProps {
@@ -29,8 +31,11 @@ export const WfoSubscriptionDetailTree = ({
29
31
  subscriptionId,
30
32
  }: WfoSubscriptionDetailTreeProps) => {
31
33
  const t = useTranslations('subscriptions.detail');
34
+ const { theme } = useOrchestratorTheme();
32
35
  const [, setSelectedTreeNode] = useState(-1);
33
-
36
+ const { productBlockTreeWidth } = useWithOrchestratorTheme(
37
+ getSubscriptionDetailStyles,
38
+ );
34
39
  const { selectedIds, expandAll, collapseAll, resetSelection, selectAll } =
35
40
  React.useContext(TreeContext) as TreeContextType;
36
41
 
@@ -132,8 +137,10 @@ export const WfoSubscriptionDetailTree = ({
132
137
  >
133
138
  <EuiFlexItem
134
139
  style={{
135
- maxWidth: 450,
136
- overflow: 'auto',
140
+ minWidth: productBlockTreeWidth,
141
+ maxWidth: productBlockTreeWidth,
142
+ overflowX: 'hidden',
143
+ overflowY: 'auto',
137
144
  }}
138
145
  grow={true}
139
146
  >
@@ -175,6 +182,7 @@ export const WfoSubscriptionDetailTree = ({
175
182
  <EuiFlexItem
176
183
  css={{
177
184
  overflow: 'auto',
185
+ minWidth: 350,
178
186
  }}
179
187
  grow={true}
180
188
  >
@@ -183,23 +191,23 @@ export const WfoSubscriptionDetailTree = ({
183
191
  {/* This is a placeholder for the searchbar */}
184
192
  {selectedIds.length === 0 && (
185
193
  <EuiCallOut
186
- style={{
187
- marginTop: 15,
188
- display: 'flex',
194
+ css={{
195
+ marginTop: theme.size.m,
196
+ textAlign: 'center',
189
197
  }}
190
198
  size="m"
191
199
  title={t('noProductBlockSelected')}
192
200
  iconType="inspect"
193
201
  >
194
- <p>{t('ctaSelectProductBlock')} </p>
202
+ <EuiText>{t('ctaSelectProductBlock')} </EuiText>
195
203
  </EuiCallOut>
196
204
  )}
197
205
  {selectedIds.length !== 0 &&
198
- selectedIds.sort(sortByTree).map((id, index) => {
206
+ selectedIds.sort(sortByTree).map((id) => {
199
207
  const block = idToNodeMap[id];
200
208
  return (
201
209
  <WfoSubscriptionProductBlock
202
- key={index}
210
+ key={id}
203
211
  subscriptionId={subscriptionId}
204
212
  productBlock={block}
205
213
  />