Skip to content

Commit

Permalink
use description instead of tooltip on reset menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
rossedfort committed Oct 8, 2024
1 parent 7757a34 commit efb298a
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/lib/components/workflow-actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
let terminateConfirmationModalOpen = false;
let resetConfirmationModalOpen = false;
let signalConfirmationModalOpen = false;
let resetTooltipText: string;
let resetDescription: string;
let coreUser = coreUserStore();
$: cancelEnabled = workflowCancelEnabled(
Expand Down Expand Up @@ -71,20 +71,20 @@
enabled: boolean;
testId: string;
destructive?: boolean;
tooltip?: string;
description?: string;
}[];
$: {
if (!resetAuthorized) {
resetTooltipText = translate('workflows.reset-disabled-unauthorized');
resetDescription = translate('workflows.reset-disabled-unauthorized');
} else if (resetAuthorized && workflow?.pendingChildren?.length > 0) {
resetTooltipText = translate('workflows.reset-disabled-pending-children');
resetDescription = translate('workflows.reset-disabled-pending-children');
} else if (
resetAuthorized &&
workflow?.pendingChildren?.length === 0 &&
$resetEvents.length === 0
) {
resetTooltipText = translate('workflows.reset-disabled-no-events');
resetDescription = translate('workflows.reset-disabled-no-events');
}
}
Expand All @@ -94,22 +94,22 @@
onClick: () => (resetConfirmationModalOpen = true),
testId: 'reset-button',
enabled: resetEnabled,
tooltip: resetEnabled ? '' : resetTooltipText,
description: resetEnabled ? '' : resetDescription,
},
{
label: translate('workflows.signal'),
onClick: () => (signalConfirmationModalOpen = true),
testId: 'signal-button',
enabled: signalEnabled,
tooltip: signalEnabled ? '' : translate('workflows.signal-disabled'),
description: signalEnabled ? '' : translate('workflows.signal-disabled'),
},
{
label: translate('workflows.terminate'),
onClick: () => (terminateConfirmationModalOpen = true),
testId: 'terminate-button',
enabled: terminateEnabled,
destructive: true,
tooltip: terminateEnabled
description: terminateEnabled
? ''
: translate('workflows.terminate-disabled'),
},
Expand All @@ -126,20 +126,19 @@
label={translate('workflows.request-cancellation')}
menuLabel={translate('workflows.workflow-actions')}
>
{#each workflowActions as { onClick, destructive, label, enabled, testId, tooltip }}
{#each workflowActions as { onClick, destructive, label, enabled, testId, description }}
{#if destructive}
<MenuDivider />
{/if}
<Tooltip text={tooltip} hide={!tooltip} width={200} left>
<MenuItem
on:click={onClick}
{destructive}
disabled={!enabled}
data-testid={testId}
>
{label}
</MenuItem>
</Tooltip>
<MenuItem
on:click={onClick}
{destructive}
disabled={!enabled}
data-testid={testId}
{description}
>
{label}
</MenuItem>
{/each}
{#if !workflowCreateDisabled($page)}
<MenuDivider />
Expand Down Expand Up @@ -184,7 +183,7 @@
</MenuItem>
</SplitButton>
{:else}
<Tooltip bottomRight width={200} text={resetTooltipText} hide={resetEnabled}>
<Tooltip bottomRight width={200} text={resetDescription} hide={resetEnabled}>
<Button
aria-label={translate('workflows.reset')}
disabled={!resetEnabled}
Expand Down

0 comments on commit efb298a

Please sign in to comment.