@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestrator-ui/orchestrator-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Library of UI Components used to display the workflow orchestrator frontend",
|
|
6
6
|
"author": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"test": "jest",
|
|
26
26
|
"generate-version": "node -p \"'export const ORCHESTRATOR_UI_LIBRARY_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/configuration/version.ts && prettier --write src/configuration/version.ts",
|
|
27
|
-
"build": "npm run generate-version && tsup src/index.ts
|
|
27
|
+
"build": "npm run generate-version && tsup src/index.ts",
|
|
28
28
|
"tsc": "tsc --noEmit",
|
|
29
29
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
30
30
|
"dev": "npm run build -- --watch",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { FC, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EuiFlexGroup,
|
|
5
|
+
EuiFlexItem,
|
|
6
|
+
EuiPageHeader,
|
|
7
|
+
EuiSpacer,
|
|
8
|
+
} from '@elastic/eui';
|
|
9
|
+
|
|
10
|
+
import { WfoRenderElementOrString } from '@/components';
|
|
11
|
+
|
|
12
|
+
export type WfoContentHeaderProps = {
|
|
13
|
+
title: ReactElement | string;
|
|
14
|
+
subtitle?: ReactElement | string;
|
|
15
|
+
children?: ReactElement | ReactElement[] | string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const WfoContentHeader: FC<WfoContentHeaderProps> = ({
|
|
19
|
+
title,
|
|
20
|
+
subtitle,
|
|
21
|
+
children,
|
|
22
|
+
}) => (
|
|
23
|
+
<>
|
|
24
|
+
<EuiFlexGroup>
|
|
25
|
+
<EuiFlexItem>
|
|
26
|
+
<WfoRenderElementOrString
|
|
27
|
+
renderString={(value) => (
|
|
28
|
+
<EuiPageHeader pageTitle={value} />
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
{title}
|
|
32
|
+
</WfoRenderElementOrString>
|
|
33
|
+
</EuiFlexItem>
|
|
34
|
+
|
|
35
|
+
{children && (
|
|
36
|
+
<EuiFlexItem>
|
|
37
|
+
<EuiFlexGroup justifyContent="flexEnd">
|
|
38
|
+
<WfoRenderElementOrString>
|
|
39
|
+
{children}
|
|
40
|
+
</WfoRenderElementOrString>
|
|
41
|
+
</EuiFlexGroup>
|
|
42
|
+
</EuiFlexItem>
|
|
43
|
+
)}
|
|
44
|
+
</EuiFlexGroup>
|
|
45
|
+
|
|
46
|
+
{subtitle && (
|
|
47
|
+
<>
|
|
48
|
+
<EuiSpacer size="m" />
|
|
49
|
+
<WfoRenderElementOrString>{subtitle}</WfoRenderElementOrString>
|
|
50
|
+
</>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
<EuiSpacer size="l" />
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoContentHeader';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2019-
|
|
2
|
+
* Copyright 2019-2024 SURF.
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License.
|
|
5
5
|
* You may obtain a copy of the License at
|
|
@@ -18,7 +18,7 @@ import { connectField, filterDOMProps } from 'uniforms';
|
|
|
18
18
|
|
|
19
19
|
import { EuiFormRow, EuiText } from '@elastic/eui';
|
|
20
20
|
|
|
21
|
-
import { WfoLoading,
|
|
21
|
+
import { WfoLoading, WfoSubscriptionDetailSection } from '@/components';
|
|
22
22
|
import { useGetSubscriptionDetailQuery } from '@/rtk';
|
|
23
23
|
|
|
24
24
|
import { FieldProps } from './types';
|
|
@@ -35,14 +35,15 @@ const SubscriptionSummaryDisplay = ({
|
|
|
35
35
|
const { data, isFetching } = useGetSubscriptionDetailQuery({
|
|
36
36
|
subscriptionId,
|
|
37
37
|
});
|
|
38
|
+
const subscriptionDetail = data?.subscription;
|
|
38
39
|
|
|
39
|
-
if (!
|
|
40
|
+
if (!subscriptionDetail) {
|
|
40
41
|
return <WfoLoading />;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
|
-
<
|
|
45
|
-
subscriptionDetail={
|
|
45
|
+
<WfoSubscriptionDetailSection
|
|
46
|
+
subscriptionDetail={subscriptionDetail}
|
|
46
47
|
isFetching={isFetching}
|
|
47
48
|
/>
|
|
48
49
|
);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import type { ChangeEvent, FC } from 'react';
|
|
3
|
+
|
|
4
|
+
import { EuiInlineEditText } from '@elastic/eui';
|
|
5
|
+
|
|
6
|
+
import { useStartProcessMutation } from '@/rtk/endpoints/forms';
|
|
7
|
+
import type { Subscription } from '@/types';
|
|
8
|
+
|
|
9
|
+
interface WfoInlineNoteEditProps {
|
|
10
|
+
value: Subscription['note'];
|
|
11
|
+
subscriptionId?: Subscription['subscriptionId'];
|
|
12
|
+
onlyShowOnHover?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const WfoInlineNoteEdit: FC<WfoInlineNoteEditProps> = ({
|
|
16
|
+
value,
|
|
17
|
+
subscriptionId,
|
|
18
|
+
onlyShowOnHover = false,
|
|
19
|
+
}) => {
|
|
20
|
+
const initialNote = useMemo(() => value || '', [value]);
|
|
21
|
+
const [note, setNote] = useState<string>(initialNote);
|
|
22
|
+
|
|
23
|
+
const [startProcess] = useStartProcessMutation();
|
|
24
|
+
const triggerNoteModifyWorkflow = () => {
|
|
25
|
+
const noteModifyPayload = [
|
|
26
|
+
{ subscription_id: subscriptionId },
|
|
27
|
+
{ note },
|
|
28
|
+
];
|
|
29
|
+
startProcess({
|
|
30
|
+
workflowName: 'modify_note',
|
|
31
|
+
userInputs: noteModifyPayload,
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// This useEffect makes sure the note is updated when a new value property is passed in
|
|
36
|
+
// for example by a parent component that is update through a websocket event
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setNote(initialNote);
|
|
39
|
+
}, [initialNote]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
css={{
|
|
44
|
+
width: '100%',
|
|
45
|
+
':hover': {
|
|
46
|
+
'.euiIcon': {
|
|
47
|
+
visibility: 'visible',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<EuiInlineEditText
|
|
53
|
+
inputAriaLabel="Edit note"
|
|
54
|
+
value={note}
|
|
55
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
56
|
+
setNote(e.target.value);
|
|
57
|
+
}}
|
|
58
|
+
onCancel={() => setNote(initialNote)}
|
|
59
|
+
onSave={() => triggerNoteModifyWorkflow()}
|
|
60
|
+
size={'s'}
|
|
61
|
+
css={{
|
|
62
|
+
'.euiFlexItem:nth-of-type(2)': { justifyContent: 'center' },
|
|
63
|
+
}}
|
|
64
|
+
readModeProps={{
|
|
65
|
+
css: {
|
|
66
|
+
'.euiIcon': {
|
|
67
|
+
visibility: onlyShowOnHover ? 'hidden' : 'visible',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
}}
|
|
71
|
+
editModeProps={{
|
|
72
|
+
saveButtonProps: {
|
|
73
|
+
color: 'primary',
|
|
74
|
+
size: 'xs',
|
|
75
|
+
},
|
|
76
|
+
cancelButtonProps: {
|
|
77
|
+
color: 'danger',
|
|
78
|
+
size: 'xs',
|
|
79
|
+
},
|
|
80
|
+
inputProps: {
|
|
81
|
+
css: {
|
|
82
|
+
height: '32px',
|
|
83
|
+
paddingLeft: '4px',
|
|
84
|
+
margin: '0',
|
|
85
|
+
width: '98%',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
formRowProps: {
|
|
89
|
+
css: {
|
|
90
|
+
padding: 0,
|
|
91
|
+
margin: 0,
|
|
92
|
+
height: '32px',
|
|
93
|
+
'.euiFormRow__fieldWrapper': {
|
|
94
|
+
minHeight: '32px',
|
|
95
|
+
height: '32px',
|
|
96
|
+
padding: 0,
|
|
97
|
+
margin: 0,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoInlineNoteEdit';
|
|
@@ -52,7 +52,9 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
|
|
|
52
52
|
return (
|
|
53
53
|
<EuiHeader css={getHeaderStyle(navigationHeight)}>
|
|
54
54
|
<EuiHeaderSection>
|
|
55
|
-
<EuiToolTip
|
|
55
|
+
<EuiToolTip
|
|
56
|
+
content={'UI version' + ORCHESTRATOR_UI_LIBRARY_VERSION}
|
|
57
|
+
>
|
|
56
58
|
<EuiHeaderSectionItem css={{ paddingTop: theme.size.xs }}>
|
|
57
59
|
<EuiHeaderLogo iconType={() => <WfoAppLogo />} />
|
|
58
60
|
<div css={appNameStyle}>
|
|
@@ -74,39 +74,39 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
74
74
|
{
|
|
75
75
|
name: t('subscriptions'),
|
|
76
76
|
id: '3',
|
|
77
|
-
isSelected: router.pathname
|
|
77
|
+
isSelected: router.pathname.startsWith(PATH_SUBSCRIPTIONS),
|
|
78
78
|
href: PATH_SUBSCRIPTIONS,
|
|
79
79
|
renderItem: () => (
|
|
80
80
|
<WfoMenuItemLink
|
|
81
81
|
path={PATH_SUBSCRIPTIONS}
|
|
82
82
|
translationString="subscriptions"
|
|
83
|
-
isSelected={router.pathname
|
|
83
|
+
isSelected={router.pathname.startsWith(PATH_SUBSCRIPTIONS)}
|
|
84
84
|
/>
|
|
85
85
|
),
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
name: t('workflows'),
|
|
89
89
|
id: '4',
|
|
90
|
-
isSelected: router.pathname
|
|
90
|
+
isSelected: router.pathname.startsWith(PATH_WORKFLOWS),
|
|
91
91
|
href: PATH_WORKFLOWS,
|
|
92
92
|
renderItem: () => (
|
|
93
93
|
<WfoMenuItemLink
|
|
94
94
|
path={PATH_WORKFLOWS}
|
|
95
95
|
translationString="workflows"
|
|
96
|
-
isSelected={router.pathname
|
|
96
|
+
isSelected={router.pathname.startsWith(PATH_WORKFLOWS)}
|
|
97
97
|
/>
|
|
98
98
|
),
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
name: t('tasks'),
|
|
102
|
-
isSelected: router.pathname
|
|
102
|
+
isSelected: router.pathname.startsWith(PATH_TASKS),
|
|
103
103
|
id: '5',
|
|
104
104
|
href: PATH_TASKS,
|
|
105
105
|
renderItem: () => (
|
|
106
106
|
<WfoMenuItemLink
|
|
107
107
|
path={PATH_TASKS}
|
|
108
108
|
translationString="tasks"
|
|
109
|
-
isSelected={router.pathname
|
|
109
|
+
isSelected={router.pathname.startsWith(PATH_TASKS)}
|
|
110
110
|
/>
|
|
111
111
|
),
|
|
112
112
|
},
|
|
@@ -3,27 +3,27 @@ import React from 'react';
|
|
|
3
3
|
import { useTranslations } from 'next-intl';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
|
|
6
|
-
import { Pagination } from '@elastic/eui';
|
|
7
|
-
|
|
8
6
|
import {
|
|
9
7
|
FilterQuery,
|
|
10
8
|
PATH_WORKFLOWS,
|
|
11
9
|
WfoDateTime,
|
|
12
10
|
WfoProcessStatusBadge,
|
|
13
11
|
WfoWorkflowTargetBadge,
|
|
12
|
+
getPageIndexChangeHandler,
|
|
13
|
+
getPageSizeChangeHandler,
|
|
14
14
|
} from '@/components';
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_PAGE_SIZES,
|
|
17
17
|
TableColumnKeys,
|
|
18
18
|
WfoDataSorting,
|
|
19
19
|
WfoFirstPartUUID,
|
|
20
|
-
WfoTableColumns,
|
|
21
|
-
WfoTableWithFilter,
|
|
22
20
|
getDataSortHandler,
|
|
23
|
-
getPageChangeHandler,
|
|
24
21
|
getQueryStringHandler,
|
|
25
|
-
mapSortableAndFilterableValuesToTableColumnConfig,
|
|
26
22
|
} from '@/components/WfoTable';
|
|
23
|
+
import { WfoAdvancedTable } from '@/components/WfoTable/WfoAdvancedTable';
|
|
24
|
+
import { WfoAdvancedTableColumnConfig } from '@/components/WfoTable/WfoAdvancedTable/types';
|
|
25
|
+
import { ColumnType, Pagination } from '@/components/WfoTable/WfoTable';
|
|
26
|
+
import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/WfoTable/utils';
|
|
27
27
|
import { useShowToastMessage } from '@/hooks';
|
|
28
28
|
import { DataDisplayParams } from '@/hooks';
|
|
29
29
|
import { WfoProcessListSubscriptionsCell } from '@/pages';
|
|
@@ -84,8 +84,8 @@ export type WfoProcessesListProps = {
|
|
|
84
84
|
value: DataDisplayParams<ProcessListItem>[DisplayParamKey],
|
|
85
85
|
) => void;
|
|
86
86
|
overrideDefaultTableColumns?: (
|
|
87
|
-
defaultTableColumns:
|
|
88
|
-
) =>
|
|
87
|
+
defaultTableColumns: WfoAdvancedTableColumnConfig<ProcessListItem>,
|
|
88
|
+
) => WfoAdvancedTableColumnConfig<ProcessListItem>;
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
export const WfoProcessesList = ({
|
|
@@ -93,66 +93,66 @@ export const WfoProcessesList = ({
|
|
|
93
93
|
defaultHiddenColumns = [],
|
|
94
94
|
localStorageKey,
|
|
95
95
|
dataDisplayParams,
|
|
96
|
-
setDataDisplayParam,
|
|
97
96
|
overrideDefaultTableColumns,
|
|
97
|
+
setDataDisplayParam,
|
|
98
98
|
}: WfoProcessesListProps) => {
|
|
99
99
|
const t = useTranslations('processes.index');
|
|
100
100
|
const tError = useTranslations('errors');
|
|
101
101
|
const { showToastMessage } = useShowToastMessage();
|
|
102
102
|
|
|
103
|
-
const defaultTableColumns:
|
|
103
|
+
const defaultTableColumns: WfoAdvancedTableColumnConfig<ProcessListItem> = {
|
|
104
104
|
workflowName: {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
columnType: ColumnType.DATA,
|
|
106
|
+
label: t('workflowName'),
|
|
107
107
|
width: '20%',
|
|
108
|
-
|
|
108
|
+
renderData: (value, { processId }) => (
|
|
109
109
|
<Link href={`${PATH_WORKFLOWS}/${processId}`}>{value}</Link>
|
|
110
110
|
),
|
|
111
111
|
},
|
|
112
112
|
lastStep: {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
columnType: ColumnType.DATA,
|
|
114
|
+
label: t('step'),
|
|
115
115
|
width: '15%',
|
|
116
116
|
},
|
|
117
117
|
lastStatus: {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
columnType: ColumnType.DATA,
|
|
119
|
+
label: t('status'),
|
|
120
120
|
width: '100',
|
|
121
|
-
|
|
121
|
+
renderData: (cellValue) => (
|
|
122
122
|
<WfoProcessStatusBadge processStatus={cellValue} />
|
|
123
123
|
),
|
|
124
124
|
},
|
|
125
125
|
workflowTarget: {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
columnType: ColumnType.DATA,
|
|
127
|
+
label: t('workflowTarget'),
|
|
128
128
|
width: '100',
|
|
129
|
-
|
|
129
|
+
renderData: (target) => <WfoWorkflowTargetBadge target={target} />,
|
|
130
130
|
},
|
|
131
131
|
tag: {
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
columnType: ColumnType.DATA,
|
|
133
|
+
label: t('productTag'),
|
|
134
134
|
width: '100',
|
|
135
135
|
},
|
|
136
136
|
productName: {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
columnType: ColumnType.DATA,
|
|
138
|
+
label: t('product'),
|
|
139
139
|
width: '10%',
|
|
140
140
|
},
|
|
141
141
|
customer: {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
columnType: ColumnType.DATA,
|
|
143
|
+
label: t('customer'),
|
|
144
144
|
width: '10%',
|
|
145
145
|
},
|
|
146
146
|
customerAbbreviation: {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
columnType: ColumnType.DATA,
|
|
148
|
+
label: t('customerAbbreviation'),
|
|
149
149
|
width: '10%',
|
|
150
150
|
},
|
|
151
151
|
subscriptions: {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
columnType: ColumnType.DATA,
|
|
153
|
+
label: t('subscriptions'),
|
|
154
154
|
width: '15%',
|
|
155
|
-
|
|
155
|
+
renderData: ({ page: subscriptions }) => (
|
|
156
156
|
<WfoProcessListSubscriptionsCell
|
|
157
157
|
subscriptions={subscriptions}
|
|
158
158
|
numberOfSubscriptionsToRender={1}
|
|
@@ -169,41 +169,41 @@ export const WfoProcessesList = ({
|
|
|
169
169
|
.join(', '),
|
|
170
170
|
},
|
|
171
171
|
createdBy: {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
columnType: ColumnType.DATA,
|
|
173
|
+
label: t('createdBy'),
|
|
174
174
|
width: '10%',
|
|
175
175
|
},
|
|
176
176
|
assignee: {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
columnType: ColumnType.DATA,
|
|
178
|
+
label: t('assignee'),
|
|
179
179
|
width: '5%',
|
|
180
180
|
},
|
|
181
181
|
processId: {
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
columnType: ColumnType.DATA,
|
|
183
|
+
label: t('processId'),
|
|
184
184
|
width: '90',
|
|
185
|
-
|
|
185
|
+
renderData: (value) => <WfoFirstPartUUID UUID={value} />,
|
|
186
186
|
renderDetails: (value) => value,
|
|
187
187
|
},
|
|
188
188
|
startedAt: {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
columnType: ColumnType.DATA,
|
|
190
|
+
label: t('started'),
|
|
191
191
|
width: '100',
|
|
192
|
-
|
|
192
|
+
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
|
|
193
193
|
renderDetails: parseDateToLocaleDateTimeString,
|
|
194
194
|
clipboardText: parseDateToLocaleDateTimeString,
|
|
195
195
|
},
|
|
196
196
|
lastModifiedAt: {
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
columnType: ColumnType.DATA,
|
|
198
|
+
label: t('lastModified'),
|
|
199
199
|
width: '100',
|
|
200
|
-
|
|
200
|
+
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
|
|
201
201
|
renderDetails: parseDateToLocaleDateTimeString,
|
|
202
202
|
clipboardText: parseDateToLocaleDateTimeString,
|
|
203
203
|
},
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
const tableColumns:
|
|
206
|
+
const tableColumns: WfoAdvancedTableColumnConfig<ProcessListItem> =
|
|
207
207
|
overrideDefaultTableColumns
|
|
208
208
|
? overrideDefaultTableColumns(defaultTableColumns)
|
|
209
209
|
: defaultTableColumns;
|
|
@@ -231,6 +231,8 @@ export const WfoProcessesList = ({
|
|
|
231
231
|
pageIndex: pageIndex,
|
|
232
232
|
pageSizeOptions: DEFAULT_PAGE_SIZES,
|
|
233
233
|
totalItemCount: pageInfo?.totalItems ? pageInfo.totalItems : 0,
|
|
234
|
+
onChangePage: getPageIndexChangeHandler(setDataDisplayParam),
|
|
235
|
+
onChangeItemsPerPage: getPageSizeChangeHandler(setDataDisplayParam),
|
|
234
236
|
};
|
|
235
237
|
const dataSorting: WfoDataSorting<ProcessListItem> = {
|
|
236
238
|
field: sortBy?.field ?? 'lastModified',
|
|
@@ -243,17 +245,17 @@ export const WfoProcessesList = ({
|
|
|
243
245
|
).unwrap();
|
|
244
246
|
|
|
245
247
|
return (
|
|
246
|
-
<
|
|
248
|
+
<WfoAdvancedTable<ProcessListItem>
|
|
247
249
|
queryString={queryString}
|
|
248
250
|
data={mapGraphQlProcessListResultToProcessListItems(
|
|
249
251
|
processes || [],
|
|
250
252
|
)}
|
|
251
|
-
|
|
253
|
+
tableColumnConfig={mapSortableAndFilterableValuesToTableColumnConfig(
|
|
252
254
|
tableColumns,
|
|
253
255
|
pageInfo?.sortFields,
|
|
254
256
|
pageInfo?.filterFields,
|
|
255
257
|
)}
|
|
256
|
-
dataSorting={dataSorting}
|
|
258
|
+
dataSorting={[dataSorting]}
|
|
257
259
|
pagination={pagination}
|
|
258
260
|
isLoading={isFetching}
|
|
259
261
|
error={mapRtkErrorToWfoError(error)}
|
|
@@ -261,8 +263,7 @@ export const WfoProcessesList = ({
|
|
|
261
263
|
localStorageKey={localStorageKey}
|
|
262
264
|
detailModalTitle={'Details - Process'}
|
|
263
265
|
onUpdateQueryString={getQueryStringHandler(setDataDisplayParam)}
|
|
264
|
-
|
|
265
|
-
onUpdateDataSort={getDataSortHandler(setDataDisplayParam)}
|
|
266
|
+
onUpdateDataSorting={getDataSortHandler(setDataDisplayParam)}
|
|
266
267
|
onExportData={csvDownloadHandler<
|
|
267
268
|
ProcessListResponse,
|
|
268
269
|
ProcessListExportItem
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EuiButtonEmpty,
|
|
5
|
+
EuiFlexGroup,
|
|
6
|
+
EuiPopover,
|
|
7
|
+
EuiRadioGroup,
|
|
8
|
+
} from '@elastic/eui';
|
|
9
|
+
import { EuiRadioGroupOption } from '@elastic/eui/src/components/form/radio/radio_group';
|
|
10
|
+
|
|
11
|
+
export interface WfoRadioDropdownProps<T> {
|
|
12
|
+
options: WfoRadioDropdownOption<T>[];
|
|
13
|
+
selectedOption: WfoRadioDropdownOption<T>;
|
|
14
|
+
onUpdateOption: (value: WfoRadioDropdownOption<T>) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type WfoRadioDropdownOption<T> = {
|
|
18
|
+
label: string;
|
|
19
|
+
id: string;
|
|
20
|
+
value: T;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const WfoRadioDropdown = <T,>({
|
|
24
|
+
options,
|
|
25
|
+
onUpdateOption,
|
|
26
|
+
selectedOption,
|
|
27
|
+
}: WfoRadioDropdownProps<T>) => {
|
|
28
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
+
|
|
30
|
+
const handleClose = () => {
|
|
31
|
+
if (isOpen) {
|
|
32
|
+
setIsOpen(false);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleSelectRadio = (id: string) => {
|
|
36
|
+
const updatedOption = options.find((option) => option.id === id);
|
|
37
|
+
setTimeout(handleClose, 100);
|
|
38
|
+
if (updatedOption) {
|
|
39
|
+
onUpdateOption(updatedOption);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const buttonLabel = options.find(
|
|
44
|
+
(option) => option.id === selectedOption.id,
|
|
45
|
+
)?.label;
|
|
46
|
+
const radioGroupOptions: EuiRadioGroupOption[] = options.map((option) => ({
|
|
47
|
+
id: option.id,
|
|
48
|
+
label: option.label,
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<EuiFlexGroup
|
|
53
|
+
gutterSize="s"
|
|
54
|
+
alignItems="center"
|
|
55
|
+
justifyContent="flexEnd"
|
|
56
|
+
>
|
|
57
|
+
<EuiPopover
|
|
58
|
+
button={
|
|
59
|
+
<EuiButtonEmpty
|
|
60
|
+
size="s"
|
|
61
|
+
iconType="arrowDown"
|
|
62
|
+
iconSide="right"
|
|
63
|
+
onClick={() => {
|
|
64
|
+
setIsOpen((isOpen) => !isOpen);
|
|
65
|
+
}}
|
|
66
|
+
css={{
|
|
67
|
+
'&:focus': {
|
|
68
|
+
backgroundColor: 'transparent',
|
|
69
|
+
textDecoration: 'none',
|
|
70
|
+
},
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{buttonLabel}
|
|
74
|
+
</EuiButtonEmpty>
|
|
75
|
+
}
|
|
76
|
+
isOpen={isOpen}
|
|
77
|
+
closePopover={handleClose}
|
|
78
|
+
anchorPosition="downLeft"
|
|
79
|
+
>
|
|
80
|
+
<EuiRadioGroup
|
|
81
|
+
options={radioGroupOptions}
|
|
82
|
+
idSelected={selectedOption.id}
|
|
83
|
+
onChange={handleSelectRadio}
|
|
84
|
+
/>
|
|
85
|
+
</EuiPopover>
|
|
86
|
+
</EuiFlexGroup>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoRadioDropdown';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { FC, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
export type WfoRenderElementOrStringProps = {
|
|
4
|
+
renderString?: (value: string) => ReactElement;
|
|
5
|
+
children: ReactElement | ReactElement[] | string;
|
|
6
|
+
};
|
|
7
|
+
export const WfoRenderElementOrString: FC<WfoRenderElementOrStringProps> = ({
|
|
8
|
+
children,
|
|
9
|
+
renderString,
|
|
10
|
+
}): ReactElement => {
|
|
11
|
+
if (typeof children === 'string' && renderString) {
|
|
12
|
+
return renderString(children);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <>{children}</>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoRenderElementOrString';
|
|
@@ -5,12 +5,14 @@ import Link from 'next/link';
|
|
|
5
5
|
|
|
6
6
|
import { EuiButton } from '@elastic/eui';
|
|
7
7
|
|
|
8
|
+
import { PolicyResource } from '@/configuration/policy-resources';
|
|
8
9
|
import { ConfirmationDialogContext } from '@/contexts';
|
|
9
10
|
import { useOrchestratorTheme, useShowToastMessage } from '@/hooks';
|
|
10
11
|
import { useSetSubscriptionInSyncMutation } from '@/rtk/endpoints';
|
|
11
12
|
import { SubscriptionDetail, ToastTypes } from '@/types';
|
|
12
13
|
import { formatDate } from '@/utils';
|
|
13
14
|
|
|
15
|
+
import { WfoIsAllowedToRender } from '../WfoAuth/WfoIsAllowedToRender';
|
|
14
16
|
import { WfoInsyncIcon } from '../WfoInsyncIcon/WfoInsyncIcon';
|
|
15
17
|
import { PATH_TASKS, PATH_WORKFLOWS } from '../WfoPageTemplate';
|
|
16
18
|
import { getLastUncompletedProcess, getLatestTaskDate } from './utils';
|
|
@@ -82,15 +84,17 @@ export const WfoInSyncField = ({
|
|
|
82
84
|
>
|
|
83
85
|
{t('see')} {lastUncompletedProcess?.processId}
|
|
84
86
|
</Link>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
<WfoIsAllowedToRender resource={PolicyResource.PROCESS_RETRY}>
|
|
88
|
+
<EuiButton
|
|
89
|
+
isLoading={isFetching}
|
|
90
|
+
isDisabled={isFetching}
|
|
91
|
+
color="danger"
|
|
92
|
+
size="s"
|
|
93
|
+
onClick={confirmSetInSync}
|
|
94
|
+
>
|
|
95
|
+
{t('setInSync')}
|
|
96
|
+
</EuiButton>
|
|
97
|
+
</WfoIsAllowedToRender>
|
|
94
98
|
</>
|
|
95
99
|
);
|
|
96
100
|
};
|