Inline error paragraphs become destructive Alerts, divided record lists become Item rows, the redirect URI box uses CodeView, and icon-button title hints use Tooltip. Native titles remain on truncated values and on disabled controls.
60 lines
3.2 KiB
Vue
60 lines
3.2 KiB
Vue
<script setup lang="ts">
|
||
import { Item, ItemGroup } from "@/components/ui/item";
|
||
import { Label } from "@/components/ui/label";
|
||
import { computed, ref, watch } from "vue";
|
||
import { Badge } from "@/components/ui/badge";
|
||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||
import { Checkbox } from "@/components/ui/checkbox";
|
||
import TaskRowActions from "./TaskRowActions.vue";
|
||
import type { Task } from "./task";
|
||
import { reviewGateOffer } from "./review-gate";
|
||
|
||
const props = defineProps<{ task: Task }>();
|
||
const emit = defineEmits<{ done: [taskId: Task["id"]] }>();
|
||
const gate = computed(() => props.task.status === "waiting_approval" ? reviewGateOffer(props.task.review_gate) : null);
|
||
const selected = ref<string[]>([]);
|
||
watch(() => props.task.review_gate, () => {
|
||
selected.value = gate.value?.findings.map((entry) => entry.key) ?? [];
|
||
}, { immediate: true });
|
||
</script>
|
||
|
||
<template>
|
||
<Card v-if="gate" class="mb-6">
|
||
<CardHeader>
|
||
<CardTitle>Review findings</CardTitle>
|
||
<p v-if="gate.head_sha" class="break-all font-mono text-xs text-fg-muted">Head commit: {{ gate.head_sha }}</p>
|
||
</CardHeader>
|
||
<CardContent class="space-y-4">
|
||
<ItemGroup>
|
||
<Item v-for="entry in gate.findings" :key="entry.key" as="li" variant="outline" class="block space-y-2 p-4">
|
||
<Label class="flex cursor-pointer items-start gap-3">
|
||
<Checkbox
|
||
:model-value="selected.includes(entry.key)"
|
||
:aria-label="entry.finding.Title"
|
||
class="mt-0.5"
|
||
@update:model-value="(on) => (selected = on === true ? [...selected, entry.key] : selected.filter((key) => key !== entry.key))"
|
||
/>
|
||
<span class="min-w-0 space-y-1">
|
||
<span class="block text-sm font-medium">{{ entry.finding.Title }}</span>
|
||
<span class="block break-all font-mono text-xs text-fg-muted">{{ entry.finding.File }}<template v-if="entry.finding.LineStart">:{{ entry.finding.LineStart }}<template v-if="entry.finding.LineEnd > entry.finding.LineStart">–{{ entry.finding.LineEnd }}</template></template></span>
|
||
</span>
|
||
</Label>
|
||
<div class="flex flex-wrap items-center gap-2 text-xs">
|
||
<Badge variant="outline">{{ entry.finding.Severity }}</Badge>
|
||
<Badge v-if="entry.finding.Blocking" variant="danger">Blocking</Badge>
|
||
<span>Score: {{ entry.finding.Score }}</span>
|
||
<span>Confidence: {{ entry.finding.Confidence }}</span>
|
||
</div>
|
||
<p class="whitespace-pre-wrap break-words text-sm">{{ entry.finding.Body }}</p>
|
||
<p v-if="entry.finding.Evidence" class="whitespace-pre-wrap break-words text-xs text-fg-muted">Evidence: {{ entry.finding.Evidence }}</p>
|
||
<pre v-if="entry.finding.Suggestion" class="overflow-x-auto rounded-md bg-secondary p-2 text-xs">{{ entry.finding.Suggestion }}</pre>
|
||
</Item>
|
||
</ItemGroup>
|
||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||
<p class="text-xs text-fg-muted">{{ selected.length }} of {{ gate.findings.length }} selected</p>
|
||
<TaskRowActions :task="task" :only="['approve', 'rereview', 'reject']" :findings="selected" @done="emit('done', $event)" />
|
||
</div>
|
||
</CardContent>
|
||
</Card>
|
||
</template>
|