@orchestrator-ui/orchestrator-ui-components 6.7.8 → 6.8.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 +1 -1
- package/.turbo/turbo-test.log +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +23 -18
- package/dist/index.js +288 -203
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx +9 -1
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +9 -2
- package/src/components/WfoStartButton/WfoStartButtonComboBox.tsx +73 -3
- package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +15 -3
- package/src/configuration/version.ts +1 -1
- package/src/rtk/endpoints/startOptions.ts +23 -10
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { EuiPageTemplate, EuiSideNavItemType } from '@elastic/eui';
|
|
|
5
5
|
|
|
6
6
|
import { WfoBreadcrumbs, WfoPageHeader, WfoSidebar } from '@/components';
|
|
7
7
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
8
|
+
import { ProductLifecycleStatus } from '@/types';
|
|
8
9
|
|
|
9
10
|
import { ContentContextProvider } from './ContentContext';
|
|
10
11
|
import { getPageTemplateStyles } from './styles';
|
|
@@ -14,6 +15,7 @@ export interface WfoPageTemplateProps {
|
|
|
14
15
|
overrideMenuItems?: (
|
|
15
16
|
defaultMenuItems: EuiSideNavItemType<object>[],
|
|
16
17
|
) => EuiSideNavItemType<object>[];
|
|
18
|
+
overrideStartWorkflowFilters?: (ProductLifecycleStatus | string)[];
|
|
17
19
|
onThemeSwitch: (theme: EuiThemeColorMode) => void;
|
|
18
20
|
children: ReactNode;
|
|
19
21
|
}
|
|
@@ -22,6 +24,7 @@ export const WfoPageTemplate: FC<WfoPageTemplateProps> = ({
|
|
|
22
24
|
children,
|
|
23
25
|
getAppLogo,
|
|
24
26
|
overrideMenuItems,
|
|
27
|
+
overrideStartWorkflowFilters,
|
|
25
28
|
onThemeSwitch,
|
|
26
29
|
}) => {
|
|
27
30
|
const { getSidebarStyle, NAVIGATION_HEIGHT } = useWithOrchestratorTheme(
|
|
@@ -50,7 +53,12 @@ export const WfoPageTemplate: FC<WfoPageTemplateProps> = ({
|
|
|
50
53
|
<EuiPageTemplate.Sidebar
|
|
51
54
|
css={getSidebarStyle(NAVIGATION_HEIGHT)}
|
|
52
55
|
>
|
|
53
|
-
<WfoSidebar
|
|
56
|
+
<WfoSidebar
|
|
57
|
+
overrideMenuItems={overrideMenuItems}
|
|
58
|
+
overrideStartWorkflowFilters={
|
|
59
|
+
overrideStartWorkflowFilters
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
54
62
|
</EuiPageTemplate.Sidebar>
|
|
55
63
|
)}
|
|
56
64
|
|
|
@@ -17,6 +17,7 @@ import { getMenuStyles } from '@/components/WfoPageTemplate/WfoSidebar/styles';
|
|
|
17
17
|
import { WfoStartWorkflowButtonComboBox } from '@/components/WfoStartButton/WfoStartWorkflowComboBox';
|
|
18
18
|
import { PolicyResource } from '@/configuration/policy-resources';
|
|
19
19
|
import { usePolicy, useWithOrchestratorTheme } from '@/hooks';
|
|
20
|
+
import { ProductLifecycleStatus } from '@/types';
|
|
20
21
|
|
|
21
22
|
import {
|
|
22
23
|
PATH_METADATA,
|
|
@@ -51,9 +52,13 @@ export type WfoSidebarProps = {
|
|
|
51
52
|
overrideMenuItems?: (
|
|
52
53
|
defaultMenuItems: EuiSideNavItemType<object>[],
|
|
53
54
|
) => EuiSideNavItemType<object>[];
|
|
55
|
+
overrideStartWorkflowFilters?: (ProductLifecycleStatus | string)[];
|
|
54
56
|
};
|
|
55
57
|
|
|
56
|
-
export const WfoSidebar: FC<WfoSidebarProps> = ({
|
|
58
|
+
export const WfoSidebar: FC<WfoSidebarProps> = ({
|
|
59
|
+
overrideMenuItems,
|
|
60
|
+
overrideStartWorkflowFilters,
|
|
61
|
+
}) => {
|
|
57
62
|
const { menuStyle } = useWithOrchestratorTheme(getMenuStyles);
|
|
58
63
|
|
|
59
64
|
const t = useTranslations('main');
|
|
@@ -243,7 +248,9 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
243
248
|
<WfoIsAllowedToRender
|
|
244
249
|
resource={PolicyResource.SUBSCRIPTION_CREATE}
|
|
245
250
|
>
|
|
246
|
-
<WfoStartWorkflowButtonComboBox
|
|
251
|
+
<WfoStartWorkflowButtonComboBox
|
|
252
|
+
startWorkflowFilters={overrideStartWorkflowFilters}
|
|
253
|
+
/>
|
|
247
254
|
</WfoIsAllowedToRender>
|
|
248
255
|
<EuiSpacer size="xl" />
|
|
249
256
|
<WfoCopyright />
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { capitalize } from 'lodash';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
EuiButton,
|
|
7
|
+
EuiButtonEmpty,
|
|
8
|
+
EuiFlexGroup,
|
|
9
|
+
EuiPopover,
|
|
10
|
+
EuiSelectable,
|
|
11
|
+
EuiSpacer,
|
|
12
|
+
} from '@elastic/eui';
|
|
4
13
|
|
|
5
14
|
import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
|
|
6
|
-
import { WfoPlusCircleFill } from '@/icons';
|
|
7
|
-
import { StartComboBoxOption } from '@/types';
|
|
15
|
+
import { WfoChevronDown, WfoPlusCircleFill } from '@/icons';
|
|
16
|
+
import { ProductLifecycleStatus, StartComboBoxOption } from '@/types';
|
|
8
17
|
|
|
9
18
|
import { getStyles } from './styles';
|
|
10
19
|
|
|
@@ -14,6 +23,11 @@ export type WfoStartButtonComboBoxProps = {
|
|
|
14
23
|
onOptionChange: (selectedOption: StartComboBoxOption) => void;
|
|
15
24
|
isProcess: boolean;
|
|
16
25
|
className?: string;
|
|
26
|
+
selectedProductStatus?: ProductLifecycleStatus | string;
|
|
27
|
+
setSelectedProductStatus?: (
|
|
28
|
+
status: ProductLifecycleStatus | string,
|
|
29
|
+
) => void;
|
|
30
|
+
startWorkflowFilters?: (ProductLifecycleStatus | string)[];
|
|
17
31
|
};
|
|
18
32
|
|
|
19
33
|
export const WfoStartButtonComboBox = ({
|
|
@@ -22,6 +36,9 @@ export const WfoStartButtonComboBox = ({
|
|
|
22
36
|
onOptionChange,
|
|
23
37
|
isProcess,
|
|
24
38
|
className,
|
|
39
|
+
selectedProductStatus,
|
|
40
|
+
setSelectedProductStatus,
|
|
41
|
+
startWorkflowFilters,
|
|
25
42
|
}: WfoStartButtonComboBoxProps) => {
|
|
26
43
|
const [isPopoverOpen, setPopoverOpen] = useState(false);
|
|
27
44
|
const { theme, isDarkThemeActive } = useOrchestratorTheme();
|
|
@@ -42,6 +59,58 @@ export const WfoStartButtonComboBox = ({
|
|
|
42
59
|
</EuiButton>
|
|
43
60
|
);
|
|
44
61
|
|
|
62
|
+
const [isFilterPopoverOpen, setFilterPopoverOpen] = React.useState(false);
|
|
63
|
+
|
|
64
|
+
const ProductStatePicker = () => {
|
|
65
|
+
return setSelectedProductStatus ? (
|
|
66
|
+
<EuiFlexGroup justifyContent="flexEnd" gutterSize="none">
|
|
67
|
+
<EuiPopover
|
|
68
|
+
button={
|
|
69
|
+
<EuiButtonEmpty
|
|
70
|
+
css={{
|
|
71
|
+
'.euiButtonEmpty__content': {
|
|
72
|
+
gap: theme.size.xxs,
|
|
73
|
+
},
|
|
74
|
+
}}
|
|
75
|
+
size="xs"
|
|
76
|
+
iconSide="right"
|
|
77
|
+
iconType={() => (
|
|
78
|
+
<WfoChevronDown
|
|
79
|
+
height={18}
|
|
80
|
+
width={18}
|
|
81
|
+
color="currentColor"
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
onClick={() => setFilterPopoverOpen((v) => !v)}
|
|
85
|
+
>
|
|
86
|
+
<b>{capitalize(selectedProductStatus)}</b>
|
|
87
|
+
</EuiButtonEmpty>
|
|
88
|
+
}
|
|
89
|
+
isOpen={isFilterPopoverOpen}
|
|
90
|
+
closePopover={() => setFilterPopoverOpen(false)}
|
|
91
|
+
anchorPosition="downRight"
|
|
92
|
+
>
|
|
93
|
+
{startWorkflowFilters?.map((productStatus) => (
|
|
94
|
+
<div key={productStatus}>
|
|
95
|
+
<EuiButtonEmpty
|
|
96
|
+
key={productStatus}
|
|
97
|
+
size="xs"
|
|
98
|
+
onClick={() => {
|
|
99
|
+
setSelectedProductStatus(productStatus);
|
|
100
|
+
setFilterPopoverOpen(false);
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
{capitalize(productStatus)}
|
|
104
|
+
</EuiButtonEmpty>
|
|
105
|
+
</div>
|
|
106
|
+
))}
|
|
107
|
+
</EuiPopover>
|
|
108
|
+
</EuiFlexGroup>
|
|
109
|
+
) : (
|
|
110
|
+
<></>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
45
114
|
return (
|
|
46
115
|
<EuiPopover
|
|
47
116
|
initialFocus={`.euiSelectable .euiFieldSearch`}
|
|
@@ -49,6 +118,7 @@ export const WfoStartButtonComboBox = ({
|
|
|
49
118
|
isOpen={isPopoverOpen}
|
|
50
119
|
closePopover={() => setPopoverOpen(false)}
|
|
51
120
|
>
|
|
121
|
+
{startWorkflowFilters && <ProductStatePicker />}
|
|
52
122
|
<EuiSelectable<StartComboBoxOption>
|
|
53
123
|
className={className}
|
|
54
124
|
css={selectableStyle}
|
|
@@ -5,17 +5,26 @@ import { useRouter } from 'next/router';
|
|
|
5
5
|
|
|
6
6
|
import { useCheckEngineStatus } from '@/hooks';
|
|
7
7
|
import { useGetWorkflowOptionsQuery } from '@/rtk';
|
|
8
|
-
import { StartComboBoxOption } from '@/types';
|
|
8
|
+
import { ProductLifecycleStatus, StartComboBoxOption } from '@/types';
|
|
9
9
|
|
|
10
10
|
import { PATH_START_NEW_WORKFLOW } from '../WfoPageTemplate';
|
|
11
11
|
import { WfoStartButtonComboBox } from './WfoStartButtonComboBox';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface WfoStartWorkflowButtonComboBoxProps {
|
|
14
|
+
startWorkflowFilters?: (ProductLifecycleStatus | string)[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const WfoStartWorkflowButtonComboBox = ({
|
|
18
|
+
startWorkflowFilters,
|
|
19
|
+
}: WfoStartWorkflowButtonComboBoxProps) => {
|
|
14
20
|
const router = useRouter();
|
|
15
21
|
const t = useTranslations('common');
|
|
16
22
|
const { isEngineRunningNow } = useCheckEngineStatus();
|
|
23
|
+
const [selectedProductStatus, setSelectedProductStatus] = React.useState<
|
|
24
|
+
ProductLifecycleStatus | string
|
|
25
|
+
>(ProductLifecycleStatus.ACTIVE);
|
|
17
26
|
|
|
18
|
-
const { data } = useGetWorkflowOptionsQuery();
|
|
27
|
+
const { data } = useGetWorkflowOptionsQuery(selectedProductStatus);
|
|
19
28
|
const workflowOptions = data?.startOptions || [];
|
|
20
29
|
|
|
21
30
|
const comboBoxOptions: StartComboBoxOption[] = [...workflowOptions]
|
|
@@ -48,6 +57,9 @@ export const WfoStartWorkflowButtonComboBox = () => {
|
|
|
48
57
|
onOptionChange={handleOptionChange}
|
|
49
58
|
isProcess
|
|
50
59
|
css={{ width: '300px' }}
|
|
60
|
+
selectedProductStatus={selectedProductStatus}
|
|
61
|
+
setSelectedProductStatus={setSelectedProductStatus}
|
|
62
|
+
startWorkflowFilters={startWorkflowFilters}
|
|
51
63
|
/>
|
|
52
64
|
);
|
|
53
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '6.
|
|
1
|
+
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '6.8.0';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductDefinition,
|
|
3
|
+
ProductLifecycleStatus,
|
|
3
4
|
StartOptionsResult,
|
|
4
5
|
WorkflowDefinition,
|
|
5
6
|
WorkflowTarget,
|
|
@@ -18,6 +19,7 @@ const workflowOptionsQuery = `
|
|
|
18
19
|
productId
|
|
19
20
|
name
|
|
20
21
|
tag
|
|
22
|
+
status
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -53,6 +55,7 @@ type WorkflowOptionsResult = StartOptionsResult<{
|
|
|
53
55
|
productId: ProductDefinition['productId'];
|
|
54
56
|
productType: ProductDefinition['productType'];
|
|
55
57
|
tag: ProductDefinition['tag'];
|
|
58
|
+
status: ProductDefinition['status'];
|
|
56
59
|
}[];
|
|
57
60
|
}>;
|
|
58
61
|
|
|
@@ -70,28 +73,38 @@ const startButtonOptionsApi = orchestratorApi.injectEndpoints({
|
|
|
70
73
|
endpoints: (build) => ({
|
|
71
74
|
getWorkflowOptions: build.query<
|
|
72
75
|
StartOptionsResponse<WorkflowOption>,
|
|
73
|
-
|
|
76
|
+
ProductLifecycleStatus | string
|
|
74
77
|
>({
|
|
75
78
|
query: () => ({
|
|
76
79
|
document: workflowOptionsQuery,
|
|
77
80
|
}),
|
|
78
81
|
transformResponse: (
|
|
79
82
|
response: WorkflowOptionsResult | undefined,
|
|
83
|
+
_,
|
|
84
|
+
productStatus,
|
|
80
85
|
) => {
|
|
86
|
+
const statusToMatch = (
|
|
87
|
+
productStatus ?? ProductLifecycleStatus.ACTIVE
|
|
88
|
+
).toLowerCase();
|
|
81
89
|
const startOptions: WorkflowOption[] = [];
|
|
82
90
|
const workflows = response?.workflows?.page || [];
|
|
83
91
|
workflows.forEach((workflow) => {
|
|
84
92
|
const workflowName = workflow.name;
|
|
85
|
-
workflow.products
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
workflow.products
|
|
94
|
+
.filter(
|
|
95
|
+
(product) =>
|
|
96
|
+
product.status.toLowerCase() === statusToMatch,
|
|
97
|
+
)
|
|
98
|
+
.forEach((product) => {
|
|
99
|
+
startOptions.push({
|
|
100
|
+
workflowName,
|
|
101
|
+
isAllowed: workflow.isAllowed,
|
|
102
|
+
productName: product.name,
|
|
103
|
+
productId: product.productId,
|
|
104
|
+
productType: product.productType,
|
|
105
|
+
productTag: product.tag,
|
|
106
|
+
});
|
|
93
107
|
});
|
|
94
|
-
});
|
|
95
108
|
});
|
|
96
109
|
|
|
97
110
|
return { startOptions };
|