@orchestrator-ui/orchestrator-ui-components 1.38.1 → 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.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +5 -2
- package/.turbo/turbo-test.log +11 -11
- package/CHANGELOG.md +25 -0
- package/dist/index.d.ts +252 -170
- package/dist/index.js +4355 -3498
- package/package.json +1 -1
- package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +6 -5
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +3 -1
- package/src/components/WfoPageTemplate/WfoSidebar/WfoCopyright.tsx +1 -1
- package/src/components/WfoProcessList/WfoProcessesList.tsx +52 -51
- package/src/components/WfoRadioDropdown/WfoRadioDropdown.tsx +88 -0
- package/src/components/WfoRadioDropdown/index.ts +1 -0
- package/src/components/WfoStartButton/WfoStartButtonComboBox.tsx +4 -0
- package/src/components/WfoStartButton/WfoStartTaskComboBox.tsx +1 -0
- package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +1 -0
- package/src/components/WfoStartButton/styles.ts +0 -4
- package/src/components/WfoSubscription/WfoInSyncField.tsx +13 -9
- package/src/components/WfoSubscription/WfoInUseByRelations.tsx +4 -2
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +76 -29
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +50 -56
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +17 -9
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +29 -160
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +113 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionFixedInputSection.tsx +28 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionMetadataSection.tsx +29 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionProductInfoSection.tsx +55 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/index.ts +4 -0
- package/src/components/WfoSubscription/index.ts +3 -0
- package/src/components/WfoSubscription/overrides/index.ts +1 -0
- package/src/components/WfoSubscription/styles.ts +4 -1
- package/src/components/WfoSubscription/utils/utils.spec.ts +0 -13
- package/src/components/WfoSubscription/utils/utils.ts +18 -5
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +105 -100
- package/src/components/WfoTable/{WfoTableWithFilter/WfoTableWithFilter.tsx → WfoAdvancedTable/WfoAdvancedTable.tsx} +65 -123
- package/src/components/WfoTable/WfoAdvancedTable/getRowDetailData.tsx +55 -0
- package/src/components/WfoTable/WfoAdvancedTable/index.ts +4 -0
- package/src/components/WfoTable/WfoAdvancedTable/toSortedTableColumnConfig.ts +12 -0
- package/src/components/WfoTable/WfoAdvancedTable/types.ts +23 -0
- package/src/components/WfoTable/WfoStatusColorField/WfoStatusColorField.tsx +16 -0
- package/src/components/WfoTable/WfoStatusColorField/index.ts +1 -0
- package/src/components/WfoTable/WfoStatusColorField/styles.ts +20 -0
- package/src/components/WfoTable/WfoTable/WfoExpandedRow.tsx +33 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandableRow.tsx +48 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandedGroupRow.tsx +71 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTable.tsx +100 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTableGroups.tsx +74 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/styles.ts +39 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/useGroupedTableConfig.tsx +184 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.spec.ts +133 -0
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.ts +41 -0
- package/src/components/WfoTable/WfoTable/WfoMultilineCell.tsx +13 -0
- package/src/components/WfoTable/WfoTable/WfoTable.tsx +201 -0
- package/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx +112 -0
- package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoSortDirectionIcon.tsx +3 -3
- package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/WfoTableHeaderCell.tsx +4 -3
- package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/index.ts +2 -0
- package/src/components/WfoTable/WfoTable/WfoTableHeaderRow.tsx +114 -0
- package/src/components/WfoTable/WfoTable/WfoTruncateCell.tsx +23 -0
- package/src/components/WfoTable/WfoTable/constants.ts +1 -0
- package/src/components/WfoTable/WfoTable/index.ts +14 -0
- package/src/components/WfoTable/WfoTable/styles.ts +117 -0
- package/src/components/WfoTable/WfoTable/utils.spec.ts +79 -0
- package/src/components/WfoTable/WfoTable/utils.ts +78 -0
- package/src/components/WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx +13 -12
- package/src/components/WfoTable/WfoTableWithFilter/index.ts +1 -1
- package/src/components/WfoTable/index.ts +4 -5
- package/src/components/WfoTable/utils/columns.ts +1 -48
- package/src/components/WfoTable/utils/tableUtils.ts +13 -10
- package/src/components/WfoTree/WfoTreeBranch.tsx +10 -1
- package/src/components/WfoTree/WfoTreeNode.tsx +8 -57
- package/src/components/WfoTree/WfoTreeNodeListItem.tsx +65 -0
- package/src/components/WfoTree/styles.ts +28 -4
- package/src/components/index.ts +1 -0
- package/src/configuration/policy-resources.ts +1 -0
- package/src/configuration/version.ts +1 -1
- package/src/icons/WfoXMarkSmall.tsx +29 -0
- package/src/messages/en-GB.json +4 -0
- package/src/messages/nl-NL.json +4 -0
- package/src/pages/metadata/WfoProductBlocksPage.tsx +42 -59
- package/src/pages/metadata/WfoProductsPage.tsx +41 -47
- package/src/pages/metadata/WfoResourceTypesPage.tsx +26 -35
- package/src/pages/metadata/WfoTasksPage.tsx +35 -33
- package/src/pages/metadata/WfoWorkflowsPage.tsx +33 -29
- package/src/pages/tasks/WfoTasksListPage.tsx +25 -19
- package/src/utils/getObjectKeys.ts +3 -0
- package/src/utils/index.ts +5 -3
- package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +0 -194
- package/src/components/WfoTable/WfoBasicTable/WfoStatusColorField.tsx +0 -21
- package/src/components/WfoTable/WfoBasicTable/index.ts +0 -5
- package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.stories.tsx +0 -136
- package/src/components/WfoTable/WfoDataGridTable/WfoDataGridTable.tsx +0 -146
- package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts +0 -113
- package/src/components/WfoTable/WfoDataGridTable/WfodataGridColumns.ts +0 -81
- package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts +0 -52
- package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +0 -23
- /package/src/components/WfoTable/{WfoBasicTable → WfoTable/WfoTableHeaderCell}/styles.ts +0 -0
|
@@ -4,22 +4,26 @@ 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,
|
|
13
10
|
WfoDataSorting,
|
|
14
11
|
WfoFirstPartUUID,
|
|
15
12
|
WfoInsyncIcon,
|
|
16
13
|
WfoNoResults,
|
|
17
14
|
WfoSubscriptionStatusBadge,
|
|
18
|
-
WfoTableColumns,
|
|
19
15
|
getDataSortHandler,
|
|
20
|
-
|
|
16
|
+
getPageIndexChangeHandler,
|
|
17
|
+
getPageSizeChangeHandler,
|
|
21
18
|
} from '@/components';
|
|
22
19
|
import { PATH_SUBSCRIPTIONS } from '@/components';
|
|
20
|
+
import {
|
|
21
|
+
ColumnType,
|
|
22
|
+
Pagination,
|
|
23
|
+
WfoTable,
|
|
24
|
+
WfoTableColumnConfig,
|
|
25
|
+
} from '@/components/WfoTable/WfoTable';
|
|
26
|
+
import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/WfoTable/utils';
|
|
23
27
|
import { useDataDisplayParams, useOrchestratorTheme } from '@/hooks';
|
|
24
28
|
import { WfoSearchStrikethrough } from '@/icons';
|
|
25
29
|
import { useGetRelatedSubscriptionsQuery } from '@/rtk';
|
|
@@ -50,7 +54,6 @@ export const WfoRelatedSubscriptions = ({
|
|
|
50
54
|
|
|
51
55
|
const { dataDisplayParams, setDataDisplayParam } =
|
|
52
56
|
useDataDisplayParams<RelatedSubscription>({
|
|
53
|
-
pageSize: DEFAULT_PAGE_SIZE,
|
|
54
57
|
sortBy: {
|
|
55
58
|
field: 'startDate',
|
|
56
59
|
order: SortOrder.DESC,
|
|
@@ -70,18 +73,17 @@ export const WfoRelatedSubscriptions = ({
|
|
|
70
73
|
const relatedSubscriptions = data?.relatedSubscriptions;
|
|
71
74
|
const relatedSubscriptionsPageInfo = data?.pageInfo;
|
|
72
75
|
|
|
73
|
-
const tableColumns:
|
|
76
|
+
const tableColumns: WfoTableColumnConfig<RelatedSubscription> = {
|
|
74
77
|
subscriptionId: {
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
columnType: ColumnType.DATA,
|
|
79
|
+
label: t('id'),
|
|
77
80
|
width: '100',
|
|
78
|
-
|
|
79
|
-
filterable: false,
|
|
81
|
+
renderData: (value) => <WfoFirstPartUUID UUID={value} />,
|
|
80
82
|
},
|
|
81
83
|
description: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
columnType: ColumnType.DATA,
|
|
85
|
+
label: t('description'),
|
|
86
|
+
renderData: (value, record) => (
|
|
85
87
|
<Link
|
|
86
88
|
target="_blank"
|
|
87
89
|
href={`${PATH_SUBSCRIPTIONS}/${record.subscriptionId}`}
|
|
@@ -89,50 +91,48 @@ export const WfoRelatedSubscriptions = ({
|
|
|
89
91
|
{value}
|
|
90
92
|
</Link>
|
|
91
93
|
),
|
|
92
|
-
filterable: false,
|
|
93
94
|
},
|
|
94
95
|
status: {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
columnType: ColumnType.DATA,
|
|
97
|
+
label: t('status'),
|
|
97
98
|
width: '130',
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
renderData: (value) => (
|
|
100
|
+
<WfoSubscriptionStatusBadge status={value} />
|
|
101
|
+
),
|
|
100
102
|
},
|
|
101
103
|
insync: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
columnType: ColumnType.DATA,
|
|
105
|
+
label: t('insync'),
|
|
104
106
|
width: '60',
|
|
105
|
-
|
|
106
|
-
filterable: false,
|
|
107
|
+
renderData: (value) => <WfoInsyncIcon inSync={value} />,
|
|
107
108
|
},
|
|
108
109
|
customer: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
sortable: false,
|
|
113
|
-
filterable: false,
|
|
110
|
+
columnType: ColumnType.DATA,
|
|
111
|
+
label: t('customer'),
|
|
112
|
+
renderData: (customer) => customer.fullname,
|
|
114
113
|
},
|
|
115
114
|
product: {
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
columnType: ColumnType.DATA,
|
|
116
|
+
label: t('tag'),
|
|
118
117
|
width: '150',
|
|
119
|
-
|
|
120
|
-
filterable: false,
|
|
118
|
+
renderData: (product) => product.tag,
|
|
121
119
|
},
|
|
122
120
|
startDate: {
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
columnType: ColumnType.DATA,
|
|
122
|
+
label: t('startDate'),
|
|
125
123
|
width: '100',
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
renderData: (value) =>
|
|
125
|
+
parseDateToLocaleDateString(parseDate(value)),
|
|
128
126
|
},
|
|
129
127
|
};
|
|
130
128
|
|
|
131
129
|
const pagination: Pagination = {
|
|
132
130
|
pageSize: dataDisplayParams.pageSize,
|
|
133
131
|
pageIndex: dataDisplayParams.pageIndex,
|
|
134
|
-
pageSizeOptions: DEFAULT_PAGE_SIZES,
|
|
135
132
|
totalItemCount: relatedSubscriptionsPageInfo?.totalItems ?? 0,
|
|
133
|
+
pageSizeOptions: DEFAULT_PAGE_SIZES,
|
|
134
|
+
onChangeItemsPerPage: getPageSizeChangeHandler(setDataDisplayParam),
|
|
135
|
+
onChangePage: getPageIndexChangeHandler(setDataDisplayParam),
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
const dataSorting: WfoDataSorting<RelatedSubscription> = {
|
|
@@ -140,12 +140,6 @@ export const WfoRelatedSubscriptions = ({
|
|
|
140
140
|
sortOrder: dataDisplayParams.sortBy?.order,
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
const onUpdatePage =
|
|
144
|
-
getPageChangeHandler<RelatedSubscription>(setDataDisplayParam);
|
|
145
|
-
|
|
146
|
-
const handleCriteriaChange = (criterion: Criteria<RelatedSubscription>) =>
|
|
147
|
-
criterion.page && onUpdatePage(criterion.page);
|
|
148
|
-
|
|
149
143
|
const toggleTerminatedSubscriptions = () => {
|
|
150
144
|
setHideTerminatedSubscriptions((currentValue) => !currentValue);
|
|
151
145
|
};
|
|
@@ -172,19 +166,19 @@ export const WfoRelatedSubscriptions = ({
|
|
|
172
166
|
// in which case we don't want to show the loadingState because it makes the page flicker
|
|
173
167
|
(!hideTerminatedSubscriptions &&
|
|
174
168
|
relatedSubscriptions.length > 0)) && (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
169
|
+
<WfoTable
|
|
170
|
+
data={relatedSubscriptions}
|
|
171
|
+
columnConfig={mapSortableAndFilterableValuesToTableColumnConfig<RelatedSubscription>(
|
|
172
|
+
tableColumns,
|
|
173
|
+
data.pageInfo.sortFields,
|
|
174
|
+
)}
|
|
175
|
+
pagination={pagination}
|
|
176
|
+
isLoading={isFetching}
|
|
177
|
+
onUpdateDataSorting={getDataSortHandler(
|
|
178
|
+
setDataDisplayParam,
|
|
179
|
+
)}
|
|
180
|
+
dataSorting={[dataSorting]}
|
|
181
|
+
/>
|
|
188
182
|
)) || (
|
|
189
183
|
<WfoNoResults
|
|
190
184
|
text={t('noRelatedSubscriptions')}
|
|
@@ -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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
187
|
-
marginTop:
|
|
188
|
-
|
|
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
|
-
<
|
|
202
|
+
<EuiText>{t('ctaSelectProductBlock')} </EuiText>
|
|
195
203
|
</EuiCallOut>
|
|
196
204
|
)}
|
|
197
205
|
{selectedIds.length !== 0 &&
|
|
198
|
-
selectedIds.sort(sortByTree).map((id
|
|
206
|
+
selectedIds.sort(sortByTree).map((id) => {
|
|
199
207
|
const block = idToNodeMap[id];
|
|
200
208
|
return (
|
|
201
209
|
<WfoSubscriptionProductBlock
|
|
202
|
-
key={
|
|
210
|
+
key={id}
|
|
203
211
|
subscriptionId={subscriptionId}
|
|
204
212
|
productBlock={block}
|
|
205
213
|
/>
|
|
@@ -1,204 +1,73 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { useTranslations } from 'next-intl';
|
|
4
|
-
|
|
5
3
|
import { EuiFlexGrid, EuiFlexItem } from '@elastic/eui';
|
|
6
4
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import {
|
|
6
|
+
WfoSubscriptionDetailSection,
|
|
7
|
+
WfoSubscriptionFixedInputSection,
|
|
8
|
+
WfoSubscriptionMetadataSection,
|
|
9
|
+
WfoSubscriptionProductInfoSection,
|
|
10
|
+
useSubscriptionDetailGeneralSectionConfigurationOverride,
|
|
11
|
+
} from '@/components';
|
|
10
12
|
import { WfoSubscriptionDetailGeneralConfiguration } from '@/rtk';
|
|
11
13
|
import { SubscriptionDetail } from '@/types';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
WfoProductStatusBadge,
|
|
16
|
-
WfoSubscriptionStatusBadge,
|
|
17
|
-
} from '../WfoBadges';
|
|
18
|
-
import { WfoKeyValueTableDataType } from '../WfoKeyValueTable/WfoKeyValueTable';
|
|
19
|
-
import { SubscriptionKeyValueBlock } from './SubscriptionKeyValueBlock';
|
|
20
|
-
import { WfoInSyncField } from './WfoInSyncField';
|
|
14
|
+
import { toOptionalArrayEntry } from '@/utils';
|
|
21
15
|
|
|
22
16
|
interface WfoSubscriptionGeneralProps {
|
|
23
17
|
subscriptionDetail: SubscriptionDetail;
|
|
24
18
|
isFetching: boolean;
|
|
25
19
|
}
|
|
26
20
|
|
|
21
|
+
export enum WfoSubscriptionGeneralSections {
|
|
22
|
+
BLOCK_TITLE_SUBSCRIPTION_DETAILS = 'blockTitleSubscriptionDetails',
|
|
23
|
+
BLOCK_TITLE_METADATA = 'metadata',
|
|
24
|
+
BLOCK_TITLE_FIXED_INPUTS = 'blockTitleFixedInputs',
|
|
25
|
+
BLOCK_TITLE_PRODUCT_INFO = 'blockTitleProductInfo',
|
|
26
|
+
}
|
|
27
|
+
|
|
27
28
|
export const WfoSubscriptionGeneral = ({
|
|
28
29
|
subscriptionDetail,
|
|
29
30
|
isFetching,
|
|
30
31
|
}: WfoSubscriptionGeneralProps) => {
|
|
31
|
-
const t = useTranslations('subscriptions.detail');
|
|
32
32
|
const { overrideSections } =
|
|
33
33
|
useSubscriptionDetailGeneralSectionConfigurationOverride();
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
subscriptionDetail.customerDescriptions.length > 0;
|
|
35
|
+
const { metadata, fixedInputs, product } = subscriptionDetail;
|
|
37
36
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
key: t('subscriptionId'),
|
|
41
|
-
value: subscriptionDetail.subscriptionId,
|
|
42
|
-
textToCopy: subscriptionDetail.subscriptionId,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: t('productName'),
|
|
46
|
-
value: subscriptionDetail.product.name,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
key: t('description'),
|
|
50
|
-
value: subscriptionDetail.description,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: t('startDate'),
|
|
54
|
-
value: formatDate(subscriptionDetail.startDate),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
key: t('endDate'),
|
|
58
|
-
value: formatDate(subscriptionDetail.endDate),
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
key: t('status'),
|
|
62
|
-
value: (
|
|
63
|
-
<WfoSubscriptionStatusBadge
|
|
64
|
-
status={subscriptionDetail.status}
|
|
65
|
-
/>
|
|
66
|
-
),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: t('insync'),
|
|
70
|
-
value: (
|
|
71
|
-
<WfoInSyncField
|
|
72
|
-
subscriptionDetail={subscriptionDetail}
|
|
73
|
-
isFetching={isFetching}
|
|
74
|
-
/>
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
key: t('customer'),
|
|
79
|
-
value:
|
|
80
|
-
subscriptionDetail && subscriptionDetail.customer
|
|
81
|
-
? `${subscriptionDetail.customer?.fullname}`
|
|
82
|
-
: '-',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
key: t('customerUuid'),
|
|
86
|
-
value:
|
|
87
|
-
subscriptionDetail && subscriptionDetail.customer
|
|
88
|
-
? `${subscriptionDetail.customer?.customerId}`
|
|
89
|
-
: '-',
|
|
90
|
-
textToCopy: subscriptionDetail.customer?.customerId,
|
|
91
|
-
},
|
|
92
|
-
...toOptionalArrayEntry(
|
|
93
|
-
{
|
|
94
|
-
key: t('customerDescriptions'),
|
|
95
|
-
value: (
|
|
96
|
-
<WfoCustomerDescriptionsField
|
|
97
|
-
customerDescriptions={
|
|
98
|
-
subscriptionDetail.customerDescriptions
|
|
99
|
-
}
|
|
100
|
-
/>
|
|
101
|
-
),
|
|
102
|
-
},
|
|
103
|
-
hasCustomerDescriptions,
|
|
104
|
-
),
|
|
105
|
-
{
|
|
106
|
-
key: t('note'),
|
|
107
|
-
value: (subscriptionDetail && subscriptionDetail.note) || '-',
|
|
108
|
-
},
|
|
109
|
-
];
|
|
110
|
-
|
|
111
|
-
const getMetadataBlockData = (): WfoKeyValueTableDataType[] =>
|
|
112
|
-
Object.entries(subscriptionDetail.metadata).map(([key, value]) => ({
|
|
113
|
-
key: camelToHuman(key),
|
|
114
|
-
value: <WfoJsonCodeBlock data={value} isBasicStyle />,
|
|
115
|
-
}));
|
|
116
|
-
|
|
117
|
-
const getFixedInputBlockData = (): WfoKeyValueTableDataType[] =>
|
|
118
|
-
subscriptionDetail.fixedInputs.map((fixedInput) => ({
|
|
119
|
-
key: fixedInput.field,
|
|
120
|
-
value: fixedInput.value,
|
|
121
|
-
}));
|
|
122
|
-
|
|
123
|
-
const getProductInfoBlockData = (): WfoKeyValueTableDataType[] => {
|
|
124
|
-
const product = subscriptionDetail.product;
|
|
125
|
-
return [
|
|
126
|
-
{
|
|
127
|
-
key: t('name'),
|
|
128
|
-
value: product.name,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
key: t('description'),
|
|
132
|
-
value: product.description,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
key: t('productType'),
|
|
136
|
-
value: product.productType,
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
key: t('tag'),
|
|
140
|
-
value: product.tag,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
key: t('status'),
|
|
144
|
-
value: <WfoProductStatusBadge status={product.status} />,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
key: t('created'),
|
|
148
|
-
value: formatDate(product.createdAt),
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
key: t('endDate'),
|
|
152
|
-
value: formatDate(product.endDate),
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const hasMetadata = Object.entries(subscriptionDetail.metadata).length > 0;
|
|
158
|
-
const hasFixedInputs = subscriptionDetail.fixedInputs.length > 0;
|
|
37
|
+
const hasMetadata = Object.entries(metadata).length > 0;
|
|
38
|
+
const hasFixedInputs = fixedInputs.length > 0;
|
|
159
39
|
|
|
160
40
|
const defaultConfiguration: WfoSubscriptionDetailGeneralConfiguration[] = [
|
|
161
41
|
{
|
|
162
|
-
id:
|
|
42
|
+
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_SUBSCRIPTION_DETAILS,
|
|
163
43
|
node: (
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
44
|
+
<WfoSubscriptionDetailSection
|
|
45
|
+
subscriptionDetail={subscriptionDetail}
|
|
46
|
+
isFetching={isFetching}
|
|
167
47
|
/>
|
|
168
48
|
),
|
|
169
49
|
},
|
|
170
50
|
...toOptionalArrayEntry(
|
|
171
51
|
{
|
|
172
|
-
id:
|
|
173
|
-
node:
|
|
174
|
-
<SubscriptionKeyValueBlock
|
|
175
|
-
title={t('metadata')}
|
|
176
|
-
keyValues={getMetadataBlockData()}
|
|
177
|
-
/>
|
|
178
|
-
),
|
|
52
|
+
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_METADATA,
|
|
53
|
+
node: <WfoSubscriptionMetadataSection metadata={metadata} />,
|
|
179
54
|
},
|
|
180
55
|
hasMetadata,
|
|
181
56
|
),
|
|
182
57
|
...toOptionalArrayEntry(
|
|
183
58
|
{
|
|
184
|
-
id:
|
|
59
|
+
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_FIXED_INPUTS,
|
|
185
60
|
node: (
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
keyValues={getFixedInputBlockData()}
|
|
61
|
+
<WfoSubscriptionFixedInputSection
|
|
62
|
+
fixedInputs={fixedInputs}
|
|
189
63
|
/>
|
|
190
64
|
),
|
|
191
65
|
},
|
|
192
66
|
hasFixedInputs,
|
|
193
67
|
),
|
|
194
68
|
{
|
|
195
|
-
id:
|
|
196
|
-
node:
|
|
197
|
-
<SubscriptionKeyValueBlock
|
|
198
|
-
title={t('blockTitleProductInfo')}
|
|
199
|
-
keyValues={getProductInfoBlockData()}
|
|
200
|
-
/>
|
|
201
|
-
),
|
|
69
|
+
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_PRODUCT_INFO,
|
|
70
|
+
node: <WfoSubscriptionProductInfoSection product={product} />,
|
|
202
71
|
},
|
|
203
72
|
];
|
|
204
73
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
SubscriptionKeyValueBlock,
|
|
7
|
+
WfoCustomerDescriptionsField,
|
|
8
|
+
WfoInSyncField,
|
|
9
|
+
WfoSubscriptionStatusBadge,
|
|
10
|
+
} from '@/components';
|
|
11
|
+
import { SubscriptionDetail } from '@/types';
|
|
12
|
+
import { formatDate, toOptionalArrayEntry } from '@/utils';
|
|
13
|
+
|
|
14
|
+
interface WfoSubscriptionDetailSectionProps {
|
|
15
|
+
isFetching: boolean;
|
|
16
|
+
subscriptionDetail: SubscriptionDetail;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const WfoSubscriptionDetailSection = ({
|
|
20
|
+
isFetching,
|
|
21
|
+
subscriptionDetail,
|
|
22
|
+
}: WfoSubscriptionDetailSectionProps) => {
|
|
23
|
+
const t = useTranslations('subscriptions.detail');
|
|
24
|
+
|
|
25
|
+
const hasCustomerDescriptions =
|
|
26
|
+
subscriptionDetail.customerDescriptions.length > 0;
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
subscriptionId,
|
|
30
|
+
product,
|
|
31
|
+
description,
|
|
32
|
+
startDate,
|
|
33
|
+
endDate,
|
|
34
|
+
status,
|
|
35
|
+
customer,
|
|
36
|
+
customerDescriptions,
|
|
37
|
+
note,
|
|
38
|
+
} = subscriptionDetail;
|
|
39
|
+
|
|
40
|
+
const subscriptionDetailBlockData = [
|
|
41
|
+
{
|
|
42
|
+
key: t('subscriptionId'),
|
|
43
|
+
value: subscriptionId,
|
|
44
|
+
textToCopy: subscriptionId,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: t('productName'),
|
|
48
|
+
value: product.name,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: t('description'),
|
|
52
|
+
value: description,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: t('startDate'),
|
|
56
|
+
value: formatDate(startDate),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: t('endDate'),
|
|
60
|
+
value: formatDate(endDate),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: t('status'),
|
|
64
|
+
value: <WfoSubscriptionStatusBadge status={status} />,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: t('insync'),
|
|
68
|
+
value: (
|
|
69
|
+
<WfoInSyncField
|
|
70
|
+
subscriptionDetail={subscriptionDetail}
|
|
71
|
+
isFetching={isFetching}
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: t('customer'),
|
|
77
|
+
value:
|
|
78
|
+
subscriptionDetail && subscriptionDetail.customer
|
|
79
|
+
? `${customer?.fullname}`
|
|
80
|
+
: '-',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: t('customerUuid'),
|
|
84
|
+
value:
|
|
85
|
+
subscriptionDetail && customer
|
|
86
|
+
? `${customer?.customerId}`
|
|
87
|
+
: '-',
|
|
88
|
+
textToCopy: customer?.customerId,
|
|
89
|
+
},
|
|
90
|
+
...toOptionalArrayEntry(
|
|
91
|
+
{
|
|
92
|
+
key: t('customerDescriptions'),
|
|
93
|
+
value: (
|
|
94
|
+
<WfoCustomerDescriptionsField
|
|
95
|
+
customerDescriptions={customerDescriptions}
|
|
96
|
+
/>
|
|
97
|
+
),
|
|
98
|
+
},
|
|
99
|
+
hasCustomerDescriptions,
|
|
100
|
+
),
|
|
101
|
+
{
|
|
102
|
+
key: t('note'),
|
|
103
|
+
value: note || '-',
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<SubscriptionKeyValueBlock
|
|
109
|
+
title={t('blockTitleSubscriptionDetails')}
|
|
110
|
+
keyValues={subscriptionDetailBlockData}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl';
|
|
4
|
+
|
|
5
|
+
import { SubscriptionKeyValueBlock } from '@/components';
|
|
6
|
+
import { SubscriptionDetail } from '@/types';
|
|
7
|
+
|
|
8
|
+
interface WfoSubscriptionFixedInputSectionProps {
|
|
9
|
+
fixedInputs: SubscriptionDetail['fixedInputs'];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const WfoSubscriptionFixedInputSection = ({
|
|
13
|
+
fixedInputs,
|
|
14
|
+
}: WfoSubscriptionFixedInputSectionProps) => {
|
|
15
|
+
const t = useTranslations('subscriptions.detail');
|
|
16
|
+
|
|
17
|
+
const fixedInputBlockData = fixedInputs.map((fixedInput) => ({
|
|
18
|
+
key: fixedInput.field,
|
|
19
|
+
value: fixedInput.value,
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<SubscriptionKeyValueBlock
|
|
24
|
+
title={t('blockTitleFixedInputs')}
|
|
25
|
+
keyValues={fixedInputBlockData}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl';
|
|
4
|
+
|
|
5
|
+
import { SubscriptionKeyValueBlock, WfoJsonCodeBlock } from '@/components';
|
|
6
|
+
import { SubscriptionDetail } from '@/types';
|
|
7
|
+
import { camelToHuman } from '@/utils';
|
|
8
|
+
|
|
9
|
+
interface WfoSubscriptionMetadataSectionProps {
|
|
10
|
+
metadata: SubscriptionDetail['metadata'];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const WfoSubscriptionMetadataSection = ({
|
|
14
|
+
metadata,
|
|
15
|
+
}: WfoSubscriptionMetadataSectionProps) => {
|
|
16
|
+
const t = useTranslations('subscriptions.detail');
|
|
17
|
+
|
|
18
|
+
const metadataBlockData = Object.entries(metadata).map(([key, value]) => ({
|
|
19
|
+
key: camelToHuman(key),
|
|
20
|
+
value: <WfoJsonCodeBlock data={value} isBasicStyle />,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<SubscriptionKeyValueBlock
|
|
25
|
+
title={t('metadata')}
|
|
26
|
+
keyValues={metadataBlockData}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
};
|