@orchestrator-ui/orchestrator-ui-components 6.2.1 → 6.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "6.2.1",
3
+ "version": "6.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -92,8 +92,5 @@
92
92
  "type": "module",
93
93
  "main": "./dist/index.js",
94
94
  "browser": "./dist/index.js",
95
- "types": "./dist/index.d.ts",
96
- "overrides": {
97
- "@monaco-editor/loader": "1.5.0"
98
- }
95
+ "types": "./dist/index.d.ts"
99
96
  }
@@ -3,13 +3,14 @@
3
3
  *
4
4
  * Form footer component
5
5
  */
6
- import React from 'react';
6
+ import React, { useContext } from 'react';
7
7
 
8
8
  import { useTranslations } from 'next-intl';
9
9
  import type { PydanticFormFooterProps } from 'pydantic-forms';
10
10
 
11
- import { EuiButton, EuiHorizontalRule } from '@elastic/eui';
11
+ import { EuiButton, EuiFlexGroup, EuiHorizontalRule } from '@elastic/eui';
12
12
 
13
+ import { ConfirmationDialogContext } from '@/contexts';
13
14
  import { useOrchestratorTheme } from '@/hooks';
14
15
 
15
16
  import { RenderFormErrors } from './RenderFormErrors';
@@ -22,10 +23,14 @@ export const Footer = ({
22
23
  }: PydanticFormFooterProps) => {
23
24
  const { theme } = useOrchestratorTheme();
24
25
  const t = useTranslations('pydanticForms.userInputForm');
26
+ const { showConfirmDialog } = useContext(ConfirmationDialogContext);
25
27
 
26
28
  const handlePrevious = () => {
27
29
  if (onCancel) {
28
- onCancel();
30
+ showConfirmDialog({
31
+ question: t('previousQuestion'),
32
+ onConfirm: onCancel,
33
+ });
29
34
  }
30
35
  };
31
36
 
@@ -93,13 +98,24 @@ export const Footer = ({
93
98
  );
94
99
  };
95
100
 
101
+ const PreviousCancelButtonGroup = () => {
102
+ return (
103
+ <EuiFlexGroup gutterSize="xl">
104
+ <PreviousButton />
105
+ <CancelButton />
106
+ </EuiFlexGroup>
107
+ );
108
+ };
109
+
96
110
  return (
97
111
  <div data-testid="pydantic-form-footer">
98
112
  <RenderFormErrors />
99
113
  <EuiHorizontalRule />
100
114
  <div style={{ display: 'flex', justifyContent: 'space-between' }}>
101
115
  <div>
102
- {(hasPrevious && <PreviousButton />) || <CancelButton />}
116
+ {(hasPrevious && <PreviousCancelButtonGroup />) || (
117
+ <CancelButton />
118
+ )}
103
119
  </div>
104
120
 
105
121
  <SubmitButton />
@@ -51,7 +51,7 @@ export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
51
51
  {extraColumnsData &&
52
52
  extraColumnsData.map((_, idx) => (
53
53
  <td className={`value`} key={idx}>
54
- {extraColumnsData[idx][index].toString()}
54
+ {extraColumnsData[idx][index]?.toString()}
55
55
  </td>
56
56
  ))}
57
57
  </tr>
@@ -3,15 +3,27 @@ import React, { useContext, useEffect, useState } from 'react';
3
3
  import { useTranslations } from 'next-intl';
4
4
  import Link from 'next/link';
5
5
 
6
- import { EuiButton } from '@elastic/eui';
6
+ import {
7
+ EuiButton,
8
+ EuiContextMenuItem,
9
+ EuiLoadingSpinner,
10
+ EuiToolTip,
11
+ } from '@elastic/eui';
7
12
 
8
13
  import { WfoIsAllowedToRender } from '@/components';
9
14
  import { WfoInsyncIcon } from '@/components';
10
15
  import { PATH_TASKS, PATH_WORKFLOWS } from '@/components';
11
16
  import { WfoInSyncErrorToastMessage } from '@/components/WfoSubscription/WfoInSyncField/WfoInSyncErrorToastMessage';
17
+ import { getSubscriptionActionStyles } from '@/components/WfoSubscription/WfoSubscriptionActions/styles';
18
+ import { WfoInSyncCompactIcon } from '@/components/WfoSubscription/WfoTargetTypeIcon';
12
19
  import { PolicyResource } from '@/configuration/policy-resources';
13
20
  import { ConfirmationDialogContext } from '@/contexts';
14
- import { useOrchestratorTheme, useShowToastMessage } from '@/hooks';
21
+ import {
22
+ useOrchestratorTheme,
23
+ useShowToastMessage,
24
+ useWithOrchestratorTheme,
25
+ } from '@/hooks';
26
+ import { WfoCheckmarkCircleFill } from '@/icons';
15
27
  import { useSetSubscriptionInSyncMutation } from '@/rtk/endpoints';
16
28
  import { SubscriptionDetail, ToastTypes } from '@/types';
17
29
  import { formatDate } from '@/utils';
@@ -20,11 +32,25 @@ import { getLastUncompletedProcess, getLatestTaskDate } from '../utils';
20
32
 
21
33
  interface WfoInSyncFieldProps {
22
34
  subscriptionDetail: SubscriptionDetail;
35
+ compactMode?: boolean;
36
+ setPopover?: (isOpen: boolean) => void;
23
37
  }
24
38
 
25
- export const WfoInSyncField = ({ subscriptionDetail }: WfoInSyncFieldProps) => {
39
+ export const WfoInSyncField = ({
40
+ subscriptionDetail,
41
+ compactMode = false,
42
+ setPopover,
43
+ }: WfoInSyncFieldProps) => {
26
44
  const t = useTranslations('subscriptions.detail');
27
45
  const { theme } = useOrchestratorTheme();
46
+ const {
47
+ clickableStyle,
48
+ linkMenuItemStyle,
49
+ disabledTextStyle,
50
+ disabledIconStyle,
51
+ secondaryIconStyle,
52
+ spinnerSecondaryIconStyle,
53
+ } = useWithOrchestratorTheme(getSubscriptionActionStyles);
28
54
  const [inSync, setInSync] = useState<boolean>(subscriptionDetail.insync);
29
55
  const lastTaskRunDate = getLatestTaskDate(
30
56
  subscriptionDetail.processes?.page,
@@ -71,20 +97,21 @@ export const WfoInSyncField = ({ subscriptionDetail }: WfoInSyncFieldProps) => {
71
97
  });
72
98
  };
73
99
 
100
+ const confirmSetInSync = () => {
101
+ showConfirmDialog({
102
+ question: t('setInSyncQuestion'),
103
+ onConfirm: () => {
104
+ setInSyncAction();
105
+ setPopover?.(false);
106
+ },
107
+ });
108
+ };
109
+
74
110
  const getProcessLink = () => {
75
111
  const processUrl = `${
76
112
  lastUncompletedProcess?.isTask ? PATH_TASKS : PATH_WORKFLOWS
77
113
  }/${lastUncompletedProcess?.processId}`;
78
114
 
79
- const confirmSetInSync = () => {
80
- showConfirmDialog({
81
- question: t('setInSyncQuestion'),
82
- onConfirm: () => {
83
- setInSyncAction();
84
- },
85
- });
86
- };
87
-
88
115
  return (
89
116
  <>
90
117
  <Link
@@ -111,13 +138,87 @@ export const WfoInSyncField = ({ subscriptionDetail }: WfoInSyncFieldProps) => {
111
138
  );
112
139
  };
113
140
 
114
- return (
141
+ const allowInSyncButton = !inSync && lastUncompletedProcess;
142
+ const showDate = inSync && lastTaskRunDate;
143
+
144
+ const InSyncDetails = () => (
145
+ <>
146
+ <div css={{ display: 'flex' }}>
147
+ <div css={{ paddingRight: theme.base / 4, display: 'flex' }}>
148
+ <WfoInsyncIcon inSync={inSync} />
149
+ </div>
150
+ {showDate && `(${formatDate(lastTaskRunDate)})`}
151
+ {!showDate && compactMode && t('subscriptionIsInSync')}
152
+ </div>
153
+ </>
154
+ );
155
+
156
+ const InSyncDetailsWithButton = () => (
115
157
  <>
116
- <div css={{ paddingRight: theme.base / 4, display: 'flex' }}>
117
- <WfoInsyncIcon inSync={inSync} />
158
+ <InSyncDetails />
159
+ {allowInSyncButton && getProcessLink()}
160
+ </>
161
+ );
162
+
163
+ const InSyncCompactMenuIcon = () => {
164
+ const LoadingSecondaryIcon = () => (
165
+ <div css={spinnerSecondaryIconStyle}>
166
+ <EuiLoadingSpinner size="s" />
118
167
  </div>
119
- {inSync && lastTaskRunDate && `(${formatDate(lastTaskRunDate)})`}
120
- {!inSync && lastUncompletedProcess && getProcessLink()}
168
+ );
169
+ if (!allowInSyncButton) {
170
+ return (
171
+ <div css={disabledIconStyle}>
172
+ <WfoInSyncCompactIcon disabled />
173
+ {isLoading ? (
174
+ <LoadingSecondaryIcon />
175
+ ) : (
176
+ <div css={secondaryIconStyle}>
177
+ <WfoCheckmarkCircleFill
178
+ width={20}
179
+ height={20}
180
+ color={theme.colors.primary}
181
+ />
182
+ </div>
183
+ )}
184
+ </div>
185
+ );
186
+ }
187
+ return (
188
+ <div css={disabledIconStyle}>
189
+ <WfoInSyncCompactIcon disabled={false} />
190
+ {isLoading && <LoadingSecondaryIcon />}
191
+ </div>
192
+ );
193
+ };
194
+
195
+ const InSyncCompactMenuItem = () => {
196
+ return (
197
+ <div css={[allowInSyncButton && clickableStyle, linkMenuItemStyle]}>
198
+ <EuiToolTip
199
+ position="top"
200
+ content={!allowInSyncButton && <InSyncDetails />}
201
+ >
202
+ <EuiContextMenuItem
203
+ css={!allowInSyncButton && disabledTextStyle}
204
+ icon={<InSyncCompactMenuIcon />}
205
+ onClick={confirmSetInSync}
206
+ disabled={!allowInSyncButton}
207
+ >
208
+ {t('setInSync')}
209
+ </EuiContextMenuItem>
210
+ </EuiToolTip>
211
+ </div>
212
+ );
213
+ };
214
+
215
+ return (
216
+ <>
217
+ {!compactMode ? (
218
+ <InSyncDetailsWithButton />
219
+ ) : (
220
+ <InSyncCompactMenuItem />
221
+ )}
121
222
  </>
122
223
  );
123
224
  };
@@ -1,47 +1,25 @@
1
1
  import React, { FC, useState } from 'react';
2
2
 
3
3
  import { useTranslations } from 'next-intl';
4
- import Link from 'next/link';
5
- import { useRouter } from 'next/router';
6
4
 
7
5
  import {
8
6
  EuiButton,
9
7
  EuiButtonIcon,
10
- EuiContextMenuItem,
11
8
  EuiContextMenuPanel,
12
9
  EuiLoadingSpinner,
13
10
  EuiPanel,
14
11
  EuiPopover,
15
12
  EuiTitle,
16
- EuiToolTip,
17
13
  } from '@elastic/eui';
18
14
 
19
- import { PATH_START_NEW_TASK, PATH_START_NEW_WORKFLOW } from '@/components';
15
+ import { WfoInSyncField } from '@/components';
16
+ import { WfoSubscriptionActionsMenuItem } from '@/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionsMenuItem';
20
17
  import { PolicyResource } from '@/configuration/policy-resources';
21
- import {
22
- useCheckEngineStatus,
23
- useOrchestratorTheme,
24
- usePolicy,
25
- useWithOrchestratorTheme,
26
- } from '@/hooks';
27
- import { WfoXCircleFill } from '@/icons';
18
+ import { usePolicy } from '@/hooks';
28
19
  import { WfoDotsHorizontal } from '@/icons/WfoDotsHorizontal';
20
+ import { useGetSubscriptionDetailQuery } from '@/rtk';
29
21
  import { useGetSubscriptionActionsQuery } from '@/rtk/endpoints/subscriptionActions';
30
- import { SubscriptionAction, WorkflowTarget } from '@/types';
31
-
32
- import { WfoTargetTypeIcon } from '../WfoTargetTypeIcon';
33
- import { flattenArrayProps } from '../utils';
34
- import { WfoSubscriptionActionExpandableMenuItem } from './WfoSubscriptionActionExpandableMenuItem';
35
- import { getSubscriptionActionStyles } from './styles';
36
-
37
- type MenuItemProps = {
38
- key: string;
39
- action: SubscriptionAction;
40
- index: number;
41
- target: WorkflowTarget;
42
- isTask?: boolean;
43
- isDisabled?: boolean;
44
- };
22
+ import { WorkflowTarget } from '@/types';
45
23
 
46
24
  type MenuBlockProps = {
47
25
  title: string;
@@ -63,16 +41,6 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
63
41
  isLoading,
64
42
  compactMode = false,
65
43
  }) => {
66
- const { theme } = useOrchestratorTheme();
67
- const {
68
- linkMenuItemStyle,
69
- tooltipMenuItemStyle,
70
- disabledIconStyle,
71
- iconStyle,
72
- secondaryIconStyle,
73
- } = useWithOrchestratorTheme(getSubscriptionActionStyles);
74
-
75
- const router = useRouter();
76
44
  const t = useTranslations('subscriptions.detail.actions');
77
45
  const [isPopoverOpen, setPopover] = useState(false);
78
46
  const disableQuery = isLoading || (!isPopoverOpen && compactMode);
@@ -83,86 +51,19 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
83
51
  { subscriptionId },
84
52
  { skip: disableQuery },
85
53
  );
86
- const { isEngineRunningNow } = useCheckEngineStatus();
54
+
55
+ const { data: subscriptionDetail } = useGetSubscriptionDetailQuery(
56
+ {
57
+ subscriptionId,
58
+ },
59
+ { skip: !isPopoverOpen && compactMode },
60
+ );
61
+
87
62
  const { isAllowed } = usePolicy();
88
63
 
89
64
  const onButtonClick = () => setPopover(!isPopoverOpen);
90
65
  const closePopover = () => setPopover(false);
91
66
 
92
- const MenuItem: FC<MenuItemProps> = ({
93
- action,
94
- target,
95
- isTask = false,
96
- }) => {
97
- const linkIt = (actionItem: React.ReactNode) => {
98
- const path = isTask ? PATH_START_NEW_TASK : PATH_START_NEW_WORKFLOW;
99
- const url = {
100
- pathname: `${path}/${action.name}`,
101
- query: { subscriptionId },
102
- };
103
-
104
- const handleLinkClick = async (e: React.MouseEvent) => {
105
- e.preventDefault();
106
- setPopover(false);
107
- if (await isEngineRunningNow()) {
108
- router.push(url);
109
- }
110
- };
111
-
112
- return (
113
- <Link href={url} onClick={handleLinkClick}>
114
- <div css={linkMenuItemStyle}>{actionItem}</div>
115
- </Link>
116
- );
117
- };
118
-
119
- const tooltipIt = (actionItem: React.ReactNode) => {
120
- if (!action.reason) return actionItem;
121
- const tooltipContent = t(action.reason, flattenArrayProps(action));
122
-
123
- return (
124
- <div css={tooltipMenuItemStyle}>
125
- <EuiToolTip position="top" content={tooltipContent}>
126
- <WfoSubscriptionActionExpandableMenuItem
127
- subscriptionAction={action}
128
- onClickLockedRelation={() => setPopover(false)}
129
- >
130
- {actionItem}
131
- </WfoSubscriptionActionExpandableMenuItem>
132
- </EuiToolTip>
133
- </div>
134
- );
135
- };
136
-
137
- const getIcon = () =>
138
- action.reason ? (
139
- <div css={disabledIconStyle}>
140
- <WfoTargetTypeIcon target={target} disabled />
141
- <div css={secondaryIconStyle}>
142
- <WfoXCircleFill
143
- width={20}
144
- height={20}
145
- color={theme.colors.danger}
146
- />
147
- </div>
148
- </div>
149
- ) : (
150
- <div css={iconStyle}>
151
- <WfoTargetTypeIcon target={target} />
152
- </div>
153
- );
154
-
155
- const ActionItem = () => (
156
- <EuiContextMenuItem icon={getIcon()} disabled={!!action.reason}>
157
- {action.description}
158
- </EuiContextMenuItem>
159
- );
160
-
161
- return action?.reason
162
- ? tooltipIt(<ActionItem />)
163
- : linkIt(<ActionItem />);
164
- };
165
-
166
67
  const button = compactMode ? (
167
68
  <EuiButtonIcon
168
69
  iconType={() => <WfoDotsHorizontal />}
@@ -186,6 +87,7 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
186
87
  SUBSCRIPTION_RECONCILE,
187
88
  SUBSCRIPTION_MODIFY,
188
89
  SUBSCRIPTION_TERMINATE,
90
+ SET_IN_SYNC,
189
91
  } = PolicyResource;
190
92
  const compactItems = (
191
93
  <>
@@ -194,12 +96,14 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
194
96
  <>
195
97
  {!compactMode && <MenuBlock title={t('tasks')} />}
196
98
  {subscriptionActions.validate.map((action, index) => (
197
- <MenuItem
99
+ <WfoSubscriptionActionsMenuItem
198
100
  key={`s_${index}`}
199
101
  action={action}
200
102
  index={index}
201
103
  target={WorkflowTarget.VALIDATE}
202
104
  isTask
105
+ subscriptionId={subscriptionId}
106
+ setPopover={setPopover}
203
107
  />
204
108
  ))}
205
109
  </>
@@ -210,15 +114,27 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
210
114
  <>
211
115
  {!compactMode && <MenuBlock title={t('reconcile')} />}
212
116
  {subscriptionActions?.reconcile.map((action, index) => (
213
- <MenuItem
117
+ <WfoSubscriptionActionsMenuItem
214
118
  key={`r_${index}`}
215
119
  action={action}
216
120
  index={index}
217
121
  target={WorkflowTarget.RECONCILE}
122
+ subscriptionId={subscriptionId}
123
+ setPopover={setPopover}
218
124
  />
219
125
  ))}
220
126
  </>
221
127
  )}
128
+
129
+ {isAllowed(SET_IN_SYNC) && compactMode && subscriptionDetail && (
130
+ <div>
131
+ <WfoInSyncField
132
+ compactMode={true}
133
+ subscriptionDetail={subscriptionDetail?.subscription}
134
+ setPopover={setPopover}
135
+ />
136
+ </div>
137
+ )}
222
138
  </>
223
139
  );
224
140
 
@@ -229,11 +145,13 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
229
145
  <>
230
146
  <MenuBlock title={t('modify')} />
231
147
  {subscriptionActions.modify.map((action, index) => (
232
- <MenuItem
148
+ <WfoSubscriptionActionsMenuItem
233
149
  key={`m_${index}`}
234
150
  action={action}
235
151
  index={index}
236
152
  target={WorkflowTarget.MODIFY}
153
+ subscriptionId={subscriptionId}
154
+ setPopover={setPopover}
237
155
  />
238
156
  ))}
239
157
  </>
@@ -244,11 +162,13 @@ export const WfoSubscriptionActions: FC<WfoSubscriptionActionsProps> = ({
244
162
  <>
245
163
  <MenuBlock title={t('terminate')} />
246
164
  {subscriptionActions.terminate.map((action, index) => (
247
- <MenuItem
165
+ <WfoSubscriptionActionsMenuItem
248
166
  key={`t_${index}`}
249
167
  action={action}
250
168
  index={index}
251
169
  target={WorkflowTarget.TERMINATE}
170
+ subscriptionId={subscriptionId}
171
+ setPopover={setPopover}
252
172
  />
253
173
  ))}
254
174
  </>
@@ -0,0 +1,122 @@
1
+ import React, { FC } from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+ import Link from 'next/link';
5
+ import { useRouter } from 'next/router';
6
+
7
+ import { EuiContextMenuItem, EuiToolTip } from '@elastic/eui';
8
+
9
+ import { flattenArrayProps } from '@/components';
10
+ import {
11
+ PATH_START_NEW_TASK,
12
+ PATH_START_NEW_WORKFLOW,
13
+ } from '@/components/WfoPageTemplate';
14
+ import { WfoSubscriptionActionExpandableMenuItem } from '@/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionExpandableMenuItem';
15
+ import { getSubscriptionActionStyles } from '@/components/WfoSubscription/WfoSubscriptionActions/styles';
16
+ import {
17
+ useCheckEngineStatus,
18
+ useOrchestratorTheme,
19
+ useWithOrchestratorTheme,
20
+ } from '@/hooks';
21
+ import { WfoXCircleFill } from '@/icons';
22
+ import { SubscriptionAction, WorkflowTarget } from '@/types';
23
+
24
+ import { WfoTargetTypeIcon } from '../WfoTargetTypeIcon';
25
+
26
+ interface MenuItemProps {
27
+ key: string;
28
+ action: SubscriptionAction;
29
+ index: number;
30
+ target: WorkflowTarget;
31
+ isTask?: boolean;
32
+ isDisabled?: boolean;
33
+ subscriptionId: string;
34
+ setPopover: (isOpen: boolean) => void;
35
+ }
36
+
37
+ export const WfoSubscriptionActionsMenuItem: FC<MenuItemProps> = ({
38
+ action,
39
+ target,
40
+ isTask = false,
41
+ subscriptionId,
42
+ setPopover,
43
+ }) => {
44
+ const {
45
+ linkMenuItemStyle,
46
+ tooltipMenuItemStyle,
47
+ disabledIconStyle,
48
+ iconStyle,
49
+ secondaryIconStyle,
50
+ } = useWithOrchestratorTheme(getSubscriptionActionStyles);
51
+
52
+ const { isEngineRunningNow } = useCheckEngineStatus();
53
+ const router = useRouter();
54
+ const t = useTranslations('subscriptions.detail.actions');
55
+ const { theme } = useOrchestratorTheme();
56
+
57
+ const linkIt = (actionItem: React.ReactNode) => {
58
+ const path = isTask ? PATH_START_NEW_TASK : PATH_START_NEW_WORKFLOW;
59
+ const url = {
60
+ pathname: `${path}/${action.name}`,
61
+ query: { subscriptionId },
62
+ };
63
+
64
+ const handleLinkClick = async (e: React.MouseEvent) => {
65
+ e.preventDefault();
66
+ setPopover(false);
67
+ if (await isEngineRunningNow()) {
68
+ router.push(url);
69
+ }
70
+ };
71
+
72
+ return (
73
+ <Link href={url} onClick={handleLinkClick}>
74
+ <div css={linkMenuItemStyle}>{actionItem}</div>
75
+ </Link>
76
+ );
77
+ };
78
+
79
+ const tooltipIt = (actionItem: React.ReactNode) => {
80
+ if (!action.reason) return actionItem;
81
+ const tooltipContent = t(action.reason, flattenArrayProps(action));
82
+
83
+ return (
84
+ <div css={tooltipMenuItemStyle}>
85
+ <EuiToolTip position="top" content={tooltipContent}>
86
+ <WfoSubscriptionActionExpandableMenuItem
87
+ subscriptionAction={action}
88
+ onClickLockedRelation={() => setPopover(false)}
89
+ >
90
+ {actionItem}
91
+ </WfoSubscriptionActionExpandableMenuItem>
92
+ </EuiToolTip>
93
+ </div>
94
+ );
95
+ };
96
+
97
+ const getIcon = () =>
98
+ action.reason ? (
99
+ <div css={disabledIconStyle}>
100
+ <WfoTargetTypeIcon target={target} disabled />
101
+ <div css={secondaryIconStyle}>
102
+ <WfoXCircleFill
103
+ width={20}
104
+ height={20}
105
+ color={theme.colors.danger}
106
+ />
107
+ </div>
108
+ </div>
109
+ ) : (
110
+ <div css={iconStyle}>
111
+ <WfoTargetTypeIcon target={target} />
112
+ </div>
113
+ );
114
+
115
+ const ActionItem = () => (
116
+ <EuiContextMenuItem icon={getIcon()} disabled={!!action.reason}>
117
+ {action.description}
118
+ </EuiContextMenuItem>
119
+ );
120
+
121
+ return action?.reason ? tooltipIt(<ActionItem />) : linkIt(<ActionItem />);
122
+ };
@@ -36,6 +36,9 @@ export const getSubscriptionActionStyles = ({ theme }: WfoTheme) => {
36
36
  backgroundColor: theme.colors.lightestShade,
37
37
  borderRadius: theme.border.radius.medium,
38
38
  },
39
+ '.euiToolTipAnchor': {
40
+ width: '100%',
41
+ },
39
42
  });
40
43
 
41
44
  const tooltipMenuItemStyle = css([
@@ -60,6 +63,14 @@ export const getSubscriptionActionStyles = ({ theme }: WfoTheme) => {
60
63
  transform: 'translate(-11px, -8px);',
61
64
  });
62
65
 
66
+ const spinnerSecondaryIconStyle = css({
67
+ transform: 'translate(-8px, -6px);',
68
+ });
69
+
70
+ const disabledTextStyle = css({
71
+ color: theme.colors.textDisabled,
72
+ });
73
+
63
74
  return {
64
75
  clickableStyle,
65
76
  expandableMenuItemStyle,
@@ -71,5 +82,7 @@ export const getSubscriptionActionStyles = ({ theme }: WfoTheme) => {
71
82
  disabledIconStyle,
72
83
  iconStyle,
73
84
  secondaryIconStyle,
85
+ disabledTextStyle,
86
+ spinnerSecondaryIconStyle,
74
87
  };
75
88
  };