@orchestrator-ui/orchestrator-ui-components 1.7.0 → 1.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 +4 -4
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +41 -16
- package/dist/index.js +1291 -1241
- package/package.json +1 -1
- package/src/components/WfoExpandableField/WfoExpandableField.tsx +46 -0
- package/src/components/WfoExpandableField/index.ts +1 -0
- package/src/components/WfoExpandableField/styles.ts +18 -0
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoProductBlockKeyValueRow.tsx +46 -0
- package/src/components/WfoSubscription/{WfoSubscriptionProductBlock.tsx → WfoSubscriptionProductBlock/WfoSubscriptionProductBlock.tsx} +34 -91
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/index.ts +2 -0
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/styles.ts +48 -0
- package/src/components/WfoSubscription/index.ts +2 -0
- package/src/components/WfoSubscription/overrides/index.ts +1 -0
- package/src/components/WfoSubscription/overrides/useSubscriptionDetailValueOverride.ts +35 -0
- package/src/components/WfoSubscription/styles.ts +0 -48
- package/src/components/index.ts +1 -0
- package/src/rtk/slices/index.ts +2 -1
- package/src/rtk/slices/orchestratorComponentOverride.ts +26 -0
- package/src/rtk/store.ts +22 -5
- package/src/rtk/storeProvider.tsx +8 -1
- package/src/types/types.ts +0 -7
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { EuiButtonIcon } from '@elastic/eui';
|
|
4
|
+
|
|
5
|
+
import { useOrchestratorTheme } from '@/hooks';
|
|
6
|
+
import { WfoMinusCircleFill, WfoPlusCircleFill } from '@/icons';
|
|
7
|
+
|
|
8
|
+
import { getStyles } from './styles';
|
|
9
|
+
|
|
10
|
+
export type WfoExpandableFieldProps = {
|
|
11
|
+
isExpanded: boolean;
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
onExpandedChange: (isExpanded: boolean) => void;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const WfoExpandableField: FC<WfoExpandableFieldProps> = ({
|
|
18
|
+
isExpanded,
|
|
19
|
+
title,
|
|
20
|
+
onExpandedChange,
|
|
21
|
+
children,
|
|
22
|
+
}) => {
|
|
23
|
+
const { theme } = useOrchestratorTheme();
|
|
24
|
+
const { titleRowStyle, titleStyle } = getStyles(theme);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div css={titleRowStyle}>
|
|
29
|
+
<EuiButtonIcon
|
|
30
|
+
aria-label={isExpanded ? 'Collapse' : 'Expand'}
|
|
31
|
+
iconType={() =>
|
|
32
|
+
isExpanded ? (
|
|
33
|
+
<WfoMinusCircleFill color={theme.colors.primary} />
|
|
34
|
+
) : (
|
|
35
|
+
<WfoPlusCircleFill color={theme.colors.primary} />
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
onClick={() => onExpandedChange(!isExpanded)}
|
|
39
|
+
/>
|
|
40
|
+
<div css={titleStyle}>{title}</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{isExpanded && children}
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoExpandableField';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EuiThemeComputed } from '@elastic/eui';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
|
|
4
|
+
export const getStyles = (theme: EuiThemeComputed) => {
|
|
5
|
+
const titleRowStyle = css({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const titleStyle = css({
|
|
11
|
+
marginLeft: theme.size.s,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
titleRowStyle,
|
|
16
|
+
titleStyle,
|
|
17
|
+
};
|
|
18
|
+
};
|
package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoProductBlockKeyValueRow.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { EuiBadge } from '@elastic/eui';
|
|
4
|
+
|
|
5
|
+
import { useSubscriptionDetailValueOverride } from '@/components';
|
|
6
|
+
import { useWithOrchestratorTheme } from '@/hooks';
|
|
7
|
+
import { FieldValue } from '@/types';
|
|
8
|
+
import { camelToHuman } from '@/utils';
|
|
9
|
+
|
|
10
|
+
import { getStyles } from './styles';
|
|
11
|
+
|
|
12
|
+
export type WfoProductBlockKeyValueRowProps = {
|
|
13
|
+
fieldValue: FieldValue;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const WfoProductBlockKeyValueRow: FC<
|
|
17
|
+
WfoProductBlockKeyValueRowProps
|
|
18
|
+
> = ({ fieldValue }) => {
|
|
19
|
+
const { leftColumnStyle, rightColumnStyle, rowStyle } =
|
|
20
|
+
useWithOrchestratorTheme(getStyles);
|
|
21
|
+
const { getOverriddenValue } = useSubscriptionDetailValueOverride();
|
|
22
|
+
|
|
23
|
+
const { field, value } = fieldValue;
|
|
24
|
+
|
|
25
|
+
const WfoProductBlockValue: FC<{ value: FieldValue['value'] }> = ({
|
|
26
|
+
value,
|
|
27
|
+
}) =>
|
|
28
|
+
typeof value === 'boolean' ? (
|
|
29
|
+
<EuiBadge>{value.toString()}</EuiBadge>
|
|
30
|
+
) : (
|
|
31
|
+
<>{value}</>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<tr css={rowStyle}>
|
|
36
|
+
<td css={leftColumnStyle}>
|
|
37
|
+
<b>{camelToHuman(field)}</b>
|
|
38
|
+
</td>
|
|
39
|
+
<td css={rightColumnStyle}>
|
|
40
|
+
{getOverriddenValue(fieldValue) ?? (
|
|
41
|
+
<WfoProductBlockValue value={value} />
|
|
42
|
+
)}
|
|
43
|
+
</td>
|
|
44
|
+
</tr>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -6,7 +6,6 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import {
|
|
7
7
|
EuiBadge,
|
|
8
8
|
EuiButtonEmpty,
|
|
9
|
-
EuiCodeBlock,
|
|
10
9
|
EuiFlexGroup,
|
|
11
10
|
EuiFlexItem,
|
|
12
11
|
EuiIcon,
|
|
@@ -15,15 +14,19 @@ import {
|
|
|
15
14
|
EuiText,
|
|
16
15
|
} from '@elastic/eui';
|
|
17
16
|
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
import {
|
|
18
|
+
PATH_SUBSCRIPTIONS,
|
|
19
|
+
WfoJsonCodeBlock,
|
|
20
|
+
WfoProductBlockKeyValueRow,
|
|
21
|
+
} from '@/components';
|
|
22
|
+
import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
|
|
23
|
+
import { FieldValue, InUseByRelation } from '@/types';
|
|
24
|
+
|
|
23
25
|
import {
|
|
24
26
|
getFieldFromProductBlockInstanceValues,
|
|
25
27
|
getProductBlockTitle,
|
|
26
|
-
} from '
|
|
28
|
+
} from '../utils';
|
|
29
|
+
import { getStyles } from './styles';
|
|
27
30
|
|
|
28
31
|
interface WfoSubscriptionProductBlockProps {
|
|
29
32
|
ownerSubscriptionId: string;
|
|
@@ -47,32 +50,22 @@ export const WfoSubscriptionProductBlock = ({
|
|
|
47
50
|
const t = useTranslations('subscriptions.detail');
|
|
48
51
|
const { theme } = useOrchestratorTheme();
|
|
49
52
|
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
productBlockFirstRightColStyle,
|
|
53
|
+
iconStyle,
|
|
54
|
+
panelStyle,
|
|
55
|
+
leftColumnStyle,
|
|
56
|
+
rightColumnStyle,
|
|
57
|
+
rowStyle,
|
|
56
58
|
} = useWithOrchestratorTheme(getStyles);
|
|
57
59
|
|
|
58
60
|
const [hideDetails, setHideDetails] = useState(true);
|
|
59
61
|
|
|
60
|
-
const isFirstBlock = (index: number): boolean => {
|
|
61
|
-
if (!hideDetails) return false;
|
|
62
|
-
return index === 0;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
62
|
return (
|
|
66
63
|
<>
|
|
67
64
|
<EuiSpacer size={'m'}></EuiSpacer>
|
|
68
|
-
<EuiPanel
|
|
69
|
-
color="transparent"
|
|
70
|
-
hasShadow={false}
|
|
71
|
-
css={productBlockPanelStyle}
|
|
72
|
-
>
|
|
65
|
+
<EuiPanel color="transparent" hasShadow={false} css={panelStyle}>
|
|
73
66
|
<EuiFlexGroup>
|
|
74
67
|
<EuiFlexItem grow={false}>
|
|
75
|
-
<div css={
|
|
68
|
+
<div css={iconStyle}>
|
|
76
69
|
<EuiIcon
|
|
77
70
|
type="filebeatApp"
|
|
78
71
|
color={theme.colors.primary}
|
|
@@ -115,31 +108,19 @@ export const WfoSubscriptionProductBlock = ({
|
|
|
115
108
|
<tbody>
|
|
116
109
|
{!hideDetails && (
|
|
117
110
|
<>
|
|
118
|
-
<tr key={-3}>
|
|
119
|
-
<td
|
|
120
|
-
valign={'top'}
|
|
121
|
-
css={productBlockFirstLeftColStyle}
|
|
122
|
-
>
|
|
111
|
+
<tr key={-3} css={rowStyle}>
|
|
112
|
+
<td css={leftColumnStyle}>
|
|
123
113
|
<b>{t('subscriptionInstanceId')}</b>
|
|
124
114
|
</td>
|
|
125
|
-
<td
|
|
126
|
-
valign={'top'}
|
|
127
|
-
css={productBlockFirstRightColStyle}
|
|
128
|
-
>
|
|
115
|
+
<td css={rightColumnStyle}>
|
|
129
116
|
{subscriptionInstanceId}
|
|
130
117
|
</td>
|
|
131
118
|
</tr>
|
|
132
|
-
<tr key={-2}>
|
|
133
|
-
<td
|
|
134
|
-
valign={'top'}
|
|
135
|
-
css={productBlockFirstLeftColStyle}
|
|
136
|
-
>
|
|
119
|
+
<tr key={-2} css={rowStyle}>
|
|
120
|
+
<td css={leftColumnStyle}>
|
|
137
121
|
<b>{t('ownerSubscriptionId')}</b>
|
|
138
122
|
</td>
|
|
139
|
-
<td
|
|
140
|
-
valign={'top'}
|
|
141
|
-
css={productBlockFirstRightColStyle}
|
|
142
|
-
>
|
|
123
|
+
<td css={rightColumnStyle}>
|
|
143
124
|
{subscriptionId ===
|
|
144
125
|
ownerSubscriptionId ? (
|
|
145
126
|
<>
|
|
@@ -157,24 +138,15 @@ export const WfoSubscriptionProductBlock = ({
|
|
|
157
138
|
)}
|
|
158
139
|
</td>
|
|
159
140
|
</tr>
|
|
160
|
-
<tr key={-1}>
|
|
161
|
-
<td
|
|
162
|
-
valign={'top'}
|
|
163
|
-
css={productBlockLeftColStyle}
|
|
164
|
-
>
|
|
141
|
+
<tr key={-1} css={rowStyle}>
|
|
142
|
+
<td css={leftColumnStyle}>
|
|
165
143
|
<b>{t('inUseByRelations')}</b>
|
|
166
144
|
</td>
|
|
167
|
-
<td
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{JSON.stringify(
|
|
173
|
-
inUseByRelations,
|
|
174
|
-
null,
|
|
175
|
-
4,
|
|
176
|
-
)}
|
|
177
|
-
</EuiCodeBlock>
|
|
145
|
+
<td css={rightColumnStyle}>
|
|
146
|
+
<WfoJsonCodeBlock
|
|
147
|
+
data={inUseByRelations}
|
|
148
|
+
isBasicStyle
|
|
149
|
+
/>
|
|
178
150
|
</td>
|
|
179
151
|
</tr>
|
|
180
152
|
</>
|
|
@@ -188,39 +160,10 @@ export const WfoSubscriptionProductBlock = ({
|
|
|
188
160
|
),
|
|
189
161
|
)
|
|
190
162
|
.map((productBlockInstanceValue, index) => (
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
isFirstBlock(index)
|
|
196
|
-
? productBlockFirstLeftColStyle
|
|
197
|
-
: productBlockLeftColStyle
|
|
198
|
-
}
|
|
199
|
-
>
|
|
200
|
-
<b>
|
|
201
|
-
{camelToHuman(
|
|
202
|
-
productBlockInstanceValue.field,
|
|
203
|
-
)}
|
|
204
|
-
</b>
|
|
205
|
-
</td>
|
|
206
|
-
<td
|
|
207
|
-
valign={'top'}
|
|
208
|
-
css={
|
|
209
|
-
isFirstBlock(index)
|
|
210
|
-
? productBlockFirstRightColStyle
|
|
211
|
-
: productBlockRightColStyle
|
|
212
|
-
}
|
|
213
|
-
>
|
|
214
|
-
{typeof productBlockInstanceValue.value ===
|
|
215
|
-
'boolean' ? (
|
|
216
|
-
<EuiBadge>
|
|
217
|
-
{productBlockInstanceValue.value.toString()}
|
|
218
|
-
</EuiBadge>
|
|
219
|
-
) : (
|
|
220
|
-
productBlockInstanceValue.value
|
|
221
|
-
)}
|
|
222
|
-
</td>
|
|
223
|
-
</tr>
|
|
163
|
+
<WfoProductBlockKeyValueRow
|
|
164
|
+
fieldValue={productBlockInstanceValue}
|
|
165
|
+
key={index}
|
|
166
|
+
/>
|
|
224
167
|
))}
|
|
225
168
|
</tbody>
|
|
226
169
|
</table>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EuiThemeComputed } from '@elastic/eui/src/services/theme/types';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
|
|
4
|
+
export const getStyles = (theme: EuiThemeComputed) => {
|
|
5
|
+
const iconStyle = css({
|
|
6
|
+
width: 45,
|
|
7
|
+
height: 45,
|
|
8
|
+
backgroundColor: 'rgb(193,221,241,1)',
|
|
9
|
+
paddingTop: 13,
|
|
10
|
+
paddingLeft: 15,
|
|
11
|
+
borderRadius: 7,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const panelStyle = css({
|
|
15
|
+
backgroundColor: theme.colors.lightestShade,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const rowStyle = css({
|
|
19
|
+
'&:first-child': {
|
|
20
|
+
borderTop: `solid 1px ${theme.colors.lightShade}`,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const leftColumnStyle = css({
|
|
25
|
+
verticalAlign: 'top',
|
|
26
|
+
width: 250,
|
|
27
|
+
paddingLeft: 0,
|
|
28
|
+
paddingTop: 10,
|
|
29
|
+
paddingBottom: 10,
|
|
30
|
+
borderBottom: `solid 1px ${theme.colors.lightShade}`,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const rightColumnStyle = css({
|
|
34
|
+
verticalAlign: 'top',
|
|
35
|
+
paddingLeft: 0,
|
|
36
|
+
paddingTop: 10,
|
|
37
|
+
paddingBottom: 10,
|
|
38
|
+
borderBottom: `solid 1px ${theme.colors.lightShade}`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
iconStyle,
|
|
43
|
+
panelStyle,
|
|
44
|
+
leftColumnStyle,
|
|
45
|
+
rightColumnStyle,
|
|
46
|
+
rowStyle,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useSubscriptionDetailValueOverride';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { ValueOverrideFunction } from '@/rtk';
|
|
4
|
+
import { useAppSelector } from '@/rtk/hooks';
|
|
5
|
+
import { FieldValue } from '@/types';
|
|
6
|
+
|
|
7
|
+
export const useSubscriptionDetailValueOverride = () => {
|
|
8
|
+
const valueOverrideConfiguration = useAppSelector(
|
|
9
|
+
(state) =>
|
|
10
|
+
state.orchestratorComponentOverride?.subscriptionDetail
|
|
11
|
+
?.valueOverrides,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const getOverriddenValue = (
|
|
15
|
+
fieldValue: FieldValue,
|
|
16
|
+
): React.ReactNode | null => {
|
|
17
|
+
if (!valueOverrideConfiguration) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const renderFunctionForField: ValueOverrideFunction | undefined =
|
|
22
|
+
valueOverrideConfiguration[fieldValue.field];
|
|
23
|
+
|
|
24
|
+
// This check is needed because TS does not infer the type correctly
|
|
25
|
+
if (renderFunctionForField) {
|
|
26
|
+
return renderFunctionForField(fieldValue);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
getOverriddenValue,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -43,48 +43,6 @@ export const getStyles = (theme: EuiThemeComputed) => {
|
|
|
43
43
|
border: 0,
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
const productBlockIconStyle = css({
|
|
47
|
-
width: 45,
|
|
48
|
-
height: 45,
|
|
49
|
-
backgroundColor: 'rgb(193,221,241,1)',
|
|
50
|
-
paddingTop: 13,
|
|
51
|
-
paddingLeft: 15,
|
|
52
|
-
borderRadius: 7,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const productBlockPanelStyle = css({
|
|
56
|
-
backgroundColor: theme.colors.lightestShade,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const productBlockLeftCol = {
|
|
60
|
-
width: 250,
|
|
61
|
-
paddingLeft: 0,
|
|
62
|
-
paddingTop: 10,
|
|
63
|
-
paddingBottom: 10,
|
|
64
|
-
borderBottom: `solid 1px ${theme.colors.lightShade}`,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const productBlockLeftColStyle = css({ ...productBlockLeftCol });
|
|
68
|
-
|
|
69
|
-
const productBlockFirstLeftColStyle = css({
|
|
70
|
-
borderTop: `solid 1px ${theme.colors.lightShade}`,
|
|
71
|
-
...productBlockLeftCol,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const productBlockRightCol = {
|
|
75
|
-
paddingLeft: 0,
|
|
76
|
-
paddingTop: 10,
|
|
77
|
-
paddingBottom: 10,
|
|
78
|
-
borderBottom: `solid 1px ${theme.colors.lightShade}`,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const productBlockRightColStyle = css({ ...productBlockRightCol });
|
|
82
|
-
|
|
83
|
-
const productBlockFirstRightColStyle = css({
|
|
84
|
-
borderTop: `solid 1px ${theme.colors.lightShade}`,
|
|
85
|
-
...productBlockRightCol,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
46
|
return {
|
|
89
47
|
contentCellStyle,
|
|
90
48
|
headerCellStyle,
|
|
@@ -94,11 +52,5 @@ export const getStyles = (theme: EuiThemeComputed) => {
|
|
|
94
52
|
emptyCellStyle,
|
|
95
53
|
lastContentCellStyle,
|
|
96
54
|
lastHeaderCellStyle,
|
|
97
|
-
productBlockIconStyle,
|
|
98
|
-
productBlockPanelStyle,
|
|
99
|
-
productBlockLeftColStyle,
|
|
100
|
-
productBlockFirstLeftColStyle,
|
|
101
|
-
productBlockRightColStyle,
|
|
102
|
-
productBlockFirstRightColStyle,
|
|
103
55
|
};
|
|
104
56
|
};
|
package/src/components/index.ts
CHANGED
package/src/rtk/slices/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Slice, createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
|
|
5
|
+
import { FieldValue } from '@/types';
|
|
6
|
+
|
|
7
|
+
export type ValueOverrideFunction = (fieldValue: FieldValue) => ReactNode;
|
|
8
|
+
export type ValueOverrideConfiguration = Record<string, ValueOverrideFunction>;
|
|
9
|
+
|
|
10
|
+
export type OrchestratorComponentOverride = {
|
|
11
|
+
subscriptionDetail?: {
|
|
12
|
+
valueOverrides?: ValueOverrideConfiguration;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type OrchestratorComponentOverrideSlice = Slice<OrchestratorComponentOverride>;
|
|
17
|
+
|
|
18
|
+
export const getOrchestratorComponentOverrideSlice = (
|
|
19
|
+
config: OrchestratorComponentOverride,
|
|
20
|
+
): OrchestratorComponentOverrideSlice => {
|
|
21
|
+
return createSlice({
|
|
22
|
+
name: 'orchestratorComponentOverride',
|
|
23
|
+
initialState: config,
|
|
24
|
+
reducers: {},
|
|
25
|
+
});
|
|
26
|
+
};
|
package/src/rtk/store.ts
CHANGED
|
@@ -4,6 +4,10 @@ import type { Dispatch, UnknownAction } from '@reduxjs/toolkit';
|
|
|
4
4
|
import { CombinedState } from '@reduxjs/toolkit/query';
|
|
5
5
|
|
|
6
6
|
import { CustomApiConfig, getCustomApiSlice } from '@/rtk/slices';
|
|
7
|
+
import {
|
|
8
|
+
OrchestratorComponentOverride,
|
|
9
|
+
getOrchestratorComponentOverrideSlice,
|
|
10
|
+
} from '@/rtk/slices/orchestratorComponentOverride';
|
|
7
11
|
import type { OrchestratorConfig } from '@/types';
|
|
8
12
|
|
|
9
13
|
import { orchestratorApi } from './api';
|
|
@@ -17,14 +21,23 @@ export type RootState = {
|
|
|
17
21
|
>;
|
|
18
22
|
toastMessages: ReturnType<typeof toastMessagesReducer>;
|
|
19
23
|
orchestratorConfig: OrchestratorConfig;
|
|
24
|
+
orchestratorComponentOverride?: OrchestratorComponentOverride;
|
|
20
25
|
customApis: CustomApiConfig[];
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
customApis
|
|
26
|
-
|
|
28
|
+
export type InitialOrchestratorStoreConfig = Pick<
|
|
29
|
+
RootState,
|
|
30
|
+
'orchestratorConfig' | 'customApis' | 'orchestratorComponentOverride'
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export const getOrchestratorStore = ({
|
|
34
|
+
orchestratorConfig,
|
|
35
|
+
orchestratorComponentOverride = {},
|
|
36
|
+
customApis,
|
|
37
|
+
}: InitialOrchestratorStoreConfig): EnhancedStore<RootState> => {
|
|
27
38
|
const configSlice = getOrchestratorConfigSlice(orchestratorConfig);
|
|
39
|
+
const orchestratorComponentOverrideSlice =
|
|
40
|
+
getOrchestratorComponentOverrideSlice(orchestratorComponentOverride);
|
|
28
41
|
const customApisSlice = getCustomApiSlice(customApis);
|
|
29
42
|
|
|
30
43
|
const orchestratorStore = configureStore({
|
|
@@ -32,10 +45,14 @@ export const getOrchestratorStore = (
|
|
|
32
45
|
[orchestratorApi.reducerPath]: orchestratorApi.reducer,
|
|
33
46
|
toastMessages: toastMessagesReducer,
|
|
34
47
|
orchestratorConfig: configSlice.reducer,
|
|
48
|
+
orchestratorComponentOverride:
|
|
49
|
+
orchestratorComponentOverrideSlice.reducer,
|
|
35
50
|
customApis: customApisSlice?.reducer,
|
|
36
51
|
},
|
|
37
52
|
middleware: (getDefaultMiddleware) =>
|
|
38
|
-
getDefaultMiddleware(
|
|
53
|
+
getDefaultMiddleware({
|
|
54
|
+
serializableCheck: false,
|
|
55
|
+
}).concat(orchestratorApi.middleware),
|
|
39
56
|
});
|
|
40
57
|
|
|
41
58
|
return orchestratorStore;
|
|
@@ -3,22 +3,29 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
import { Provider } from 'react-redux';
|
|
4
4
|
|
|
5
5
|
import { CustomApiConfig } from '@/rtk/slices/customApis';
|
|
6
|
+
import { OrchestratorComponentOverride } from '@/rtk/slices/orchestratorComponentOverride';
|
|
6
7
|
import type { OrchestratorConfig } from '@/types';
|
|
7
8
|
|
|
8
9
|
import { getOrchestratorStore } from './store';
|
|
9
10
|
|
|
10
11
|
export type StoreProviderProps = {
|
|
11
12
|
initialOrchestratorConfig: OrchestratorConfig;
|
|
13
|
+
orchestratorComponentOverride?: OrchestratorComponentOverride;
|
|
12
14
|
customApis?: CustomApiConfig[];
|
|
13
15
|
children: ReactNode;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export const StoreProvider = ({
|
|
17
19
|
initialOrchestratorConfig,
|
|
20
|
+
orchestratorComponentOverride,
|
|
18
21
|
customApis = [],
|
|
19
22
|
children,
|
|
20
23
|
}: StoreProviderProps) => {
|
|
21
|
-
const store = getOrchestratorStore(
|
|
24
|
+
const store = getOrchestratorStore({
|
|
25
|
+
orchestratorConfig: initialOrchestratorConfig,
|
|
26
|
+
orchestratorComponentOverride,
|
|
27
|
+
customApis,
|
|
28
|
+
});
|
|
22
29
|
const [orchestratorStore] = useState(store);
|
|
23
30
|
|
|
24
31
|
return <Provider store={orchestratorStore}>{children}</Provider>;
|
package/src/types/types.ts
CHANGED
|
@@ -11,11 +11,6 @@ export type FieldValue = {
|
|
|
11
11
|
value: string | number | boolean;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type KeyValue = {
|
|
15
|
-
key: string;
|
|
16
|
-
value: string | number | boolean | undefined;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
14
|
export enum EngineStatus {
|
|
20
15
|
RUNNING = 'RUNNING',
|
|
21
16
|
PAUSING = 'PAUSING',
|
|
@@ -245,8 +240,6 @@ export interface TaskDefinition {
|
|
|
245
240
|
createdAt: string;
|
|
246
241
|
}
|
|
247
242
|
|
|
248
|
-
export type Field<Type> = keyof Type;
|
|
249
|
-
|
|
250
243
|
//// Utility types
|
|
251
244
|
|
|
252
245
|
export enum SortOrder {
|