Skip to content

Commit 17398e7

Browse files
authored
DT-1495 - use description instead of tooltip on reset menu item (#2373)
* use description instead of tooltip on reset menu item * fix menu width on workflow actions
1 parent f4f9bfc commit 17398e7

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

src/lib/components/workflow-actions.svelte

+21-20
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
let terminateConfirmationModalOpen = false;
3232
let resetConfirmationModalOpen = false;
3333
let signalConfirmationModalOpen = false;
34-
let resetTooltipText: string;
34+
let resetDescription: string;
3535
let coreUser = coreUserStore();
3636
3737
$: cancelEnabled = workflowCancelEnabled(
@@ -71,20 +71,20 @@
7171
enabled: boolean;
7272
testId: string;
7373
destructive?: boolean;
74-
tooltip?: string;
74+
description?: string;
7575
}[];
7676
7777
$: {
7878
if (!resetAuthorized) {
79-
resetTooltipText = translate('workflows.reset-disabled-unauthorized');
79+
resetDescription = translate('workflows.reset-disabled-unauthorized');
8080
} else if (resetAuthorized && workflow?.pendingChildren?.length > 0) {
81-
resetTooltipText = translate('workflows.reset-disabled-pending-children');
81+
resetDescription = translate('workflows.reset-disabled-pending-children');
8282
} else if (
8383
resetAuthorized &&
8484
workflow?.pendingChildren?.length === 0 &&
8585
$resetEvents.length === 0
8686
) {
87-
resetTooltipText = translate('workflows.reset-disabled-no-events');
87+
resetDescription = translate('workflows.reset-disabled-no-events');
8888
}
8989
}
9090
@@ -94,22 +94,22 @@
9494
onClick: () => (resetConfirmationModalOpen = true),
9595
testId: 'reset-button',
9696
enabled: resetEnabled,
97-
tooltip: resetEnabled ? '' : resetTooltipText,
97+
description: resetEnabled ? '' : resetDescription,
9898
},
9999
{
100100
label: translate('workflows.signal'),
101101
onClick: () => (signalConfirmationModalOpen = true),
102102
testId: 'signal-button',
103103
enabled: signalEnabled,
104-
tooltip: signalEnabled ? '' : translate('workflows.signal-disabled'),
104+
description: signalEnabled ? '' : translate('workflows.signal-disabled'),
105105
},
106106
{
107107
label: translate('workflows.terminate'),
108108
onClick: () => (terminateConfirmationModalOpen = true),
109109
testId: 'terminate-button',
110110
enabled: terminateEnabled,
111111
destructive: true,
112-
tooltip: terminateEnabled
112+
description: terminateEnabled
113113
? ''
114114
: translate('workflows.terminate-disabled'),
115115
},
@@ -119,27 +119,27 @@
119119
{#if isRunning}
120120
<SplitButton
121121
id="workflow-actions"
122+
menuClass="w-[24rem]"
122123
position="right"
123124
disabled={actionsDisabled}
124125
primaryActionDisabled={!cancelEnabled || cancelInProgress}
125126
on:click={() => (cancelConfirmationModalOpen = true)}
126127
label={translate('workflows.request-cancellation')}
127128
menuLabel={translate('workflows.workflow-actions')}
128129
>
129-
{#each workflowActions as { onClick, destructive, label, enabled, testId, tooltip }}
130+
{#each workflowActions as { onClick, destructive, label, enabled, testId, description }}
130131
{#if destructive}
131132
<MenuDivider />
132133
{/if}
133-
<Tooltip text={tooltip} hide={!tooltip} width={200} left>
134-
<MenuItem
135-
on:click={onClick}
136-
{destructive}
137-
disabled={!enabled}
138-
data-testid={testId}
139-
>
140-
{label}
141-
</MenuItem>
142-
</Tooltip>
134+
<MenuItem
135+
on:click={onClick}
136+
{destructive}
137+
disabled={!enabled}
138+
data-testid={testId}
139+
{description}
140+
>
141+
{label}
142+
</MenuItem>
143143
{/each}
144144
{#if !workflowCreateDisabled($page)}
145145
<MenuDivider />
@@ -162,6 +162,7 @@
162162
{:else if !workflowCreateDisabled($page)}
163163
<SplitButton
164164
id="workflow-actions"
165+
menuClass="w-[16rem]"
165166
position="right"
166167
primaryActionDisabled={!resetEnabled}
167168
on:click={() => (resetConfirmationModalOpen = true)}
@@ -184,7 +185,7 @@
184185
</MenuItem>
185186
</SplitButton>
186187
{:else}
187-
<Tooltip bottomRight width={200} text={resetTooltipText} hide={resetEnabled}>
188+
<Tooltip bottomRight width={200} text={resetDescription} hide={resetEnabled}>
188189
<Button
189190
aria-label={translate('workflows.reset')}
190191
disabled={!resetEnabled}

src/lib/holocene/split-button.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
export let position: 'left' | 'right' = 'left';
1313
export let primaryActionDisabled = false;
1414
export let href: string | undefined = undefined;
15+
export let menuClass: string | undefined = undefined;
1516
</script>
1617

1718
<MenuContainer class={$$props.class}>
@@ -38,7 +39,7 @@
3839
/>
3940
</div>
4041

41-
<Menu id="{id}-menu" {position} class="max-w-fit">
42+
<Menu id="{id}-menu" {position} class={menuClass}>
4243
<slot />
4344
</Menu>
4445
</MenuContainer>

0 commit comments

Comments
 (0)