@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.
- package/.turbo/turbo-build.log +11 -9
- package/.turbo/turbo-lint.log +5 -2
- package/.turbo/turbo-test.log +14 -14
- package/CHANGELOG.md +30 -0
- package/dist/index.d.ts +329 -172
- package/dist/index.js +6152 -5545
- package/dist/index.js.map +1 -0
- package/package.json +2 -2
- package/src/components/WfoContentHeader/WfoContentHeader.tsx +55 -0
- package/src/components/WfoContentHeader/index.ts +1 -0
- package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +6 -5
- package/src/components/WfoInlineNoteEdit/WfoInlineNoteEdit.tsx +105 -0
- package/src/components/WfoInlineNoteEdit/index.ts +1 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +3 -1
- package/src/components/WfoPageTemplate/WfoSidebar/WfoCopyright.tsx +1 -1
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +6 -6
- 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/WfoRenderElementOrString/WfoRenderElementOrString.tsx +16 -0
- package/src/components/WfoRenderElementOrString/index.ts +1 -0
- 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 +92 -84
- package/src/components/WfoSubscription/WfoSubscription.tsx +19 -37
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +17 -9
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +18 -156
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +119 -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/relatedSubscriptionsListItemsObjectMappers.ts +62 -0
- 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 +4 -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/WfoMetadataPageLayout.tsx +4 -4
- 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/processes/WfoProcessDetail.tsx +47 -55
- package/src/pages/settings/WfoSettingsPage.tsx +9 -4
- package/src/pages/startPage/WfoStartPage.tsx +17 -1
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +4 -5
- package/src/pages/tasks/WfoTasksListPage.tsx +44 -52
- package/src/pages/workflows/WfoWorkflowsListPage.tsx +4 -5
- package/src/rtk/endpoints/index.ts +1 -0
- package/src/rtk/endpoints/relatedSubscriptions.ts +5 -4
- package/src/rtk/endpoints/subscriptionActions.ts +11 -1
- package/src/utils/getObjectKeys.ts +3 -0
- package/src/utils/index.ts +5 -3
- package/tsup.config.ts +10 -0
- 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
|
@@ -1,23 +1,17 @@
|
|
|
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;
|
|
@@ -35,154 +29,28 @@ export const WfoSubscriptionGeneral = ({
|
|
|
35
29
|
subscriptionDetail,
|
|
36
30
|
isFetching,
|
|
37
31
|
}: WfoSubscriptionGeneralProps) => {
|
|
38
|
-
const t = useTranslations('subscriptions.detail');
|
|
39
32
|
const { overrideSections } =
|
|
40
33
|
useSubscriptionDetailGeneralSectionConfigurationOverride();
|
|
41
34
|
|
|
42
|
-
const
|
|
43
|
-
subscriptionDetail.customerDescriptions.length > 0;
|
|
35
|
+
const { metadata, fixedInputs, product } = subscriptionDetail;
|
|
44
36
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
key: t('subscriptionId'),
|
|
48
|
-
value: subscriptionDetail.subscriptionId,
|
|
49
|
-
textToCopy: subscriptionDetail.subscriptionId,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
key: t('productName'),
|
|
53
|
-
value: subscriptionDetail.product.name,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
key: t('description'),
|
|
57
|
-
value: subscriptionDetail.description,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
key: t('startDate'),
|
|
61
|
-
value: formatDate(subscriptionDetail.startDate),
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
key: t('endDate'),
|
|
65
|
-
value: formatDate(subscriptionDetail.endDate),
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
key: t('status'),
|
|
69
|
-
value: (
|
|
70
|
-
<WfoSubscriptionStatusBadge
|
|
71
|
-
status={subscriptionDetail.status}
|
|
72
|
-
/>
|
|
73
|
-
),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
key: t('insync'),
|
|
77
|
-
value: (
|
|
78
|
-
<WfoInSyncField
|
|
79
|
-
subscriptionDetail={subscriptionDetail}
|
|
80
|
-
isFetching={isFetching}
|
|
81
|
-
/>
|
|
82
|
-
),
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
key: t('customer'),
|
|
86
|
-
value:
|
|
87
|
-
subscriptionDetail && subscriptionDetail.customer
|
|
88
|
-
? `${subscriptionDetail.customer?.fullname}`
|
|
89
|
-
: '-',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
key: t('customerUuid'),
|
|
93
|
-
value:
|
|
94
|
-
subscriptionDetail && subscriptionDetail.customer
|
|
95
|
-
? `${subscriptionDetail.customer?.customerId}`
|
|
96
|
-
: '-',
|
|
97
|
-
textToCopy: subscriptionDetail.customer?.customerId,
|
|
98
|
-
},
|
|
99
|
-
...toOptionalArrayEntry(
|
|
100
|
-
{
|
|
101
|
-
key: t('customerDescriptions'),
|
|
102
|
-
value: (
|
|
103
|
-
<WfoCustomerDescriptionsField
|
|
104
|
-
customerDescriptions={
|
|
105
|
-
subscriptionDetail.customerDescriptions
|
|
106
|
-
}
|
|
107
|
-
/>
|
|
108
|
-
),
|
|
109
|
-
},
|
|
110
|
-
hasCustomerDescriptions,
|
|
111
|
-
),
|
|
112
|
-
{
|
|
113
|
-
key: t('note'),
|
|
114
|
-
value: (subscriptionDetail && subscriptionDetail.note) || '-',
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const getMetadataBlockData = (): WfoKeyValueTableDataType[] =>
|
|
119
|
-
Object.entries(subscriptionDetail.metadata).map(([key, value]) => ({
|
|
120
|
-
key: camelToHuman(key),
|
|
121
|
-
value: <WfoJsonCodeBlock data={value} isBasicStyle />,
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
const getFixedInputBlockData = (): WfoKeyValueTableDataType[] =>
|
|
125
|
-
subscriptionDetail.fixedInputs.map((fixedInput) => ({
|
|
126
|
-
key: fixedInput.field,
|
|
127
|
-
value: fixedInput.value,
|
|
128
|
-
}));
|
|
129
|
-
|
|
130
|
-
const getProductInfoBlockData = (): WfoKeyValueTableDataType[] => {
|
|
131
|
-
const product = subscriptionDetail.product;
|
|
132
|
-
return [
|
|
133
|
-
{
|
|
134
|
-
key: t('name'),
|
|
135
|
-
value: product.name,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
key: t('description'),
|
|
139
|
-
value: product.description,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
key: t('productType'),
|
|
143
|
-
value: product.productType,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
key: t('tag'),
|
|
147
|
-
value: product.tag,
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
key: t('status'),
|
|
151
|
-
value: <WfoProductStatusBadge status={product.status} />,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
key: t('created'),
|
|
155
|
-
value: formatDate(product.createdAt),
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
key: t('endDate'),
|
|
159
|
-
value: formatDate(product.endDate),
|
|
160
|
-
},
|
|
161
|
-
];
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const hasMetadata = Object.entries(subscriptionDetail.metadata).length > 0;
|
|
165
|
-
const hasFixedInputs = subscriptionDetail.fixedInputs.length > 0;
|
|
37
|
+
const hasMetadata = Object.entries(metadata).length > 0;
|
|
38
|
+
const hasFixedInputs = fixedInputs.length > 0;
|
|
166
39
|
|
|
167
40
|
const defaultConfiguration: WfoSubscriptionDetailGeneralConfiguration[] = [
|
|
168
41
|
{
|
|
169
42
|
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_SUBSCRIPTION_DETAILS,
|
|
170
43
|
node: (
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
44
|
+
<WfoSubscriptionDetailSection
|
|
45
|
+
subscriptionDetail={subscriptionDetail}
|
|
46
|
+
isFetching={isFetching}
|
|
174
47
|
/>
|
|
175
48
|
),
|
|
176
49
|
},
|
|
177
50
|
...toOptionalArrayEntry(
|
|
178
51
|
{
|
|
179
52
|
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_METADATA,
|
|
180
|
-
node:
|
|
181
|
-
<SubscriptionKeyValueBlock
|
|
182
|
-
title={t('metadata')}
|
|
183
|
-
keyValues={getMetadataBlockData()}
|
|
184
|
-
/>
|
|
185
|
-
),
|
|
53
|
+
node: <WfoSubscriptionMetadataSection metadata={metadata} />,
|
|
186
54
|
},
|
|
187
55
|
hasMetadata,
|
|
188
56
|
),
|
|
@@ -190,9 +58,8 @@ export const WfoSubscriptionGeneral = ({
|
|
|
190
58
|
{
|
|
191
59
|
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_FIXED_INPUTS,
|
|
192
60
|
node: (
|
|
193
|
-
<
|
|
194
|
-
|
|
195
|
-
keyValues={getFixedInputBlockData()}
|
|
61
|
+
<WfoSubscriptionFixedInputSection
|
|
62
|
+
fixedInputs={fixedInputs}
|
|
196
63
|
/>
|
|
197
64
|
),
|
|
198
65
|
},
|
|
@@ -200,12 +67,7 @@ export const WfoSubscriptionGeneral = ({
|
|
|
200
67
|
),
|
|
201
68
|
{
|
|
202
69
|
id: WfoSubscriptionGeneralSections.BLOCK_TITLE_PRODUCT_INFO,
|
|
203
|
-
node:
|
|
204
|
-
<SubscriptionKeyValueBlock
|
|
205
|
-
title={t('blockTitleProductInfo')}
|
|
206
|
-
keyValues={getProductInfoBlockData()}
|
|
207
|
-
/>
|
|
208
|
-
),
|
|
70
|
+
node: <WfoSubscriptionProductInfoSection product={product} />,
|
|
209
71
|
},
|
|
210
72
|
];
|
|
211
73
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
SubscriptionKeyValueBlock,
|
|
7
|
+
WfoCustomerDescriptionsField,
|
|
8
|
+
WfoInSyncField,
|
|
9
|
+
WfoInlineNoteEdit,
|
|
10
|
+
WfoSubscriptionStatusBadge,
|
|
11
|
+
} from '@/components';
|
|
12
|
+
import { SubscriptionDetail } from '@/types';
|
|
13
|
+
import { formatDate, toOptionalArrayEntry } from '@/utils';
|
|
14
|
+
|
|
15
|
+
interface WfoSubscriptionDetailSectionProps {
|
|
16
|
+
isFetching: boolean;
|
|
17
|
+
subscriptionDetail: SubscriptionDetail;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const WfoSubscriptionDetailSection = ({
|
|
21
|
+
isFetching,
|
|
22
|
+
subscriptionDetail,
|
|
23
|
+
}: WfoSubscriptionDetailSectionProps) => {
|
|
24
|
+
const t = useTranslations('subscriptions.detail');
|
|
25
|
+
|
|
26
|
+
const hasCustomerDescriptions =
|
|
27
|
+
subscriptionDetail.customerDescriptions.length > 0;
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
subscriptionId,
|
|
31
|
+
product,
|
|
32
|
+
description,
|
|
33
|
+
startDate,
|
|
34
|
+
endDate,
|
|
35
|
+
status,
|
|
36
|
+
customer,
|
|
37
|
+
customerDescriptions,
|
|
38
|
+
note,
|
|
39
|
+
} = subscriptionDetail;
|
|
40
|
+
|
|
41
|
+
const subscriptionDetailBlockData = [
|
|
42
|
+
{
|
|
43
|
+
key: t('subscriptionId'),
|
|
44
|
+
value: subscriptionId,
|
|
45
|
+
textToCopy: subscriptionId,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: t('productName'),
|
|
49
|
+
value: product.name,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: t('description'),
|
|
53
|
+
value: description,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: t('startDate'),
|
|
57
|
+
value: formatDate(startDate),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: t('endDate'),
|
|
61
|
+
value: formatDate(endDate),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: t('status'),
|
|
65
|
+
value: <WfoSubscriptionStatusBadge status={status} />,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: t('insync'),
|
|
69
|
+
value: (
|
|
70
|
+
<WfoInSyncField
|
|
71
|
+
subscriptionDetail={subscriptionDetail}
|
|
72
|
+
isFetching={isFetching}
|
|
73
|
+
/>
|
|
74
|
+
),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: t('customer'),
|
|
78
|
+
value:
|
|
79
|
+
subscriptionDetail && subscriptionDetail.customer
|
|
80
|
+
? `${customer?.fullname}`
|
|
81
|
+
: '-',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: t('customerUuid'),
|
|
85
|
+
value:
|
|
86
|
+
subscriptionDetail && customer
|
|
87
|
+
? `${customer?.customerId}`
|
|
88
|
+
: '-',
|
|
89
|
+
textToCopy: customer?.customerId,
|
|
90
|
+
},
|
|
91
|
+
...toOptionalArrayEntry(
|
|
92
|
+
{
|
|
93
|
+
key: t('customerDescriptions'),
|
|
94
|
+
value: (
|
|
95
|
+
<WfoCustomerDescriptionsField
|
|
96
|
+
customerDescriptions={customerDescriptions}
|
|
97
|
+
/>
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
hasCustomerDescriptions,
|
|
101
|
+
),
|
|
102
|
+
{
|
|
103
|
+
key: t('note'),
|
|
104
|
+
value: (
|
|
105
|
+
<WfoInlineNoteEdit
|
|
106
|
+
subscriptionId={subscriptionId}
|
|
107
|
+
value={note}
|
|
108
|
+
/>
|
|
109
|
+
),
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<SubscriptionKeyValueBlock
|
|
115
|
+
title={t('blockTitleSubscriptionDetails')}
|
|
116
|
+
keyValues={subscriptionDetailBlockData}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl';
|
|
4
|
+
|
|
5
|
+
import { SubscriptionKeyValueBlock, WfoProductStatusBadge } from '@/components';
|
|
6
|
+
import { SubscriptionDetail } from '@/types';
|
|
7
|
+
import { formatDate } from '@/utils';
|
|
8
|
+
|
|
9
|
+
interface WfoSubscriptionProductInfoSectionProps {
|
|
10
|
+
product: SubscriptionDetail['product'];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const WfoSubscriptionProductInfoSection = ({
|
|
14
|
+
product,
|
|
15
|
+
}: WfoSubscriptionProductInfoSectionProps) => {
|
|
16
|
+
const t = useTranslations('subscriptions.detail');
|
|
17
|
+
|
|
18
|
+
const productInfoBlockData = [
|
|
19
|
+
{
|
|
20
|
+
key: t('name'),
|
|
21
|
+
value: product.name,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: t('description'),
|
|
25
|
+
value: product.description,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: t('productType'),
|
|
29
|
+
value: product.productType,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: t('tag'),
|
|
33
|
+
value: product.tag,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: t('status'),
|
|
37
|
+
value: <WfoProductStatusBadge status={product.status} />,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: t('created'),
|
|
41
|
+
value: formatDate(product.createdAt),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: t('endDate'),
|
|
45
|
+
value: formatDate(product.endDate),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<SubscriptionKeyValueBlock
|
|
51
|
+
title={t('blockTitleProductInfo')}
|
|
52
|
+
keyValues={productInfoBlockData}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -2,6 +2,8 @@ export * from './utils';
|
|
|
2
2
|
|
|
3
3
|
export * from './overrides';
|
|
4
4
|
|
|
5
|
+
export * from './WfoSubscriptionGeneralSections';
|
|
6
|
+
|
|
5
7
|
export * from './SubscriptionKeyValueBlock';
|
|
6
8
|
export * from './WfoInSyncField';
|
|
7
9
|
export * from './WfoProcessesTimeline';
|
|
@@ -11,3 +13,4 @@ export * from './WfoSubscriptionActions';
|
|
|
11
13
|
export * from './WfoSubscriptionProductBlock';
|
|
12
14
|
export * from './WfoSubscriptionDetailTree';
|
|
13
15
|
export * from './WfoSubscriptionGeneral';
|
|
16
|
+
export * from './WfoCustomerDescriptionsField';
|
|
@@ -2,7 +2,9 @@ import { css } from '@emotion/react';
|
|
|
2
2
|
|
|
3
3
|
import { WfoTheme } from '@/hooks';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const getSubscriptionDetailStyles = ({ theme }: WfoTheme) => {
|
|
6
|
+
const productBlockTreeWidth = theme.base * 28;
|
|
7
|
+
|
|
6
8
|
const contentCellStyle = css({
|
|
7
9
|
padding: (theme.base / 4) * 3,
|
|
8
10
|
borderBottom: theme.border.thin,
|
|
@@ -63,5 +65,6 @@ export const getStyles = ({ theme }: WfoTheme) => {
|
|
|
63
65
|
lastContentCellStyle,
|
|
64
66
|
lastHeaderCellStyle,
|
|
65
67
|
inUseByRelationDetailsStyle,
|
|
68
|
+
productBlockTreeWidth,
|
|
66
69
|
};
|
|
67
70
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { RelatedSubscriptionListItem } from '@/components';
|
|
2
|
+
import { RelatedSubscriptionsResponse } from '@/rtk';
|
|
3
|
+
import { GraphQLSort, GraphqlFilter, RelatedSubscription } from '@/types';
|
|
4
|
+
import { parseDate } from '@/utils';
|
|
5
|
+
|
|
6
|
+
export const mapRelatedSubscriptionsResponseToRelatedSubscriptionsListItems = (
|
|
7
|
+
input?: RelatedSubscriptionsResponse,
|
|
8
|
+
): RelatedSubscriptionListItem[] =>
|
|
9
|
+
input?.relatedSubscriptions.map(
|
|
10
|
+
({
|
|
11
|
+
subscriptionId,
|
|
12
|
+
description,
|
|
13
|
+
status,
|
|
14
|
+
insync,
|
|
15
|
+
customer,
|
|
16
|
+
product,
|
|
17
|
+
startDate,
|
|
18
|
+
}) => ({
|
|
19
|
+
subscriptionId,
|
|
20
|
+
description,
|
|
21
|
+
status,
|
|
22
|
+
insync,
|
|
23
|
+
customerFullname: customer.fullname,
|
|
24
|
+
tag: product.tag,
|
|
25
|
+
startDate: parseDate(startDate),
|
|
26
|
+
}),
|
|
27
|
+
) ?? [];
|
|
28
|
+
|
|
29
|
+
// Some fields are not a key of Process, however backend still supports them
|
|
30
|
+
// Backend concatenates object name with the key, e.g. product.name becomes productName
|
|
31
|
+
// Todo: typecast is needed until ticket is implemented:
|
|
32
|
+
// https://github.com/workfloworchestrator/orchestrator-ui/issues/290
|
|
33
|
+
const relatedSubscriptionsFieldMapper = (
|
|
34
|
+
field: keyof RelatedSubscriptionListItem,
|
|
35
|
+
): keyof RelatedSubscription => {
|
|
36
|
+
switch (field) {
|
|
37
|
+
case 'customerFullname':
|
|
38
|
+
return 'customer' as keyof RelatedSubscription;
|
|
39
|
+
case 'tag':
|
|
40
|
+
return 'product' as keyof RelatedSubscription;
|
|
41
|
+
default:
|
|
42
|
+
return field;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const graphQlRelatedSubscriptionsSortMapper = ({
|
|
47
|
+
field,
|
|
48
|
+
order,
|
|
49
|
+
}: GraphQLSort<RelatedSubscriptionListItem>): GraphQLSort<RelatedSubscription> => ({
|
|
50
|
+
field: relatedSubscriptionsFieldMapper(field),
|
|
51
|
+
order,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const graphQlRelatedSubscriptionsTerminatedSubscriptionsFilterMapper = (
|
|
55
|
+
data?: GraphqlFilter<RelatedSubscriptionListItem>,
|
|
56
|
+
): GraphqlFilter<RelatedSubscription> | undefined =>
|
|
57
|
+
data
|
|
58
|
+
? {
|
|
59
|
+
field: relatedSubscriptionsFieldMapper(data?.field),
|
|
60
|
+
value: data?.value,
|
|
61
|
+
}
|
|
62
|
+
: undefined;
|
|
@@ -64,19 +64,6 @@ describe('getProductBlockTitle()', () => {
|
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it("returns '[title]...' when title field is to long", () => {
|
|
68
|
-
const longTitle =
|
|
69
|
-
'title_value title_value title_value title_value title_value';
|
|
70
|
-
const valuesWithNameAndLongTitle = [
|
|
71
|
-
...instanceValues,
|
|
72
|
-
{ field: 'name', value: 'name_value' },
|
|
73
|
-
{ field: 'title', value: longTitle },
|
|
74
|
-
];
|
|
75
|
-
expect(getProductBlockTitle(valuesWithNameAndLongTitle)).toBe(
|
|
76
|
-
'title_value title_value title_value title_val...',
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
67
|
it('returns empty string when there are no title or name fields', () => {
|
|
81
68
|
expect(getProductBlockTitle(instanceValues)).toBe('');
|
|
82
69
|
});
|
|
@@ -5,13 +5,12 @@ import { EuiThemeComputed } from '@elastic/eui';
|
|
|
5
5
|
import {
|
|
6
6
|
FieldValue,
|
|
7
7
|
ProcessStatus,
|
|
8
|
+
SortOrder,
|
|
8
9
|
SubscriptionAction,
|
|
9
10
|
SubscriptionDetailProcess,
|
|
10
11
|
WorkflowTarget,
|
|
11
12
|
} from '@/types';
|
|
12
13
|
|
|
13
|
-
const MAX_LABEL_LENGTH = 45;
|
|
14
|
-
|
|
15
14
|
export enum SubscriptionDetailTab {
|
|
16
15
|
GENERAL_TAB = 'general',
|
|
17
16
|
SERVICE_CONFIGURATION_TAB = 'service-configuration',
|
|
@@ -41,9 +40,7 @@ export const getProductBlockTitle = (
|
|
|
41
40
|
return getFieldFromProductBlockInstanceValues(instanceValues, 'name');
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
return title
|
|
45
|
-
? `${title.substring(0, MAX_LABEL_LENGTH)}...`
|
|
46
|
-
: title;
|
|
43
|
+
return title;
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
export const flattenArrayProps = (
|
|
@@ -130,3 +127,19 @@ export const getLatestTaskDate = (processes: SubscriptionDetailProcess[]) => {
|
|
|
130
127
|
|
|
131
128
|
return tasks.length > 0 ? tasks[0].startedAt : '';
|
|
132
129
|
};
|
|
130
|
+
|
|
131
|
+
export const sortProcessesByDate = (
|
|
132
|
+
processList: SubscriptionDetailProcess[],
|
|
133
|
+
sortOrder: SortOrder,
|
|
134
|
+
) => {
|
|
135
|
+
return [...processList].sort((a, b) => {
|
|
136
|
+
const dateA = new Date(a.startedAt).getTime();
|
|
137
|
+
const dateB = new Date(b.startedAt).getTime();
|
|
138
|
+
|
|
139
|
+
if (sortOrder === SortOrder.ASC) {
|
|
140
|
+
return dateA - dateB; // Ascending order (oldest first)
|
|
141
|
+
} else {
|
|
142
|
+
return dateB - dateA; // Descending order (newest first)
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|