fix(ui): disabled reasons and truncated values reachable without hover (#1752)
Disabled New run and task-row buttons now carry their reason in a Tooltip
on a focusable wrapper (disabled buttons cannot take focus), and New run
says when the task list has not loaded. Truncated values (binding filter
and failure reason, activity rows, live alerts, event-type rule summaries,
source URLs, mapping field paths) are focusable spans whose full text is in
a Tooltip. The org switcher has distinct loading ('…' tile, 'Loading…')
and failed ('!' tile, 'Organisations unavailable') states.
This commit is contained in:
9 files changed
+69
-60
No files matched your search
@@ -3,6 +3,7 @@ import { computed } from "vue";
|
|||||||
import { Check, Pause, Pencil, Play, Trash2 } from "@lucide/vue";
|
import { Check, Pause, Pencil, Play, Trash2 } from "@lucide/vue";
|
||||||
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||||
import { MoreMenu } from "@/components/ui/more-menu";
|
import { MoreMenu } from "@/components/ui/more-menu";
|
||||||
@@ -51,22 +52,24 @@ const emit = defineEmits<{
|
|||||||
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
|
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell class="max-w-56 font-mono text-caption text-fg-muted">
|
||||||
class="max-w-56 truncate font-mono text-caption text-fg-muted"
|
<Tooltip>
|
||||||
:title="props.binding.filter"
|
<TooltipTrigger as-child>
|
||||||
>
|
<span tabindex="0" class="block truncate">{{ props.binding.filter || "–" }}</span>
|
||||||
{{ props.binding.filter || "–" }}
|
</TooltipTrigger>
|
||||||
|
<TooltipContent v-if="props.binding.filter">{{ props.binding.filter }}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
{{ props.binding.workflow || "–" }}
|
{{ props.binding.workflow || "–" }}
|
||||||
<Badge v-if="props.binding.workflow_disabled" variant="warn">Disabled</Badge>
|
<Badge v-if="props.binding.workflow_disabled" variant="warn">Disabled</Badge>
|
||||||
<Badge
|
<Tooltip v-if="failing">
|
||||||
v-if="failing"
|
<TooltipTrigger as-child>
|
||||||
variant="danger"
|
<span tabindex="0" class="inline-flex"><Badge variant="danger">Not dispatching</Badge></span>
|
||||||
:title="props.binding.last_outcome?.reason"
|
</TooltipTrigger>
|
||||||
>Not dispatching</Badge
|
<TooltipContent v-if="props.binding.last_outcome?.reason">{{ props.binding.last_outcome?.reason }}</TooltipContent>
|
||||||
>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell class="font-mono text-fg-muted">{{
|
<TableCell class="font-mono text-fg-muted">{{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import {
|
import {
|
||||||
ClipboardPaste,
|
ClipboardPaste,
|
||||||
Pencil,
|
Pencil,
|
||||||
@@ -95,10 +96,7 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
|||||||
fieldCount(p.schema)
|
fieldCount(p.schema)
|
||||||
}}</TableCell>
|
}}</TableCell>
|
||||||
<TableCell class="font-mono text-caption"
|
<TableCell class="font-mono text-caption"
|
||||||
><span
|
><Tooltip><TooltipTrigger as-child><span tabindex="0" class="block max-w-96 truncate">{{ ruleSummary(p.rule) }}</span></TooltipTrigger><TooltipContent>{{ ruleSummary(p.rule) }}</TooltipContent></Tooltip
|
||||||
class="block max-w-96 truncate"
|
|
||||||
:title="ruleSummary(p.rule)"
|
|
||||||
>{{ ruleSummary(p.rule) }}</span
|
|
||||||
></TableCell
|
></TableCell
|
||||||
>
|
>
|
||||||
<TableCell class="text-right">
|
<TableCell class="text-right">
|
||||||
@@ -126,10 +124,7 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
|||||||
<TableCell class="font-mono">{{ t.source }}</TableCell>
|
<TableCell class="font-mono">{{ t.source }}</TableCell>
|
||||||
<TableCell>{{ t.name }}</TableCell>
|
<TableCell>{{ t.name }}</TableCell>
|
||||||
<TableCell class="font-mono text-caption"
|
<TableCell class="font-mono text-caption"
|
||||||
><span
|
><Tooltip><TooltipTrigger as-child><span tabindex="0" class="block max-w-96 truncate">{{ ruleSummary(t.rule) }}</span></TooltipTrigger><TooltipContent>{{ ruleSummary(t.rule) }}</TooltipContent></Tooltip
|
||||||
class="block max-w-96 truncate"
|
|
||||||
:title="ruleSummary(t.rule)"
|
|
||||||
>{{ ruleSummary(t.rule) }}</span
|
|
||||||
></TableCell
|
></TableCell
|
||||||
>
|
>
|
||||||
<TableCell class="text-right whitespace-nowrap">
|
<TableCell class="text-right whitespace-nowrap">
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ async function choose(id: string): Promise<void> {
|
|||||||
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground disabled:opacity-100"
|
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground disabled:opacity-100"
|
||||||
>
|
>
|
||||||
<div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg font-semibold">
|
<div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg font-semibold">
|
||||||
{{ active ? initial(active.name) : "?" }}
|
{{ active ? initial(active.name) : failed ? "!" : "…" }}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid flex-1 text-left leading-tight">
|
<div class="grid flex-1 text-left leading-tight">
|
||||||
<span class="truncate text-label font-medium">{{ active?.name ?? (failed ? "Organisations unavailable" : "") }}</span>
|
<span class="truncate text-label font-medium">{{ active?.name ?? (failed ? "Organisations unavailable" : "Loading…") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronsUpDown v-if="choices.length > 1" class="ml-auto" aria-hidden="true" />
|
<ChevronsUpDown v-if="choices.length > 1" class="ml-auto" aria-hidden="true" />
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
import { TableCell, TableRow } from "@/components/ui/table";
|
import { TableCell, TableRow } from "@/components/ui/table";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Timestamp } from "@/components/ui/timestamp";
|
import { Timestamp } from "@/components/ui/timestamp";
|
||||||
import { useOrgStore } from "@/stores/org";
|
import { useOrgStore } from "@/stores/org";
|
||||||
import { activityDetail } from "./activity-detail";
|
import { activityDetail } from "./activity-detail";
|
||||||
@@ -49,11 +50,12 @@ function open() {
|
|||||||
taskID > 0 ? `#${taskID}` : "–"
|
taskID > 0 ? `#${taskID}` : "–"
|
||||||
}}</TableCell>
|
}}</TableCell>
|
||||||
<TableCell class="w-[55%] max-w-0">
|
<TableCell class="w-[55%] max-w-0">
|
||||||
<span
|
<Tooltip>
|
||||||
class="block truncate"
|
<TooltipTrigger as-child>
|
||||||
:title="detail.truncated ? detail.full : undefined"
|
<span tabindex="0" class="block truncate">{{ detail.text }}</span>
|
||||||
>{{ detail.text }}</span
|
</TooltipTrigger>
|
||||||
>
|
<TooltipContent v-if="detail.truncated">{{ detail.full }}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell><Timestamp :at="event.at" /></TableCell>
|
<TableCell><Timestamp :at="event.at" /></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useRouter } from "vue-router";
|
|||||||
|
|
||||||
import { ChevronDown, ChevronRight } from "@lucide/vue";
|
import { ChevronDown, ChevronRight } from "@lucide/vue";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Section } from "@/components/ui/section";
|
import { Section } from "@/components/ui/section";
|
||||||
import { StatusDot } from "@/components/ui/status-dot";
|
import { StatusDot } from "@/components/ui/status-dot";
|
||||||
import { Timestamp } from "@/components/ui/timestamp";
|
import { Timestamp } from "@/components/ui/timestamp";
|
||||||
@@ -132,7 +133,12 @@ function openTask(taskID: number) {
|
|||||||
<TableCell class="font-mono">–</TableCell>
|
<TableCell class="font-mono">–</TableCell>
|
||||||
<TableCell class="w-[55%] max-w-0">
|
<TableCell class="w-[55%] max-w-0">
|
||||||
<span class="flex items-center gap-3">
|
<span class="flex items-center gap-3">
|
||||||
<span class="min-w-0 flex-1 truncate" :title="alert.body || undefined">{{ alert.title }}</span>
|
<Tooltip>
|
||||||
|
<TooltipTrigger as-child>
|
||||||
|
<span tabindex="0" class="min-w-0 flex-1 truncate">{{ alert.title }}</span>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent v-if="alert.body">{{ alert.body }}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
<RouterLink v-if="alert.link" :to="alert.link" class="shrink-0 text-warn hover:underline">Fix →</RouterLink>
|
<RouterLink v-if="alert.link" :to="alert.link" class="shrink-0 text-warn hover:underline">Fix →</RouterLink>
|
||||||
</span>
|
</span>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -202,15 +208,12 @@ function openTask(taskID: number) {
|
|||||||
group.taskID > 0 ? `#${group.taskID}` : "–"
|
group.taskID > 0 ? `#${group.taskID}` : "–"
|
||||||
}}</TableCell>
|
}}</TableCell>
|
||||||
<TableCell class="w-[55%] max-w-0">
|
<TableCell class="w-[55%] max-w-0">
|
||||||
<span
|
<Tooltip>
|
||||||
class="block truncate"
|
<TooltipTrigger as-child>
|
||||||
:title="
|
<span tabindex="0" class="block truncate">{{ groupDetail(group).text }}</span>
|
||||||
groupDetail(group).truncated
|
</TooltipTrigger>
|
||||||
? groupDetail(group).full
|
<TooltipContent v-if="groupDetail(group).truncated">{{ groupDetail(group).full }}</TooltipContent>
|
||||||
: undefined
|
</Tooltip>
|
||||||
"
|
|
||||||
>{{ groupDetail(group).text }}</span
|
|
||||||
>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell><Timestamp :at="group.representative.at" /></TableCell>
|
<TableCell><Timestamp :at="group.representative.at" /></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { Trash2 } from "@lucide/vue";
|
import { Trash2 } from "@lucide/vue";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {
|
import {
|
||||||
@@ -50,9 +51,7 @@ const emit = defineEmits<{
|
|||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell class="font-mono text-caption">
|
<TableCell class="font-mono text-caption">
|
||||||
<span class="block max-w-56 truncate" :title="field.path">{{
|
<Tooltip><TooltipTrigger as-child><span tabindex="0" class="block max-w-56 truncate">{{ field.path }}</span></TooltipTrigger><TooltipContent>{{ field.path }}</TooltipContent></Tooltip>
|
||||||
field.path
|
|
||||||
}}</span>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ function url(source: Source): string {
|
|||||||
:disabled="busy"
|
:disabled="busy"
|
||||||
@change="rename(source, ($event.target as HTMLInputElement).value)"
|
@change="rename(source, ($event.target as HTMLInputElement).value)"
|
||||||
/>
|
/>
|
||||||
<span class="truncate" :title="url(source)">{{ source.path }}</span>
|
<Tooltip><TooltipTrigger as-child><span tabindex="0" class="truncate">{{ source.path }}</span></TooltipTrigger><TooltipContent>{{ url(source) }}</TooltipContent></Tooltip>
|
||||||
<Input
|
<Input
|
||||||
class="h-6 border-transparent px-1 font-mono text-caption text-fg-muted shadow-none hover:border-input md:text-caption dark:bg-transparent"
|
class="h-6 border-transparent px-1 font-mono text-caption text-fg-muted shadow-none hover:border-input md:text-caption dark:bg-transparent"
|
||||||
:model-value="source.delivery_header ?? ''"
|
:model-value="source.delivery_header ?? ''"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
} from "@/components/ui/alert-dialog";
|
} from "@/components/ui/alert-dialog";
|
||||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
import { statusLabel } from "@/lib/task-meta";
|
import { statusLabel } from "@/lib/task-meta";
|
||||||
|
|
||||||
@@ -43,7 +44,8 @@ const confirmText = computed(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const unavailable = computed(() => {
|
const unavailable = computed(() => {
|
||||||
if (run.canRetry || run.taskList === undefined) return "";
|
if (run.taskList === undefined) return "The task list has not loaded yet.";
|
||||||
|
if (run.canRetry) return "";
|
||||||
return run.task
|
return run.task
|
||||||
? `Only a parked task can start a new run. This task is ${statusLabel(run.task.status ?? "")}.`
|
? `Only a parked task can start a new run. This task is ${statusLabel(run.task.status ?? "")}.`
|
||||||
: "";
|
: "";
|
||||||
@@ -62,16 +64,21 @@ const errorText = computed(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AlertDialog>
|
<AlertDialog>
|
||||||
<AlertDialogTrigger as-child>
|
<Tooltip>
|
||||||
<Button
|
<TooltipTrigger as-child>
|
||||||
:class="props.class"
|
<span tabindex="0" class="inline-flex" :class="props.class">
|
||||||
:variant="run.retryKind === 'primary' ? 'default' : 'outline'"
|
<AlertDialogTrigger as-child>
|
||||||
:disabled="!run.canRetry || run.retryBusy"
|
<Button
|
||||||
:title="unavailable || undefined"
|
:variant="run.retryKind === 'primary' ? 'default' : 'outline'"
|
||||||
>
|
:disabled="!run.canRetry || run.retryBusy"
|
||||||
<Spinner v-if="run.retryBusy" data-icon="inline-start" />{{ run.retryBusy ? "Starting…" : "New run" }}
|
>
|
||||||
</Button>
|
<Spinner v-if="run.retryBusy" data-icon="inline-start" />{{ run.retryBusy ? "Starting…" : "New run" }}
|
||||||
</AlertDialogTrigger>
|
</Button>
|
||||||
|
</AlertDialogTrigger>
|
||||||
|
</span>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent v-if="unavailable">{{ unavailable }}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>New run</AlertDialogTitle>
|
<AlertDialogTitle>New run</AlertDialogTitle>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from "@/components/ui/alert-dialog";
|
} from "@/components/ui/alert-dialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -308,15 +309,14 @@ function onConfirmationOpen(open: boolean) {
|
|||||||
>{{ control.label }}</a
|
>{{ control.label }}</a
|
||||||
>
|
>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Tooltip v-else>
|
||||||
v-else
|
<TooltipTrigger as-child>
|
||||||
variant="ghost"
|
<span tabindex="0" class="inline-flex">
|
||||||
size="sm"
|
<Button variant="ghost" size="sm" disabled>{{ control.label }}</Button>
|
||||||
disabled
|
</span>
|
||||||
:title="`${control.label} is unavailable`"
|
</TooltipTrigger>
|
||||||
>
|
<TooltipContent>{{ control.label }} is unavailable</TooltipContent>
|
||||||
{{ control.label }}
|
</Tooltip>
|
||||||
</Button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<span v-if="overflowControls.length" class="contents" @click.stop><MoreMenu label="More actions">
|
<span v-if="overflowControls.length" class="contents" @click.stop><MoreMenu label="More actions">
|
||||||
|
|||||||
Reference in new issue
Block a user