chore(desktop): drop never-mounted components and unused ui kits
This commit is contained in:
36 files changed
-2568
No files matched your search
@@ -1,144 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { computed, ref } from "vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { AlertTriangle, Check, ChevronDown, ChevronRight, RefreshCw } from "@lucide/vue";
|
|
||||||
import type { DriftAlert } from "@/types/governance";
|
|
||||||
|
|
||||||
interface DriftSummary {
|
|
||||||
sourceEnv: string;
|
|
||||||
targetEnv: string;
|
|
||||||
driftCount: number;
|
|
||||||
lastDetectedAt: string;
|
|
||||||
hasUnacknowledged: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
drifts: DriftSummary[];
|
|
||||||
alerts: DriftAlert[];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
acknowledge: [alertId: string];
|
|
||||||
refresh: [];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const expandedKeys = ref<Set<string>>(new Set());
|
|
||||||
|
|
||||||
const totalDriftCount = computed(() => props.drifts.reduce((sum, d) => sum + d.driftCount, 0));
|
|
||||||
|
|
||||||
function toggleKey(key: string) {
|
|
||||||
const next = new Set(expandedKeys.value);
|
|
||||||
if (next.has(key)) {
|
|
||||||
next.delete(key);
|
|
||||||
} else {
|
|
||||||
next.add(key);
|
|
||||||
}
|
|
||||||
expandedKeys.value = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
function alertsForDrift(summary: DriftSummary): DriftAlert[] {
|
|
||||||
return props.alerts.filter((a) => a.sourceEnv === summary.sourceEnv && a.targetEnv === summary.targetEnv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDate(iso: string): string {
|
|
||||||
try {
|
|
||||||
return new Intl.DateTimeFormat(undefined, {
|
|
||||||
dateStyle: "medium",
|
|
||||||
timeStyle: "short",
|
|
||||||
}).format(new Date(iso));
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="rounded-md border bg-card">
|
|
||||||
<div class="flex items-center justify-between border-b px-4 py-3">
|
|
||||||
<h3 class="text-sm font-medium">{{ t("configDrift.title") }}</h3>
|
|
||||||
<Button size="sm" variant="ghost" class="h-7 gap-1 text-xs" @click="emit('refresh')">
|
|
||||||
<RefreshCw class="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="border-b px-4 py-2 text-xs">
|
|
||||||
<template v-if="totalDriftCount > 0">
|
|
||||||
<span class="text-muted-foreground">{{ t("configDrift.driftFound", { count: totalDriftCount }) }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<span class="text-muted-foreground">{{ t("configDrift.noDrift") }}</span>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="drifts.length > 0" class="overflow-x-auto">
|
|
||||||
<table class="w-full text-xs">
|
|
||||||
<thead>
|
|
||||||
<tr class="border-b bg-muted/30 text-muted-foreground">
|
|
||||||
<th class="px-4 py-2 text-left font-medium">{{ t("configDrift.sourceEnv") }}</th>
|
|
||||||
<th class="px-4 py-2 text-left font-medium">{{ t("configDrift.targetEnv") }}</th>
|
|
||||||
<th class="px-4 py-2 text-left font-medium">{{ t("configDrift.driftCount") }}</th>
|
|
||||||
<th class="px-4 py-2 text-left font-medium">{{ t("configDrift.lastDetected") }}</th>
|
|
||||||
<th class="px-4 py-2 text-left font-medium">{{ t("configDrift.configKey") }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<template v-for="drift in drifts" :key="`${drift.sourceEnv}-${drift.targetEnv}`">
|
|
||||||
<tr class="border-b last:border-b-0 hover:bg-accent/50">
|
|
||||||
<td class="px-4 py-2.5 font-medium">{{ drift.sourceEnv }}</td>
|
|
||||||
<td class="px-4 py-2.5">{{ drift.targetEnv }}</td>
|
|
||||||
<td class="px-4 py-2.5">{{ drift.driftCount }}</td>
|
|
||||||
<td class="px-4 py-2.5 text-muted-foreground">{{ formatDate(drift.lastDetectedAt) }}</td>
|
|
||||||
<td class="px-4 py-2.5">
|
|
||||||
<span v-if="!drift.hasUnacknowledged" class="text-green-600 dark:text-green-400">{{ t("configDrift.acknowledged") }}</span>
|
|
||||||
<Badge v-else variant="outline" class="text-xs">{{ t("configDrift.unacknowledged") }}</Badge>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr v-for="alert in alertsForDrift(drift)" :key="alert.id" class="border-b bg-muted/20">
|
|
||||||
<td colspan="5" class="px-4 py-1.5">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<button class="flex items-center gap-1.5 text-left text-xs" @click="toggleKey(alert.id)">
|
|
||||||
<ChevronRight v-if="!expandedKeys.has(alert.id)" class="h-3 w-3 shrink-0 text-muted-foreground" />
|
|
||||||
<ChevronDown v-else class="h-3 w-3 shrink-0 text-muted-foreground" />
|
|
||||||
<code class="rounded bg-muted px-1 py-0.5 font-mono text-xs">{{ alert.configKey }}</code>
|
|
||||||
<span v-if="alert.acknowledged" class="text-green-600 dark:text-green-400">{{ t("configDrift.acknowledged") }}</span>
|
|
||||||
</button>
|
|
||||||
<Button v-if="!alert.acknowledged" size="sm" variant="outline" class="h-7 gap-1 text-xs" @click="emit('acknowledge', alert.id)">
|
|
||||||
<Check class="h-3 w-3" />
|
|
||||||
{{ t("configDrift.acknowledge") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div v-if="expandedKeys.has(alert.id)" class="mt-2 space-y-1.5 pl-5">
|
|
||||||
<div class="grid grid-cols-2 gap-3 text-xs">
|
|
||||||
<div>
|
|
||||||
<span class="text-muted-foreground">{{ t("configDrift.checksum") }} (expected)</span>
|
|
||||||
<code class="ml-2 rounded bg-muted px-1 py-0.5 font-mono text-[10px]">{{ alert.expectedChecksum }}</code>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<span class="text-muted-foreground">{{ t("configDrift.checksum") }} (actual)</span>
|
|
||||||
<code class="ml-2 rounded bg-muted px-1 py-0.5 font-mono text-[10px]">{{ alert.actualChecksum }}</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="alert.detailsJson" class="text-xs">
|
|
||||||
<span class="text-muted-foreground">{{ t("configDrift.mismatchedFields") }}</span>
|
|
||||||
<pre class="mt-0.5 max-h-32 overflow-auto rounded bg-muted/50 p-2 font-mono text-[10px] whitespace-pre-wrap">{{ typeof alert.detailsJson === "string" ? alert.detailsJson : JSON.stringify(alert.detailsJson, null, 2) }}</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="drifts.length === 0" class="flex items-center justify-center px-4 py-10 text-xs text-muted-foreground">
|
|
||||||
<AlertTriangle class="mr-2 h-4 w-4" />
|
|
||||||
{{ t("configDrift.noDrift") }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Loader2 } from "@lucide/vue";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
lastReloadedAt: string | null;
|
|
||||||
reloadCount: number;
|
|
||||||
reloading: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
apply: [];
|
|
||||||
dismiss: [];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
function formatTimestamp(iso: string): string {
|
|
||||||
try {
|
|
||||||
return new Intl.DateTimeFormat(undefined, {
|
|
||||||
dateStyle: "medium",
|
|
||||||
timeStyle: "medium",
|
|
||||||
}).format(new Date(iso));
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="lastReloadedAt || reloadCount > 0" class="fixed bottom-4 right-4 z-50">
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger as-child>
|
|
||||||
<div class="flex items-center gap-2 rounded-lg border bg-card p-3 shadow-lg">
|
|
||||||
<Loader2 v-if="reloading" class="h-4 w-4 animate-spin text-muted-foreground" />
|
|
||||||
<span class="text-xs font-medium">{{ t("toolbar.configChanged") }}</span>
|
|
||||||
<Button size="sm" variant="default" class="h-6 text-xs px-2" @click="emit('apply')">
|
|
||||||
{{ t("toolbar.applyConfig") }}
|
|
||||||
</Button>
|
|
||||||
<Button size="sm" variant="ghost" class="h-6 text-xs px-2" @click="emit('dismiss')">
|
|
||||||
{{ t("toolbar.dismiss") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="top" class="text-xs">
|
|
||||||
{{ lastReloadedAt ? formatTimestamp(lastReloadedAt) : "" }}
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,686 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { computed, ref } from "vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Download, Edit3, FileJson, Lock, Plus, Search, Trash2, X } from "@lucide/vue";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import { Label } from "@/components/ui/label";
|
|
||||||
import { Switch } from "@/components/ui/switch";
|
|
||||||
import { Separator } from "@/components/ui/separator";
|
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
|
||||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
interface BusinessTag {
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
description: string;
|
|
||||||
immutable: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TagFilter {
|
|
||||||
search: string;
|
|
||||||
showExpired: boolean;
|
|
||||||
environment: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
tags: BusinessTag[];
|
|
||||||
whitelist: string[];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
save: [tag: BusinessTag];
|
|
||||||
delete: [key: string];
|
|
||||||
import: [tags: BusinessTag[]];
|
|
||||||
updateWhitelist: [keys: string[]];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const filter = ref<TagFilter>({
|
|
||||||
search: "",
|
|
||||||
showExpired: false,
|
|
||||||
environment: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const showAddDialog = ref(false);
|
|
||||||
const showImportDialog = ref(false);
|
|
||||||
const showWhitelistSection = ref(false);
|
|
||||||
const editingTag = ref<BusinessTag | null>(null);
|
|
||||||
const confirmDeleteKey = ref<string | null>(null);
|
|
||||||
const importData = ref("");
|
|
||||||
const importPreview = ref<BusinessTag[]>([]);
|
|
||||||
const whitelistInput = ref("");
|
|
||||||
|
|
||||||
const environments = ["", "development", "staging", "production"];
|
|
||||||
// reka-ui Select throws on SelectItem value="" (and the leftover dismissable
|
|
||||||
// layer then blocks all clicks), so "all environments" uses a sentinel value.
|
|
||||||
const ALL_ENVIRONMENTS = "__all__";
|
|
||||||
|
|
||||||
const filteredTags = computed(() => {
|
|
||||||
return props.tags.filter((tag) => {
|
|
||||||
if (filter.value.search) {
|
|
||||||
const q = filter.value.search.toLowerCase();
|
|
||||||
if (!tag.key.toLowerCase().includes(q) && !tag.value.toLowerCase().includes(q) && !tag.description.toLowerCase().includes(q)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function resetEditingTag() {
|
|
||||||
editingTag.value = { key: "", value: "", description: "", immutable: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
function openAddDialog() {
|
|
||||||
resetEditingTag();
|
|
||||||
showAddDialog.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function openEditDialog(tag: BusinessTag) {
|
|
||||||
editingTag.value = { ...tag };
|
|
||||||
showAddDialog.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSave() {
|
|
||||||
if (!editingTag.value) return;
|
|
||||||
emit("save", { ...editingTag.value });
|
|
||||||
showAddDialog.value = false;
|
|
||||||
editingTag.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDelete(key: string) {
|
|
||||||
emit("delete", key);
|
|
||||||
confirmDeleteKey.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseImport() {
|
|
||||||
try {
|
|
||||||
const parsed: BusinessTag[] = JSON.parse(importData.value);
|
|
||||||
importPreview.value = parsed.filter((item): item is BusinessTag => typeof item.key === "string" && typeof item.value === "string" && typeof item.description === "string" && typeof item.immutable === "boolean");
|
|
||||||
} catch {
|
|
||||||
const lines = importData.value.split("\n").filter(Boolean);
|
|
||||||
const parsed: BusinessTag[] = lines.map((line) => {
|
|
||||||
const parts = line.split(",");
|
|
||||||
return {
|
|
||||||
key: parts[0]?.trim() ?? "",
|
|
||||||
value: parts[1]?.trim() ?? "",
|
|
||||||
description: parts[2]?.trim() ?? "",
|
|
||||||
immutable: parts[3]?.trim() === "true",
|
|
||||||
};
|
|
||||||
});
|
|
||||||
importPreview.value = parsed.filter((item) => item.key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleImport() {
|
|
||||||
if (importPreview.value.length === 0) return;
|
|
||||||
emit("import", importPreview.value);
|
|
||||||
importPreview.value = [];
|
|
||||||
importData.value = "";
|
|
||||||
showImportDialog.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addWhitelistKey() {
|
|
||||||
const key = whitelistInput.value.trim();
|
|
||||||
if (!key || props.whitelist.includes(key)) return;
|
|
||||||
emit("updateWhitelist", [...props.whitelist, key]);
|
|
||||||
whitelistInput.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeWhitelistKey(key: string) {
|
|
||||||
emit(
|
|
||||||
"updateWhitelist",
|
|
||||||
props.whitelist.filter((k) => k !== key),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleExport() {
|
|
||||||
const blob = new Blob([JSON.stringify(props.tags, null, 2)], {
|
|
||||||
type: "application/json",
|
|
||||||
});
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement("a");
|
|
||||||
a.href = url;
|
|
||||||
a.download = "tags.json";
|
|
||||||
a.click();
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="tag-management-panel">
|
|
||||||
<div class="panel-header">
|
|
||||||
<h2 class="panel-title">{{ t("tag.management") }}</h2>
|
|
||||||
<div class="panel-actions">
|
|
||||||
<Button variant="outline" size="sm" @click="showImportDialog = true">
|
|
||||||
<FileJson class="h-4 w-4" />
|
|
||||||
{{ t("tag.importTags") }}
|
|
||||||
</Button>
|
|
||||||
<Button variant="outline" size="sm" @click="handleExport">
|
|
||||||
<Download class="h-4 w-4" />
|
|
||||||
{{ t("tag.exportTags") }}
|
|
||||||
</Button>
|
|
||||||
<Button size="sm" @click="openAddDialog">
|
|
||||||
<Plus class="h-4 w-4" />
|
|
||||||
{{ t("common.add") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="filter-bar">
|
|
||||||
<div class="search-wrapper">
|
|
||||||
<Search class="search-icon" />
|
|
||||||
<Input v-model="filter.search" :placeholder="t('common.search')" />
|
|
||||||
</div>
|
|
||||||
<div class="filter-controls">
|
|
||||||
<!-- reka-ui throws on SelectItem value="" and the leftover dismissable
|
|
||||||
layer then blocks every click, so the "all" entry uses a sentinel. -->
|
|
||||||
<Select :model-value="filter.environment || ALL_ENVIRONMENTS" @update:model-value="(value: any) => (filter.environment = value === ALL_ENVIRONMENTS ? '' : String(value))">
|
|
||||||
<SelectTrigger class="w-[160px]">
|
|
||||||
<SelectValue :placeholder="t('tag.environment')" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem :value="ALL_ENVIRONMENTS">
|
|
||||||
{{ t("common.all") }}
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem v-for="env in environments.filter(Boolean)" :key="env" :value="env">
|
|
||||||
{{ env }}
|
|
||||||
</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<label class="expired-toggle">
|
|
||||||
<Switch v-model="filter.showExpired" size="sm" />
|
|
||||||
<span>{{ t("tag.expired") }}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-container">
|
|
||||||
<table class="tag-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{{ t("tag.key") }}</th>
|
|
||||||
<th>{{ t("tag.value") }}</th>
|
|
||||||
<th>{{ t("tag.description") }}</th>
|
|
||||||
<th>{{ t("tag.immutable") }}</th>
|
|
||||||
<th class="actions-cell">{{ t("common.actions") }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-if="filteredTags.length === 0">
|
|
||||||
<td colspan="5" class="empty-state">
|
|
||||||
{{ t("tag.noTags") }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-for="tag in filteredTags" :key="tag.key">
|
|
||||||
<td class="cell-key">{{ tag.key }}</td>
|
|
||||||
<td>{{ tag.value }}</td>
|
|
||||||
<td class="cell-desc">{{ tag.description }}</td>
|
|
||||||
<td>
|
|
||||||
<Badge v-if="tag.immutable" variant="secondary" class="immutable-badge">
|
|
||||||
<Lock class="h-3 w-3" />
|
|
||||||
{{ t("tag.immutable") }}
|
|
||||||
</Badge>
|
|
||||||
<span v-else class="text-muted-foreground text-xs">—</span>
|
|
||||||
</td>
|
|
||||||
<td class="actions-cell">
|
|
||||||
<div class="row-actions">
|
|
||||||
<Button variant="ghost" size="icon-sm" @click="openEditDialog(tag)">
|
|
||||||
<Edit3 class="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
<Button variant="ghost" size="icon-sm" :disabled="tag.immutable" @click="confirmDeleteKey = tag.key">
|
|
||||||
<Trash2 class="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Separator class="my-2" />
|
|
||||||
|
|
||||||
<div class="whitelist-section">
|
|
||||||
<button class="whitelist-toggle" @click="showWhitelistSection = !showWhitelistSection">
|
|
||||||
<span>{{ t("tag.whitelist") }}</span>
|
|
||||||
<span class="whitelist-count">{{ props.whitelist.length }}</span>
|
|
||||||
<svg :class="cn('chevron', showWhitelistSection && 'open')" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
||||||
<polyline points="9 18 15 12 9 6" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<div v-if="showWhitelistSection" class="whitelist-content">
|
|
||||||
<div class="whitelist-chips">
|
|
||||||
<span v-for="key in props.whitelist" :key="key" class="whitelist-chip">
|
|
||||||
{{ key }}
|
|
||||||
<button class="chip-remove" @click="removeWhitelistKey(key)">
|
|
||||||
<X class="h-3 w-3" />
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="whitelist-add-row">
|
|
||||||
<Input v-model="whitelistInput" :placeholder="t('tag.key')" @keydown.enter="addWhitelistKey" />
|
|
||||||
<Button variant="outline" size="sm" @click="addWhitelistKey">
|
|
||||||
{{ t("common.add") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Dialog v-model:open="showAddDialog">
|
|
||||||
<DialogContent class="sm:max-w-[500px]">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>
|
|
||||||
{{ editingTag?.key && !editingTag?.key.startsWith("_new") ? t("common.edit") : t("common.add") }}
|
|
||||||
{{ t("tag.management") }}
|
|
||||||
</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
<div class="grid gap-4 py-4">
|
|
||||||
<div class="form-field">
|
|
||||||
<Label>{{ t("tag.key") }}</Label>
|
|
||||||
<Input v-model="editingTag!.key" />
|
|
||||||
</div>
|
|
||||||
<div class="form-field">
|
|
||||||
<Label>{{ t("tag.value") }}</Label>
|
|
||||||
<Input v-model="editingTag!.value" />
|
|
||||||
</div>
|
|
||||||
<div class="form-field">
|
|
||||||
<Label>{{ t("tag.description") }}</Label>
|
|
||||||
<textarea v-model="editingTag!.description" class="desc-textarea" rows="3" />
|
|
||||||
</div>
|
|
||||||
<label class="immutable-field">
|
|
||||||
<Switch v-model="editingTag!.immutable" size="sm" />
|
|
||||||
<span>{{ t("tag.immutable") }}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" @click="showAddDialog = false">
|
|
||||||
{{ t("common.cancel") }}
|
|
||||||
</Button>
|
|
||||||
<Button @click="handleSave">
|
|
||||||
{{ t("common.save") }}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog v-model:open="showImportDialog">
|
|
||||||
<DialogContent class="sm:max-w-[600px]">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>
|
|
||||||
{{ t("tag.batchImport") }}
|
|
||||||
</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
<div class="grid gap-4 py-4">
|
|
||||||
<textarea v-model="importData" class="import-textarea" rows="6" :placeholder="t('tag.batchImport')" />
|
|
||||||
<div v-if="importPreview.length > 0" class="import-preview">
|
|
||||||
<p class="preview-count">{{ importPreview.length }} {{ t("common.rows") }}</p>
|
|
||||||
<table class="preview-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{{ t("tag.key") }}</th>
|
|
||||||
<th>{{ t("tag.value") }}</th>
|
|
||||||
<th>{{ t("tag.description") }}</th>
|
|
||||||
<th>{{ t("tag.immutable") }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="(item, idx) in importPreview.slice(0, 10)" :key="idx">
|
|
||||||
<td>{{ item.key }}</td>
|
|
||||||
<td>{{ item.value }}</td>
|
|
||||||
<td>{{ item.description }}</td>
|
|
||||||
<td>{{ item.immutable }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" @click="showImportDialog = false">
|
|
||||||
{{ t("common.cancel") }}
|
|
||||||
</Button>
|
|
||||||
<Button variant="secondary" :disabled="!importData" @click="parseImport">
|
|
||||||
{{ t("common.parse") }}
|
|
||||||
</Button>
|
|
||||||
<Button :disabled="importPreview.length === 0" @click="handleImport">
|
|
||||||
{{ t("common.import") }}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog
|
|
||||||
v-model:open="confirmDeleteKey !== null"
|
|
||||||
@update:open="
|
|
||||||
(v) => {
|
|
||||||
if (!v) confirmDeleteKey = null;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<DialogContent class="sm:max-w-[400px]">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>
|
|
||||||
{{ t("common.confirm") }}
|
|
||||||
</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
<p class="py-4 text-sm">
|
|
||||||
{{ t("tag.confirmDelete", { key: confirmDeleteKey }) }}
|
|
||||||
</p>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button variant="outline" @click="confirmDeleteKey = null">
|
|
||||||
{{ t("common.cancel") }}
|
|
||||||
</Button>
|
|
||||||
<Button variant="destructive" @click="confirmDeleteKey && handleDelete(confirmDeleteKey)">
|
|
||||||
{{ t("common.delete") }}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.tag-management-panel {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-title {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-bar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-wrapper {
|
|
||||||
position: relative;
|
|
||||||
flex: 1;
|
|
||||||
min-width: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-icon {
|
|
||||||
position: absolute;
|
|
||||||
left: 8px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-wrapper :deep(input) {
|
|
||||||
padding-left: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-controls {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.expired-toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-size: 13px;
|
|
||||||
cursor: pointer;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-container {
|
|
||||||
overflow-x: auto;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-table th {
|
|
||||||
text-align: left;
|
|
||||||
padding: 10px 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-table td {
|
|
||||||
padding: 10px 12px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-table tr:last-child td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-table tbody tr:hover {
|
|
||||||
background: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-state {
|
|
||||||
text-align: center;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
padding: 32px 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cell-key {
|
|
||||||
font-family: var(--font-mono, monospace);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cell-desc {
|
|
||||||
max-width: 240px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions-cell {
|
|
||||||
width: 100px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.immutable-badge {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
padding: 4px 0;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-count {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chevron {
|
|
||||||
transition: transform 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chevron.open {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-chips {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-chip {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
padding: 2px 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-remove {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
}
|
|
||||||
|
|
||||||
.whitelist-add-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-field {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desc-textarea {
|
|
||||||
width: 100%;
|
|
||||||
padding: 8px 10px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
font-size: 13px;
|
|
||||||
font-family: inherit;
|
|
||||||
resize: vertical;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desc-textarea:focus {
|
|
||||||
border-color: var(--ring);
|
|
||||||
box-shadow: 0 0 0 2px var(--ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
.immutable-field {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-size: 13px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import-textarea {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
font-size: 12px;
|
|
||||||
font-family: var(--font-mono, monospace);
|
|
||||||
resize: vertical;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import-textarea:focus {
|
|
||||||
border-color: var(--ring);
|
|
||||||
box-shadow: 0 0 0 2px var(--ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
.import-preview {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-count {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-table th {
|
|
||||||
text-align: left;
|
|
||||||
padding: 6px 8px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-table td {
|
|
||||||
padding: 6px 8px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { CheckCircle2, XCircle, GitMerge } from "@lucide/vue";
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
interface ConflictItem {
|
|
||||||
objectName: string;
|
|
||||||
conflictType: string;
|
|
||||||
sourceValue: string;
|
|
||||||
targetValue: string;
|
|
||||||
autoResolvable: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
conflicts: ConflictItem[];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
resolveWithSource: [objectName: string];
|
|
||||||
resolveWithTarget: [objectName: string];
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="border rounded-md bg-card">
|
|
||||||
<div class="flex items-center gap-2 px-3 py-2 border-b">
|
|
||||||
<GitMerge class="w-4 h-4 text-primary" />
|
|
||||||
<h3 class="text-sm font-medium">{{ t("conflictMatrix.title") }}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="conflicts.length === 0" class="flex items-center justify-center py-8 text-sm text-muted-foreground">
|
|
||||||
{{ t("conflictMatrix.noConflicts") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else class="p-3">
|
|
||||||
<div class="border rounded overflow-hidden">
|
|
||||||
<table class="w-full text-xs">
|
|
||||||
<thead>
|
|
||||||
<tr class="bg-muted/30">
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("conflictMatrix.objectName") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("conflictMatrix.conflictType") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("conflictMatrix.sourceValue") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("conflictMatrix.targetValue") }}</th>
|
|
||||||
<th class="text-center px-2 py-1.5 font-medium text-muted-foreground">{{ t("conflictMatrix.autoResolvable") }}</th>
|
|
||||||
<th class="text-right px-2 py-1.5 font-medium text-muted-foreground">{{ t("common.actions") }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="c in conflicts" :key="c.objectName" class="border-t" :class="c.autoResolvable ? 'bg-emerald-500/5' : 'bg-red-500/5'">
|
|
||||||
<td class="px-2 py-1.5 font-mono">{{ c.objectName }}</td>
|
|
||||||
<td class="px-2 py-1.5">{{ c.conflictType }}</td>
|
|
||||||
<td class="px-2 py-1.5 font-mono max-w-[200px] truncate" :title="c.sourceValue">{{ c.sourceValue }}</td>
|
|
||||||
<td class="px-2 py-1.5 font-mono max-w-[200px] truncate" :title="c.targetValue">{{ c.targetValue }}</td>
|
|
||||||
<td class="px-2 py-1.5 text-center">
|
|
||||||
<CheckCircle2 v-if="c.autoResolvable" class="w-4 h-4 text-green-500 inline-block" />
|
|
||||||
<XCircle v-else class="w-4 h-4 text-red-500 inline-block" />
|
|
||||||
</td>
|
|
||||||
<td class="px-2 py-1.5 text-right">
|
|
||||||
<div v-if="!c.autoResolvable" class="flex items-center justify-end gap-1">
|
|
||||||
<button class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/10 text-primary hover:bg-primary/20 transition-colors" @click="emit('resolveWithSource', c.objectName)">
|
|
||||||
{{ t("conflictMatrix.resolveWithSource") }}
|
|
||||||
</button>
|
|
||||||
<button class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted/40 text-muted-foreground hover:bg-muted/60 transition-colors" @click="emit('resolveWithTarget', c.objectName)">
|
|
||||||
{{ t("conflictMatrix.resolveWithTarget") }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<span v-else class="text-[10px] text-green-600 dark:text-green-400 font-medium">
|
|
||||||
{{ t("conflictMatrix.resolved") }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { AlertTriangle, CheckCircle, Clock, Hourglass, Loader2, XCircle } from "@lucide/vue";
|
|
||||||
|
|
||||||
type OscExecutionStatus = "preparing" | "copying" | "cut_over" | "completed" | "failed" | "postponed";
|
|
||||||
|
|
||||||
interface OscOperation {
|
|
||||||
toolType: "gh-ost" | "pt-osc";
|
|
||||||
tableName: string;
|
|
||||||
status: OscExecutionStatus;
|
|
||||||
progressPercent: number;
|
|
||||||
estimatedRemainingSecs?: number;
|
|
||||||
error?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
operations: OscOperation[];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const statusConfig: Record<OscExecutionStatus, { labelKey: string; icon: any; badgeClass: string; barClass: string }> = {
|
|
||||||
preparing: {
|
|
||||||
labelKey: "osc.preparing",
|
|
||||||
icon: Hourglass,
|
|
||||||
badgeClass: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
||||||
barClass: "bg-yellow-500",
|
|
||||||
},
|
|
||||||
copying: {
|
|
||||||
labelKey: "osc.copying",
|
|
||||||
icon: Loader2,
|
|
||||||
badgeClass: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",
|
|
||||||
barClass: "bg-blue-500",
|
|
||||||
},
|
|
||||||
cut_over: {
|
|
||||||
labelKey: "osc.cutOver",
|
|
||||||
icon: Clock,
|
|
||||||
badgeClass: "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",
|
|
||||||
barClass: "bg-purple-500",
|
|
||||||
},
|
|
||||||
completed: {
|
|
||||||
labelKey: "osc.completed",
|
|
||||||
icon: CheckCircle,
|
|
||||||
badgeClass: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
||||||
barClass: "bg-green-500",
|
|
||||||
},
|
|
||||||
failed: {
|
|
||||||
labelKey: "osc.failed",
|
|
||||||
icon: XCircle,
|
|
||||||
badgeClass: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
|
||||||
barClass: "bg-red-500",
|
|
||||||
},
|
|
||||||
postponed: {
|
|
||||||
labelKey: "osc.postponed",
|
|
||||||
icon: AlertTriangle,
|
|
||||||
badgeClass: "bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",
|
|
||||||
barClass: "bg-orange-500",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function formatRemaining(seconds?: number): string {
|
|
||||||
if (seconds == null) return "-";
|
|
||||||
if (seconds < 60) return `${seconds}s`;
|
|
||||||
if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
||||||
const h = Math.floor(seconds / 3600);
|
|
||||||
const m = Math.floor((seconds % 3600) / 60);
|
|
||||||
return `${h}h ${m}m`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const toolTypeLabelKey: Record<string, string> = {
|
|
||||||
"gh-ost": "osc.ghost",
|
|
||||||
"pt-osc": "osc.ptosc",
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="rounded-md border bg-card">
|
|
||||||
<div class="border-b px-4 py-3">
|
|
||||||
<h3 class="text-sm font-medium">{{ t("osc.title") }}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="operations.length === 0" class="flex items-center justify-center px-4 py-12 text-xs text-muted-foreground">
|
|
||||||
{{ t("osc.noActiveOsc") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else class="divide-y">
|
|
||||||
<div v-for="op in operations" :key="`${op.toolType}-${op.tableName}`" class="px-4 py-3">
|
|
||||||
<div class="mb-2 flex items-center justify-between">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<component :is="statusConfig[op.status].icon" class="h-4 w-4" :class="{ 'animate-spin': op.status === 'copying' }" />
|
|
||||||
<span class="text-xs font-medium">{{ op.tableName }}</span>
|
|
||||||
<Badge variant="outline" class="text-[10px]">{{ t(toolTypeLabelKey[op.toolType] || op.toolType) }}</Badge>
|
|
||||||
</div>
|
|
||||||
<span class="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium" :class="statusConfig[op.status].badgeClass">
|
|
||||||
<component :is="statusConfig[op.status].icon" class="h-3 w-3" />
|
|
||||||
{{ t(statusConfig[op.status].labelKey) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-1.5 flex items-center gap-3">
|
|
||||||
<div class="h-2 flex-1 overflow-hidden rounded-full bg-muted">
|
|
||||||
<div class="h-full rounded-full transition-all duration-500" :class="statusConfig[op.status].barClass" :style="{ width: `${Math.min(op.progressPercent, 100)}%` }" />
|
|
||||||
</div>
|
|
||||||
<span class="w-10 text-right text-[10px] tabular-nums text-muted-foreground">{{ Math.min(op.progressPercent, 100) }}%</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between text-[10px] text-muted-foreground">
|
|
||||||
<div class="flex items-center gap-1">
|
|
||||||
<Clock class="h-3 w-3" />
|
|
||||||
<span>{{ t("osc.estimatedRemaining") }}: {{ formatRemaining(op.estimatedRemainingSecs) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="op.status === 'failed' && op.error" class="mt-2 rounded-md bg-destructive/10 px-2.5 py-1.5 text-[10px] text-destructive">
|
|
||||||
<div class="flex items-start gap-1.5">
|
|
||||||
<AlertTriangle class="mt-0.5 h-3 w-3 shrink-0" />
|
|
||||||
<span>{{ op.error }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { AlertTriangle, Check, Clock, Layers, SkipForward } from "@lucide/vue";
|
|
||||||
|
|
||||||
interface ConflictItem {
|
|
||||||
objectName: string;
|
|
||||||
conflictType: string;
|
|
||||||
sourceValue: string;
|
|
||||||
targetValue: string;
|
|
||||||
autoResolvable: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RebaseInfo {
|
|
||||||
id: string;
|
|
||||||
baselineId: string;
|
|
||||||
totalObjects: number;
|
|
||||||
autoResolvedCount: number;
|
|
||||||
conflictCount: number;
|
|
||||||
conflicts: ConflictItem[];
|
|
||||||
createdAt: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
rebaseInfo: RebaseInfo | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
overwriteBaseline: [];
|
|
||||||
skipObject: [objectName: string];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
function formatDate(iso: string): string {
|
|
||||||
try {
|
|
||||||
return new Intl.DateTimeFormat(undefined, {
|
|
||||||
dateStyle: "medium",
|
|
||||||
timeStyle: "short",
|
|
||||||
}).format(new Date(iso));
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="rounded-md border bg-card">
|
|
||||||
<div class="border-b px-4 py-3">
|
|
||||||
<h3 class="text-sm font-medium">{{ t("rebase.title") }}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="!rebaseInfo" class="flex items-center justify-center px-4 py-12 text-xs text-muted-foreground">
|
|
||||||
{{ t("rebase.notes") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="grid grid-cols-4 gap-4 border-b px-4 py-3">
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-xs text-muted-foreground">{{ t("rebase.objectCount") }}</div>
|
|
||||||
<div class="text-sm font-medium">{{ rebaseInfo.totalObjects }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-xs text-muted-foreground">{{ t("rebase.autoResolved") }}</div>
|
|
||||||
<div class="text-sm font-medium text-green-600 dark:text-green-400">{{ rebaseInfo.autoResolvedCount }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-xs text-muted-foreground">{{ t("rebase.conflictCount") }}</div>
|
|
||||||
<div class="text-sm font-medium" :class="rebaseInfo.conflictCount > 0 ? 'text-destructive' : ''">{{ rebaseInfo.conflictCount }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-1">
|
|
||||||
<div class="text-xs text-muted-foreground">{{ t("rebase.notes") }}</div>
|
|
||||||
<div class="flex items-center gap-1.5 text-xs text-muted-foreground">
|
|
||||||
<Clock class="h-3 w-3" />
|
|
||||||
{{ formatDate(rebaseInfo.createdAt) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="border-b px-4 py-3">
|
|
||||||
<div class="mb-2 flex items-center gap-2">
|
|
||||||
<Layers class="h-4 w-4 text-muted-foreground" />
|
|
||||||
<span class="text-xs font-medium text-muted-foreground">{{ t("rebase.driftReport") }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-cols-2 gap-x-6 gap-y-2 text-xs">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<span class="text-muted-foreground">{{ t("rebase.currentBaseline") }}</span>
|
|
||||||
<code class="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">{{ rebaseInfo.baselineId }}</code>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<span class="text-muted-foreground">{{ t("rebase.newBaseline") }}</span>
|
|
||||||
<code class="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">{{ rebaseInfo.id }}</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="rebaseInfo.conflicts.length > 0" class="border-b px-4 py-3">
|
|
||||||
<div class="mb-2 flex items-center gap-2">
|
|
||||||
<AlertTriangle class="h-4 w-4 text-amber-500" />
|
|
||||||
<span class="text-xs font-medium text-muted-foreground">{{ t("rebase.conflicts") }}</span>
|
|
||||||
<Badge variant="destructive" class="ml-auto text-xs">{{ rebaseInfo.conflictCount }}</Badge>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-2">
|
|
||||||
<div v-for="(conflict, index) in rebaseInfo.conflicts" :key="conflict.objectName" class="rounded-md border px-3 py-2 text-xs">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<div class="flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium" :class="conflict.autoResolvable ? 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400' : 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400'">
|
|
||||||
{{ index + 1 }}
|
|
||||||
</div>
|
|
||||||
<span class="font-medium">{{ conflict.objectName }}</span>
|
|
||||||
<Badge variant="outline" class="text-[10px]">{{ conflict.conflictType }}</Badge>
|
|
||||||
<Badge v-if="conflict.autoResolvable" variant="secondary" class="text-[10px]"> auto </Badge>
|
|
||||||
</div>
|
|
||||||
<Button size="sm" variant="ghost" class="h-7 gap-1 text-xs" @click="emit('skipObject', conflict.objectName)">
|
|
||||||
<SkipForward class="h-3 w-3" />
|
|
||||||
{{ t("rebase.skipObject") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div class="mt-1.5 grid grid-cols-2 gap-3">
|
|
||||||
<div>
|
|
||||||
<div class="text-[10px] text-muted-foreground">Source</div>
|
|
||||||
<code class="mt-0.5 block truncate rounded bg-muted/50 px-1 py-0.5 font-mono">{{ conflict.sourceValue }}</code>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="text-[10px] text-muted-foreground">Target</div>
|
|
||||||
<code class="mt-0.5 block truncate rounded bg-muted/50 px-1 py-0.5 font-mono">{{ conflict.targetValue }}</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-end gap-2 px-4 py-3">
|
|
||||||
<Button size="sm" class="gap-1.5 text-xs" @click="emit('overwriteBaseline')">
|
|
||||||
<Check class="h-3.5 w-3.5" />
|
|
||||||
{{ t("rebase.overwriteBaseline") }}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { AlertTriangle, ShieldAlert } from "@lucide/vue";
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
interface TagViolation {
|
|
||||||
fileName: string;
|
|
||||||
lineNumber: number;
|
|
||||||
tagName: string;
|
|
||||||
suggestion: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
violations: TagViolation[];
|
|
||||||
blocking: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
registerTag: [tagName: string];
|
|
||||||
removeTag: [tagName: string];
|
|
||||||
ignore: [tagName: string];
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="border rounded-md bg-card">
|
|
||||||
<div class="flex items-center gap-2 px-3 py-2 border-b">
|
|
||||||
<ShieldAlert class="w-4 h-4 text-amber-500" />
|
|
||||||
<h3 class="text-sm font-medium">{{ t("strictTag.title") }}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="blocking" class="mx-3 mt-3 flex items-center gap-2 px-3 py-2 rounded text-xs font-medium bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300 border border-red-200 dark:border-red-900/30">
|
|
||||||
<AlertTriangle class="w-3.5 h-3.5 shrink-0" />
|
|
||||||
<span>{{ t("strictTag.blockingExecution") }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="violations.length === 0" class="flex items-center justify-center py-8 text-sm text-muted-foreground">
|
|
||||||
{{ t("strictTag.noViolations") }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="px-3 pt-3 pb-1 text-xs text-muted-foreground">
|
|
||||||
{{ t("strictTag.violationsFound", { count: violations.length }) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="p-3">
|
|
||||||
<div class="border rounded overflow-hidden">
|
|
||||||
<table class="w-full text-xs">
|
|
||||||
<thead>
|
|
||||||
<tr class="bg-muted/30">
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("strictTag.fileName") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("strictTag.lineNumber") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("strictTag.tagName") }}</th>
|
|
||||||
<th class="text-left px-2 py-1.5 font-medium text-muted-foreground">{{ t("strictTag.suggestion") }}</th>
|
|
||||||
<th class="text-right px-2 py-1.5 font-medium text-muted-foreground">{{ t("common.actions") }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="v in violations" :key="`${v.fileName}:${v.lineNumber}:${v.tagName}`" class="border-t">
|
|
||||||
<td class="px-2 py-1.5 font-mono">{{ v.fileName }}</td>
|
|
||||||
<td class="px-2 py-1.5">{{ v.lineNumber }}</td>
|
|
||||||
<td class="px-2 py-1.5 font-mono">{{ v.tagName }}</td>
|
|
||||||
<td class="px-2 py-1.5 text-muted-foreground">{{ v.suggestion }}</td>
|
|
||||||
<td class="px-2 py-1.5 text-right">
|
|
||||||
<div class="flex items-center justify-end gap-1">
|
|
||||||
<button class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/10 text-primary hover:bg-primary/20 transition-colors" @click="emit('registerTag', v.tagName)">
|
|
||||||
{{ t("strictTag.registerTag") }}
|
|
||||||
</button>
|
|
||||||
<button class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-destructive/10 text-destructive hover:bg-destructive/20 transition-colors" @click="emit('removeTag', v.tagName)">
|
|
||||||
{{ t("strictTag.removeTag") }}
|
|
||||||
</button>
|
|
||||||
<button class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted/40 text-muted-foreground hover:bg-muted/60 transition-colors" @click="emit('ignore', v.tagName)">
|
|
||||||
{{ t("strictTag.ignore") }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { ChevronDown, ChevronRight } from "@lucide/vue";
|
|
||||||
import { computed, ref } from "vue";
|
|
||||||
|
|
||||||
defineOptions({ name: "JsonValueTable" });
|
|
||||||
|
|
||||||
const props = defineProps<{ value: unknown }>();
|
|
||||||
const expanded = ref(true);
|
|
||||||
|
|
||||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
||||||
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isContainer = computed(() => isRecord(props.value) || Array.isArray(props.value));
|
|
||||||
const containerLabel = computed(() => (Array.isArray(props.value) ? `Array (${props.value.length})` : `Object (${Object.keys(props.value as Record<string, unknown>).length})`));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="isContainer" class="json-value-container">
|
|
||||||
<button type="button" class="json-value-toggle" :aria-expanded="expanded" @click="expanded = !expanded">
|
|
||||||
<ChevronDown v-if="expanded" class="h-3.5 w-3.5" />
|
|
||||||
<ChevronRight v-else class="h-3.5 w-3.5" />
|
|
||||||
<span>{{ containerLabel }}</span>
|
|
||||||
</button>
|
|
||||||
<table v-show="expanded && isRecord(value)" class="json-value-table">
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="(item, key) in value as Record<string, unknown>" :key="key">
|
|
||||||
<th>{{ key }}</th>
|
|
||||||
<td><JsonValueTable :value="item" /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table v-show="expanded && Array.isArray(value)" class="json-value-table">
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="(item, index) in value as unknown[]" :key="index">
|
|
||||||
<th>{{ index }}</th>
|
|
||||||
<td><JsonValueTable :value="item" /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<span v-else class="break-words">{{ value === null ? "null" : String(value) }}</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.json-value-table {
|
|
||||||
width: auto;
|
|
||||||
max-width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
font-family: var(--dbx-editor-font-family);
|
|
||||||
font-size: 0.75rem;
|
|
||||||
}
|
|
||||||
.json-value-table th,
|
|
||||||
.json-value-table td {
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
padding: 0.35rem 0.5rem;
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
.json-value-table th {
|
|
||||||
width: 1%;
|
|
||||||
max-width: 20rem;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
font-weight: 500;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.json-value-table td {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
.json-value-toggle {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.25rem;
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.25rem 0.4rem;
|
|
||||||
color: var(--muted-foreground);
|
|
||||||
font-size: 0.7rem;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.json-value-toggle:hover {
|
|
||||||
background: var(--accent);
|
|
||||||
color: var(--foreground);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,472 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { computed, nextTick, ref, useId, watch } from "vue";
|
|
||||||
import { AlertTriangle, ChevronLeft, ChevronRight, Minus, Plus, Search } from "@lucide/vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import TruncatedTextTooltip from "@/components/ui/TruncatedTextTooltip.vue";
|
|
||||||
import { groupMcpScopeConnections, matchesMcpSearchQuery, updateMcpAllowedConnectionIds } from "@/lib/mcp/mcpPolicySelection";
|
|
||||||
import type { ConnectionConfig } from "@/types/database";
|
|
||||||
|
|
||||||
type ScopePane = "available" | "allowed";
|
|
||||||
type ScopeMode = "all" | "selected";
|
|
||||||
|
|
||||||
const PAGE_SIZE_OPTIONS = [6, 10, 20] as const;
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
connections: readonly ConnectionConfig[];
|
|
||||||
allowedConnectionIds: readonly string[] | null;
|
|
||||||
disabled?: boolean;
|
|
||||||
busy?: boolean;
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
disabled: false,
|
|
||||||
busy: false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
"update:allowedConnectionIds": [value: string[] | null];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const pickerId = useId();
|
|
||||||
const rootRef = ref<HTMLElement>();
|
|
||||||
const searchQuery = ref("");
|
|
||||||
const compactPane = ref<ScopePane>("allowed");
|
|
||||||
const availablePage = ref(1);
|
|
||||||
const allowedPage = ref(1);
|
|
||||||
const connectionsPerPage = ref<number>(PAGE_SIZE_OPTIONS[0]);
|
|
||||||
const announcement = ref("");
|
|
||||||
const pendingFocus = ref<{ pane: ScopePane; index: number } | null>(null);
|
|
||||||
|
|
||||||
const connectionIds = computed(() => props.connections.map((connection) => connection.id));
|
|
||||||
const groups = computed(() => groupMcpScopeConnections(props.connections, props.allowedConnectionIds));
|
|
||||||
const scopeMode = computed<ScopeMode>(() => (props.allowedConnectionIds === null ? "all" : "selected"));
|
|
||||||
const searchActive = computed(() => searchQuery.value.trim().length > 0);
|
|
||||||
|
|
||||||
function connectionMatchesSearch(connection: ConnectionConfig): boolean {
|
|
||||||
return matchesMcpSearchQuery(searchQuery.value, [connection.name, connection.db_type, connection.host, connection.port, connection.database, connection.id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const filteredAvailableConnections = computed(() => groups.value.available.filter(connectionMatchesSearch));
|
|
||||||
const filteredAllowedConnections = computed(() => groups.value.allowed.filter(connectionMatchesSearch));
|
|
||||||
const filteredUnavailableAllowedIds = computed(() => groups.value.unavailableAllowedIds.filter((id) => matchesMcpSearchQuery(searchQuery.value, [id, t("settings.mcpScopeConnectionUnavailable")])));
|
|
||||||
const availablePageCount = computed(() => Math.max(1, Math.ceil(filteredAvailableConnections.value.length / connectionsPerPage.value)));
|
|
||||||
const allowedPageCount = computed(() => Math.max(1, Math.ceil(filteredAllowedConnections.value.length / connectionsPerPage.value)));
|
|
||||||
const pagedAvailableConnections = computed(() => {
|
|
||||||
const start = (availablePage.value - 1) * connectionsPerPage.value;
|
|
||||||
return filteredAvailableConnections.value.slice(start, start + connectionsPerPage.value);
|
|
||||||
});
|
|
||||||
const pagedAllowedConnections = computed(() => {
|
|
||||||
const start = (allowedPage.value - 1) * connectionsPerPage.value;
|
|
||||||
return filteredAllowedConnections.value.slice(start, start + connectionsPerPage.value);
|
|
||||||
});
|
|
||||||
const allowedVisibleCount = computed(() => filteredAllowedConnections.value.length + filteredUnavailableAllowedIds.value.length);
|
|
||||||
const allowedTotalCount = computed(() => groups.value.allowed.length + groups.value.unavailableAllowedIds.length);
|
|
||||||
const availableVisibleCount = computed(() => filteredAvailableConnections.value.length);
|
|
||||||
const availableTotalCount = computed(() => groups.value.available.length);
|
|
||||||
const allowedSummary = computed(() => (props.allowedConnectionIds === null ? t("settings.mcpScopeAllSummary", { count: props.connections.length }) : t("settings.mcpScopeSelectedSummary", { selected: groups.value.allowed.length, total: props.connections.length })));
|
|
||||||
const policyKey = computed(() => (props.allowedConnectionIds === null ? "*" : props.allowedConnectionIds.join("\u0000")));
|
|
||||||
|
|
||||||
function paneCount(visible: number, total: number): string {
|
|
||||||
return searchActive.value ? `${visible}/${total}` : String(total);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setPanePage(pane: ScopePane, page: number) {
|
|
||||||
const total = pane === "available" ? availablePageCount.value : allowedPageCount.value;
|
|
||||||
const next = Math.min(Math.max(1, page), total);
|
|
||||||
if (pane === "available") availablePage.value = next;
|
|
||||||
else allowedPage.value = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
function paginationLabel(page: number, pageCount: number): string {
|
|
||||||
return `${page} / ${pageCount}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectionAddress(connection: ConnectionConfig): string {
|
|
||||||
const address = connection.host ? `${connection.host}:${connection.port}` : "";
|
|
||||||
return [address, connection.database].filter(Boolean).join(" · ") || connection.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function emitAllowedConnectionIds(value: string[] | null) {
|
|
||||||
if (props.disabled) return;
|
|
||||||
emit("update:allowedConnectionIds", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setScopeMode(mode: ScopeMode) {
|
|
||||||
if (mode === scopeMode.value || props.disabled) return;
|
|
||||||
emitAllowedConnectionIds(mode === "all" ? null : [...connectionIds.value]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onScopeModeKeydown(event: KeyboardEvent, mode: ScopeMode) {
|
|
||||||
if (props.disabled || !["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
const nextMode: ScopeMode = event.key === "Home" || event.key === "ArrowLeft" || event.key === "ArrowUp" ? "all" : "selected";
|
|
||||||
if (nextMode === mode) return;
|
|
||||||
// These cards visually replace native radios, so preserve the radio-group keyboard contract.
|
|
||||||
const currentTarget = event.currentTarget;
|
|
||||||
const group = currentTarget instanceof HTMLElement ? currentTarget.closest<HTMLElement>('[role="radiogroup"]') : null;
|
|
||||||
group?.querySelector<HTMLElement>(`[data-scope-mode="${nextMode}"]`)?.focus();
|
|
||||||
setScopeMode(nextMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
function restorePendingFocus() {
|
|
||||||
const pending = pendingFocus.value;
|
|
||||||
if (!pending || props.busy) return;
|
|
||||||
void nextTick(() => {
|
|
||||||
if (props.busy) return;
|
|
||||||
const pane = rootRef.value?.querySelector<HTMLElement>(`[data-scope-pane="${pending.pane}"]`);
|
|
||||||
const actions = [...(pane?.querySelectorAll<HTMLButtonElement>("[data-scope-action]") ?? [])];
|
|
||||||
const target = actions[Math.min(pending.index, Math.max(0, actions.length - 1))];
|
|
||||||
if (target) target.focus();
|
|
||||||
else rootRef.value?.focus();
|
|
||||||
pendingFocus.value = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateConnections(connectionIdsToUpdate: readonly string[], allowed: boolean, event?: MouseEvent) {
|
|
||||||
if (props.disabled || connectionIdsToUpdate.length === 0) return;
|
|
||||||
const sourcePane: ScopePane = allowed ? "available" : "allowed";
|
|
||||||
if (event?.currentTarget instanceof HTMLElement) {
|
|
||||||
const pane = event.currentTarget.closest<HTMLElement>("[data-scope-pane]");
|
|
||||||
const actions = [...(pane?.querySelectorAll<HTMLButtonElement>("[data-scope-action]") ?? [])];
|
|
||||||
pendingFocus.value = { pane: sourcePane, index: Math.max(0, actions.indexOf(event.currentTarget as HTMLButtonElement)) };
|
|
||||||
}
|
|
||||||
emitAllowedConnectionIds(updateMcpAllowedConnectionIds(props.allowedConnectionIds, connectionIds.value, connectionIdsToUpdate, allowed));
|
|
||||||
restorePendingFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function addVisibleConnections() {
|
|
||||||
updateConnections(
|
|
||||||
filteredAvailableConnections.value.map((connection) => connection.id),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeVisibleConnections() {
|
|
||||||
updateConnections([...filteredAllowedConnections.value.map((connection) => connection.id), ...filteredUnavailableAllowedIds.value], false);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.busy,
|
|
||||||
(busy) => {
|
|
||||||
if (!busy) restorePendingFocus();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
watch([policyKey, () => groups.value.allowed.length], () => {
|
|
||||||
announcement.value = t("settings.mcpScopeUpdatedAnnouncement", { selected: groups.value.allowed.length, total: props.connections.length });
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(searchQuery, () => {
|
|
||||||
availablePage.value = 1;
|
|
||||||
allowedPage.value = 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(connectionsPerPage, () => {
|
|
||||||
availablePage.value = 1;
|
|
||||||
allowedPage.value = 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(availablePageCount, () => setPanePage("available", availablePage.value));
|
|
||||||
watch(allowedPageCount, () => setPanePage("allowed", allowedPage.value));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div ref="rootRef" tabindex="-1" class="mcp-scope-picker space-y-3 outline-none" :aria-busy="busy">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
|
||||||
<div class="min-w-0 space-y-1">
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<div :id="`${pickerId}-mode-label`" class="text-sm font-medium">{{ t("settings.mcpScopeConnection") }}</div>
|
|
||||||
<Badge variant="outline" class="rounded-md font-normal">{{ allowedSummary }}</Badge>
|
|
||||||
</div>
|
|
||||||
<p class="text-xs text-muted-foreground">{{ t("settings.mcpScopeConnectionDescription") }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-1 rounded-md border bg-muted/50 p-1 sm:grid-cols-2" role="radiogroup" :aria-labelledby="`${pickerId}-mode-label`">
|
|
||||||
<Button
|
|
||||||
:disabled="disabled"
|
|
||||||
type="button"
|
|
||||||
role="radio"
|
|
||||||
data-scope-mode="all"
|
|
||||||
:aria-checked="scopeMode === 'all'"
|
|
||||||
:tabindex="scopeMode === 'all' ? 0 : -1"
|
|
||||||
variant="outline"
|
|
||||||
class="settings-choice-card h-auto justify-center border-0 p-2.5 shadow-none"
|
|
||||||
:class="[scopeMode === 'all' ? 'dbx-choice-selected bg-background shadow-sm' : 'text-muted-foreground hover:bg-background/70', disabled ? 'cursor-not-allowed opacity-50' : '']"
|
|
||||||
@click="setScopeMode('all')"
|
|
||||||
@keydown="onScopeModeKeydown($event, 'all')"
|
|
||||||
>
|
|
||||||
<div class="w-full min-w-0 text-center">
|
|
||||||
<div class="text-sm font-medium">{{ t("settings.mcpScopeModeAll") }}</div>
|
|
||||||
<div class="text-xs text-muted-foreground truncate">{{ t("settings.mcpScopeModeAllDescription") }}</div>
|
|
||||||
</div>
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
:disabled="disabled"
|
|
||||||
type="button"
|
|
||||||
role="radio"
|
|
||||||
data-scope-mode="selected"
|
|
||||||
:aria-checked="scopeMode === 'selected'"
|
|
||||||
:tabindex="scopeMode === 'selected' ? 0 : -1"
|
|
||||||
variant="outline"
|
|
||||||
class="settings-choice-card h-auto justify-center border-0 p-2.5 shadow-none"
|
|
||||||
:class="[scopeMode === 'selected' ? 'dbx-choice-selected bg-background shadow-sm' : 'text-muted-foreground hover:bg-background/70', disabled ? 'cursor-not-allowed opacity-50' : '']"
|
|
||||||
@click="setScopeMode('selected')"
|
|
||||||
@keydown="onScopeModeKeydown($event, 'selected')"
|
|
||||||
>
|
|
||||||
<div class="w-full min-w-0 text-center">
|
|
||||||
<div class="text-sm font-medium">{{ t("settings.mcpScopeModeSelected") }}</div>
|
|
||||||
<div class="text-xs text-muted-foreground truncate">{{ t("settings.mcpScopeModeSelectedDescription") }}</div>
|
|
||||||
</div>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<div class="relative min-w-0 flex-1">
|
|
||||||
<Search class="pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
|
||||||
<Input v-model="searchQuery" class="h-9 pl-8" :disabled="disabled" :aria-label="t('settings.mcpConnectionSearchPlaceholder')" :placeholder="t('settings.mcpConnectionSearchPlaceholder')" />
|
|
||||||
</div>
|
|
||||||
<label class="flex h-9 items-center gap-1.5 rounded-md border bg-background px-2 text-xs text-muted-foreground">
|
|
||||||
{{ t("settings.mcpPerPage") }}
|
|
||||||
<select :value="connectionsPerPage" class="bg-transparent text-xs text-foreground outline-none" :disabled="disabled" @change="connectionsPerPage = Number(($event.target as HTMLSelectElement).value)">
|
|
||||||
<option v-for="size in PAGE_SIZE_OPTIONS" :key="size" :value="size">{{ size }}</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mcp-scope-mobile-tabs grid grid-cols-2 rounded-md bg-muted p-1" role="tablist" :aria-label="t('settings.mcpScopeConnection')">
|
|
||||||
<button
|
|
||||||
:id="`${pickerId}-allowed-tab`"
|
|
||||||
type="button"
|
|
||||||
role="tab"
|
|
||||||
data-scope-tab="allowed"
|
|
||||||
class="min-w-0 rounded px-2 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
||||||
:class="compactPane === 'allowed' ? 'bg-background text-foreground shadow-sm dark:bg-input/30' : 'text-muted-foreground'"
|
|
||||||
:aria-selected="compactPane === 'allowed'"
|
|
||||||
:aria-controls="`${pickerId}-allowed-pane`"
|
|
||||||
@click="compactPane = 'allowed'"
|
|
||||||
>
|
|
||||||
{{ t("settings.mcpScopeAllowedPane") }} {{ allowedTotalCount }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
:id="`${pickerId}-available-tab`"
|
|
||||||
type="button"
|
|
||||||
role="tab"
|
|
||||||
data-scope-tab="available"
|
|
||||||
class="min-w-0 rounded px-2 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
||||||
:class="compactPane === 'available' ? 'bg-background text-foreground shadow-sm dark:bg-input/30' : 'text-muted-foreground'"
|
|
||||||
:aria-selected="compactPane === 'available'"
|
|
||||||
:aria-controls="`${pickerId}-available-pane`"
|
|
||||||
@click="compactPane = 'available'"
|
|
||||||
>
|
|
||||||
{{ t("settings.mcpScopeAvailablePane") }} {{ availableTotalCount }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mcp-scope-transfer overflow-hidden rounded-md border bg-background">
|
|
||||||
<section :id="`${pickerId}-available-pane`" data-scope-pane="available" class="mcp-scope-pane min-w-0 flex-col" :class="{ 'mcp-scope-pane--active': compactPane === 'available' }" role="region" :aria-label="t('settings.mcpScopeAvailablePane')">
|
|
||||||
<div class="flex min-h-10 items-center justify-between gap-2 border-b px-2.5 py-1.5">
|
|
||||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium">
|
|
||||||
<span class="truncate">{{ t("settings.mcpScopeAvailablePane") }}</span>
|
|
||||||
<Badge variant="secondary" class="rounded-md font-normal">{{ paneCount(availableVisibleCount, availableTotalCount) }}</Badge>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="xs"
|
|
||||||
variant="ghost"
|
|
||||||
data-scope-batch="available"
|
|
||||||
:title="t(searchActive ? 'settings.mcpScopeAddMatches' : 'settings.mcpScopeAddAll', { count: availableVisibleCount })"
|
|
||||||
:aria-label="t(searchActive ? 'settings.mcpScopeAddMatches' : 'settings.mcpScopeAddAll', { count: availableVisibleCount })"
|
|
||||||
:disabled="disabled || availableVisibleCount === 0"
|
|
||||||
@click="addVisibleConnections"
|
|
||||||
>
|
|
||||||
<Plus />
|
|
||||||
<span class="mcp-scope-batch-label">{{ t(searchActive ? "settings.mcpScopeAddMatches" : "settings.mcpScopeAddAll", { count: availableVisibleCount }) }}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-1.5 p-1.5">
|
|
||||||
<div v-if="filteredAvailableConnections.length === 0" class="flex h-full items-center justify-center px-3 text-center text-sm text-muted-foreground">
|
|
||||||
{{ searchActive ? t("settings.mcpConnectionSearchEmpty") : t("settings.mcpScopeAvailableEmpty") }}
|
|
||||||
</div>
|
|
||||||
<div v-for="connection in pagedAvailableConnections" :key="connection.id" class="mcp-scope-connection-row grid min-h-12 items-center gap-2 rounded px-2 py-1.5 hover:bg-muted/60">
|
|
||||||
<div class="min-w-0">
|
|
||||||
<TruncatedTextTooltip :text="connection.name" class="block text-sm font-medium" />
|
|
||||||
<TruncatedTextTooltip :text="connectionAddress(connection)" class="mt-0.5 block font-mono text-[11px] text-muted-foreground" />
|
|
||||||
</div>
|
|
||||||
<div class="flex min-w-0 items-center justify-center">
|
|
||||||
<Badge :title="connection.db_type.toUpperCase()" variant="outline" class="max-w-full justify-center rounded px-1.5 py-0 text-[10px] font-normal uppercase">
|
|
||||||
<span class="truncate">{{ connection.db_type }}</span>
|
|
||||||
</Badge>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="icon-sm"
|
|
||||||
variant="ghost"
|
|
||||||
class="justify-self-end"
|
|
||||||
data-scope-action
|
|
||||||
:data-connection-id="connection.id"
|
|
||||||
:title="t('settings.mcpScopeAddConnection', { name: connection.name })"
|
|
||||||
:aria-label="t('settings.mcpScopeAddConnection', { name: connection.name })"
|
|
||||||
:disabled="disabled"
|
|
||||||
@click="updateConnections([connection.id], true, $event)"
|
|
||||||
>
|
|
||||||
<Plus />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div v-if="availablePageCount > 1" class="flex items-center justify-center gap-2 border-t pt-2 text-xs text-muted-foreground">
|
|
||||||
<Button type="button" size="icon-sm" variant="ghost" :disabled="availablePage === 1" :title="t('settings.mcpPreviousPage')" :aria-label="t('settings.mcpPreviousPage')" @click="setPanePage('available', availablePage - 1)">
|
|
||||||
<ChevronLeft />
|
|
||||||
</Button>
|
|
||||||
<span class="min-w-12 text-center tabular-nums">{{ paginationLabel(availablePage, availablePageCount) }}</span>
|
|
||||||
<Button type="button" size="icon-sm" variant="ghost" :disabled="availablePage === availablePageCount" :title="t('settings.mcpNextPage')" :aria-label="t('settings.mcpNextPage')" @click="setPanePage('available', availablePage + 1)">
|
|
||||||
<ChevronRight />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section :id="`${pickerId}-allowed-pane`" data-scope-pane="allowed" class="mcp-scope-pane min-w-0 flex-col" :class="{ 'mcp-scope-pane--active': compactPane === 'allowed' }" role="region" :aria-label="t('settings.mcpScopeAllowedPane')">
|
|
||||||
<div class="flex min-h-10 items-center justify-between gap-2 border-b px-2.5 py-1.5">
|
|
||||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium">
|
|
||||||
<span class="truncate">{{ t("settings.mcpScopeAllowedPane") }}</span>
|
|
||||||
<Badge variant="secondary" class="rounded-md font-normal">{{ paneCount(allowedVisibleCount, allowedTotalCount) }}</Badge>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="xs"
|
|
||||||
variant="ghost"
|
|
||||||
data-scope-batch="allowed"
|
|
||||||
:title="t(searchActive ? 'settings.mcpScopeRemoveMatches' : 'settings.mcpScopeRemoveAll', { count: allowedVisibleCount })"
|
|
||||||
:aria-label="t(searchActive ? 'settings.mcpScopeRemoveMatches' : 'settings.mcpScopeRemoveAll', { count: allowedVisibleCount })"
|
|
||||||
:disabled="disabled || allowedVisibleCount === 0"
|
|
||||||
@click="removeVisibleConnections"
|
|
||||||
>
|
|
||||||
<Minus />
|
|
||||||
<span class="mcp-scope-batch-label">{{ t(searchActive ? "settings.mcpScopeRemoveMatches" : "settings.mcpScopeRemoveAll", { count: allowedVisibleCount }) }}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-1.5 p-1.5">
|
|
||||||
<div v-if="filteredAllowedConnections.length === 0 && filteredUnavailableAllowedIds.length === 0" class="flex h-full items-center justify-center px-3 text-center text-sm text-muted-foreground">
|
|
||||||
{{ searchActive ? t("settings.mcpConnectionSearchEmpty") : t("settings.mcpScopeAllowedEmpty") }}
|
|
||||||
</div>
|
|
||||||
<div v-for="connection in pagedAllowedConnections" :key="connection.id" class="mcp-scope-connection-row grid min-h-12 items-center gap-2 rounded px-2 py-1.5 hover:bg-muted/60">
|
|
||||||
<div class="min-w-0">
|
|
||||||
<TruncatedTextTooltip :text="connection.name" class="block text-sm font-medium" />
|
|
||||||
<TruncatedTextTooltip :text="connectionAddress(connection)" class="mt-0.5 block font-mono text-[11px] text-muted-foreground" />
|
|
||||||
</div>
|
|
||||||
<div class="flex min-w-0 items-center justify-center">
|
|
||||||
<Badge :title="connection.db_type.toUpperCase()" variant="outline" class="max-w-full justify-center rounded px-1.5 py-0 text-[10px] font-normal uppercase">
|
|
||||||
<span class="truncate">{{ connection.db_type }}</span>
|
|
||||||
</Badge>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="icon-sm"
|
|
||||||
variant="ghost"
|
|
||||||
class="justify-self-end"
|
|
||||||
data-scope-action
|
|
||||||
:data-connection-id="connection.id"
|
|
||||||
:title="t('settings.mcpScopeRemoveConnection', { name: connection.name })"
|
|
||||||
:aria-label="t('settings.mcpScopeRemoveConnection', { name: connection.name })"
|
|
||||||
:disabled="disabled"
|
|
||||||
@click="updateConnections([connection.id], false, $event)"
|
|
||||||
>
|
|
||||||
<Minus />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="filteredUnavailableAllowedIds.length > 0" class="mt-1 border-t border-amber-500/20 pt-1">
|
|
||||||
<div class="flex items-center gap-1.5 px-2 py-1 text-[11px] font-medium text-amber-600 dark:text-amber-400">
|
|
||||||
<AlertTriangle class="h-3.5 w-3.5" />
|
|
||||||
{{ t("settings.mcpScopeUnavailableGroup", { count: filteredUnavailableAllowedIds.length }) }}
|
|
||||||
</div>
|
|
||||||
<div v-for="connectionId in filteredUnavailableAllowedIds" :key="connectionId" class="flex min-h-10 items-center gap-2 rounded px-2 py-1.5 text-amber-600 hover:bg-muted/60 dark:text-amber-400">
|
|
||||||
<TruncatedTextTooltip :text="connectionId" class="min-w-0 flex-1 font-mono text-xs" />
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="icon-sm"
|
|
||||||
variant="ghost"
|
|
||||||
data-scope-action
|
|
||||||
:data-connection-id="connectionId"
|
|
||||||
:title="t('settings.mcpScopeRemoveUnavailableConnection', { id: connectionId })"
|
|
||||||
:aria-label="t('settings.mcpScopeRemoveUnavailableConnection', { id: connectionId })"
|
|
||||||
:disabled="disabled"
|
|
||||||
@click="updateConnections([connectionId], false, $event)"
|
|
||||||
>
|
|
||||||
<Minus />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="allowedPageCount > 1" class="flex items-center justify-center gap-2 border-t pt-2 text-xs text-muted-foreground">
|
|
||||||
<Button type="button" size="icon-sm" variant="ghost" :disabled="allowedPage === 1" :title="t('settings.mcpPreviousPage')" :aria-label="t('settings.mcpPreviousPage')" @click="setPanePage('allowed', allowedPage - 1)">
|
|
||||||
<ChevronLeft />
|
|
||||||
</Button>
|
|
||||||
<span class="min-w-12 text-center tabular-nums">{{ paginationLabel(allowedPage, allowedPageCount) }}</span>
|
|
||||||
<Button type="button" size="icon-sm" variant="ghost" :disabled="allowedPage === allowedPageCount" :title="t('settings.mcpNextPage')" :aria-label="t('settings.mcpNextPage')" @click="setPanePage('allowed', allowedPage + 1)">
|
|
||||||
<ChevronRight />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p v-if="groups.unavailableAllowedIds.length > 0" class="text-xs text-amber-600 dark:text-amber-400">
|
|
||||||
{{ t("settings.mcpScopeConnectionUnavailableDescription", { count: groups.unavailableAllowedIds.length }) }}
|
|
||||||
</p>
|
|
||||||
<span class="sr-only" aria-live="polite">{{ announcement }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.mcp-scope-picker {
|
|
||||||
container: mcp-scope / inline-size;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-pane {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-pane--active {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-connection-row {
|
|
||||||
grid-template-columns: minmax(0, 1fr) 6.75rem 1.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@container mcp-scope (min-width: 42rem) {
|
|
||||||
.mcp-scope-mobile-tabs {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-transfer {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-pane {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-pane + .mcp-scope-pane {
|
|
||||||
border-inline-start: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@container mcp-scope (max-width: 28rem) {
|
|
||||||
.mcp-scope-mode-description,
|
|
||||||
.mcp-scope-batch-label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-scope-connection-row {
|
|
||||||
grid-template-columns: minmax(0, 1fr) 5.5rem 1.75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
-109
@@ -1,109 +0,0 @@
|
|||||||
// @vitest-environment happy-dom
|
|
||||||
|
|
||||||
import { describe, expect, it, vi } from "vitest";
|
|
||||||
import { dispatch, findAll, findOne, mountComponent } from "@/components/grid/__tests__/vueHostHarness";
|
|
||||||
import type { ConnectionConfig } from "@/types/database";
|
|
||||||
|
|
||||||
vi.mock("vue-i18n", () => ({
|
|
||||||
useI18n: () => ({
|
|
||||||
t: (key: string, values?: Record<string, unknown>) => `${key}${values ? ` ${JSON.stringify(values)}` : ""}`,
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
vi.mock("@lucide/vue", async () => {
|
|
||||||
const { createPassthroughStub } = await import("@/components/grid/__tests__/vueHostHarness");
|
|
||||||
const icon = createPassthroughStub("Icon", "i");
|
|
||||||
return { AlertTriangle: icon, Minus: icon, Plus: icon, Search: icon };
|
|
||||||
});
|
|
||||||
|
|
||||||
vi.mock("@/components/ui/badge", async () => ({ Badge: (await import("@/components/grid/__tests__/vueHostHarness")).createPassthroughStub("Badge", "span") }));
|
|
||||||
vi.mock("@/components/ui/button", async () => ({ Button: (await import("@/components/grid/__tests__/vueHostHarness")).createPassthroughStub("Button", "button") }));
|
|
||||||
vi.mock("@/components/ui/input", async () => ({ Input: (await import("@/components/grid/__tests__/vueHostHarness")).createPassthroughStub("Input", "input") }));
|
|
||||||
vi.mock("@/components/ui/TruncatedTextTooltip.vue", async () => ({ default: (await import("@/components/grid/__tests__/vueHostHarness")).createPassthroughStub("TruncatedTextTooltip", "span") }));
|
|
||||||
|
|
||||||
import McpConnectionScopePicker from "@/components/settings/McpConnectionScopePicker.vue";
|
|
||||||
|
|
||||||
function connection(id: string): ConnectionConfig {
|
|
||||||
return {
|
|
||||||
id,
|
|
||||||
name: `${id}-name`,
|
|
||||||
db_type: "mysql",
|
|
||||||
host: "127.0.0.1",
|
|
||||||
port: 3306,
|
|
||||||
username: "test",
|
|
||||||
password: "",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("McpConnectionScopePicker", () => {
|
|
||||||
it("separates allowed and available connections and emits direct moves", () => {
|
|
||||||
const update = vi.fn();
|
|
||||||
const mounted = mountComponent(McpConnectionScopePicker, {
|
|
||||||
connections: [connection("one"), connection("two")],
|
|
||||||
allowedConnectionIds: ["one"],
|
|
||||||
"onUpdate:allowedConnectionIds": update,
|
|
||||||
});
|
|
||||||
|
|
||||||
const allowedPane = findOne(mounted.root, (node) => node.props["data-scope-pane"] === "allowed");
|
|
||||||
const availablePane = findOne(mounted.root, (node) => node.props["data-scope-pane"] === "available");
|
|
||||||
expect(findAll(allowedPane, (node) => node.props["data-stub"] === "TruncatedTextTooltip").map((node) => node.props.text)).toContain("one-name");
|
|
||||||
expect(findAll(allowedPane, (node) => node.props["data-stub"] === "TruncatedTextTooltip").map((node) => node.props.text)).not.toContain("two-name");
|
|
||||||
expect(findAll(availablePane, (node) => node.props["data-stub"] === "TruncatedTextTooltip").map((node) => node.props.text)).toContain("two-name");
|
|
||||||
|
|
||||||
const add = findOne(availablePane, (node) => node.props["data-connection-id"] === "two");
|
|
||||||
dispatch(add, "click");
|
|
||||||
expect(update).toHaveBeenCalledWith(["one", "two"]);
|
|
||||||
|
|
||||||
const remove = findOne(allowedPane, (node) => node.props["data-connection-id"] === "one");
|
|
||||||
dispatch(remove, "click");
|
|
||||||
expect(update).toHaveBeenCalledWith([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("keeps dynamic allow-all distinct from an explicit current-connection list", () => {
|
|
||||||
const update = vi.fn();
|
|
||||||
const mounted = mountComponent(McpConnectionScopePicker, {
|
|
||||||
connections: [connection("one"), connection("two")],
|
|
||||||
allowedConnectionIds: null,
|
|
||||||
"onUpdate:allowedConnectionIds": update,
|
|
||||||
});
|
|
||||||
const modeButtons = findAll(mounted.root, (node) => {
|
|
||||||
return node.type === "button" && node.props["class"]?.includes("settings-choice-card");
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(modeButtons.find((node) => node.props["data-scope-mode"] === "all")?.props["class"]?.includes("dbx-choice-selected")).toBe(true);
|
|
||||||
expect(modeButtons.find((node) => node.props["data-scope-mode"] === "all")?.props.role).toBe("radio");
|
|
||||||
expect(modeButtons.find((node) => node.props["data-scope-mode"] === "all")?.props["aria-checked"]).toBe(true);
|
|
||||||
expect(modeButtons.find((node) => node.props["data-scope-mode"] === "selected")?.props.tabindex).toBe(-1);
|
|
||||||
dispatch(
|
|
||||||
findOne(mounted.root, (node) => node.type === "button" && node.props["data-scope-mode"] === "selected"),
|
|
||||||
"click",
|
|
||||||
);
|
|
||||||
expect(update).toHaveBeenCalledWith(["one", "two"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("supports radio-group arrow-key selection", () => {
|
|
||||||
const update = vi.fn();
|
|
||||||
const mounted = mountComponent(McpConnectionScopePicker, {
|
|
||||||
connections: [connection("one"), connection("two")],
|
|
||||||
allowedConnectionIds: null,
|
|
||||||
"onUpdate:allowedConnectionIds": update,
|
|
||||||
});
|
|
||||||
const allMode = findOne(mounted.root, (node) => node.type === "button" && node.props["data-scope-mode"] === "all");
|
|
||||||
|
|
||||||
const event = dispatch(allMode, "keydown", { key: "ArrowRight" });
|
|
||||||
|
|
||||||
expect(event.defaultPrevented).toBe(true);
|
|
||||||
expect(update).toHaveBeenCalledWith(["one", "two"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("shows unavailable allowlist entries only in the allowed pane", () => {
|
|
||||||
const mounted = mountComponent(McpConnectionScopePicker, {
|
|
||||||
connections: [connection("one")],
|
|
||||||
allowedConnectionIds: ["one", "missing-id"],
|
|
||||||
});
|
|
||||||
const allowedPane = findOne(mounted.root, (node) => node.props["data-scope-pane"] === "allowed");
|
|
||||||
const availablePane = findOne(mounted.root, (node) => node.props["data-scope-pane"] === "available");
|
|
||||||
expect(findAll(allowedPane, (node) => node.props["data-stub"] === "TruncatedTextTooltip").map((node) => node.props.text)).toContain("missing-id");
|
|
||||||
expect(findAll(availablePane, (node) => node.props["data-stub"] === "TruncatedTextTooltip").map((node) => node.props.text)).not.toContain("missing-id");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuRootEmits, ContextMenuRootProps } from "reka-ui";
|
|
||||||
import { ContextMenuRoot, useForwardPropsEmits } from "reka-ui";
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<ContextMenuRootProps>(), {
|
|
||||||
modal: false,
|
|
||||||
});
|
|
||||||
const emits = defineEmits<ContextMenuRootEmits>();
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(props, emits);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuRoot data-slot="context-menu" v-bind="forwarded">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuRoot>
|
|
||||||
</template>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuCheckboxItemEmits, ContextMenuCheckboxItemProps } from "reka-ui";
|
|
||||||
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { CheckIcon } from "@lucide/vue";
|
|
||||||
import { ContextMenuCheckboxItem, ContextMenuItemIndicator, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { shouldSuppressRepeatedActivation, suppressEvent, type ActionActivationGuard } from "@/lib/connection/actionActivation";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuCheckboxItemProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
const emits = defineEmits<ContextMenuCheckboxItemEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
const activationGuard: ActionActivationGuard = {};
|
|
||||||
|
|
||||||
function guardRepeatedClick(event: MouseEvent) {
|
|
||||||
if (props.disabled) return;
|
|
||||||
if (shouldSuppressRepeatedActivation(activationGuard)) {
|
|
||||||
suppressEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuCheckboxItem
|
|
||||||
data-slot="context-menu-checkbox-item"
|
|
||||||
v-bind="forwarded"
|
|
||||||
@click.capture="guardRepeatedClick"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*=size-])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<span class="absolute right-2 pointer-events-none">
|
|
||||||
<ContextMenuItemIndicator>
|
|
||||||
<slot name="indicator-icon">
|
|
||||||
<CheckIcon />
|
|
||||||
</slot>
|
|
||||||
</ContextMenuItemIndicator>
|
|
||||||
</span>
|
|
||||||
<slot />
|
|
||||||
</ContextMenuCheckboxItem>
|
|
||||||
</template>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuContentEmits, ContextMenuContentProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuContent, ContextMenuPortal, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
import { useFloatingLayerOrder } from "@/components/ui/dialog/useDialogLayerOrder";
|
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuContentProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
const emits = defineEmits<ContextMenuContentEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
const { forwardRef } = useFloatingLayerOrder();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuPortal>
|
|
||||||
<ContextMenuContent
|
|
||||||
:ref="forwardRef"
|
|
||||||
data-slot="context-menu-content"
|
|
||||||
v-bind="{ ...$attrs, ...forwarded }"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 text-popover-foreground min-w-36 rounded-md p-1 duration-100 cn-menu-translucent z-(--dbx-floating-layer-z-index) max-h-(--reka-context-menu-content-available-height) origin-(--reka-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</ContextMenuContent>
|
|
||||||
</ContextMenuPortal>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuGroupProps } from "reka-ui";
|
|
||||||
import { ContextMenuGroup } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuGroupProps>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuGroup data-slot="context-menu-group" v-bind="props">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuGroup>
|
|
||||||
</template>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuItemEmits, ContextMenuItemProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuItem, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { shouldSuppressRepeatedActivation, suppressEvent, type ActionActivationGuard } from "@/lib/connection/actionActivation";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<
|
|
||||||
ContextMenuItemProps & {
|
|
||||||
class?: HTMLAttributes["class"];
|
|
||||||
inset?: boolean;
|
|
||||||
variant?: "default" | "destructive";
|
|
||||||
}
|
|
||||||
>(),
|
|
||||||
{
|
|
||||||
variant: "default",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
const emits = defineEmits<ContextMenuItemEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
const activationGuard: ActionActivationGuard = {};
|
|
||||||
|
|
||||||
function guardRepeatedClick(event: MouseEvent) {
|
|
||||||
if (props.disabled) return;
|
|
||||||
if (shouldSuppressRepeatedActivation(activationGuard)) {
|
|
||||||
suppressEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuItem
|
|
||||||
data-slot="context-menu-item"
|
|
||||||
:data-inset="inset ? '' : undefined"
|
|
||||||
:data-variant="variant"
|
|
||||||
v-bind="forwarded"
|
|
||||||
@click.capture="guardRepeatedClick"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-2 rounded-md px-2 py-1 text-[13px] data-inset:pl-7 [&_svg:not([class*=size-])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</ContextMenuItem>
|
|
||||||
</template>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuLabelProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuLabel } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuLabelProps & { class?: HTMLAttributes["class"]; inset?: boolean }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuLabel data-slot="context-menu-label" :data-inset="inset ? '' : undefined" v-bind="delegatedProps" :class="cn('text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7', props.class)">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuLabel>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuPortalProps } from "reka-ui";
|
|
||||||
import { ContextMenuPortal } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuPortalProps>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuPortal data-slot="context-menu-portal" v-bind="props">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuPortal>
|
|
||||||
</template>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuRadioGroupEmits, ContextMenuRadioGroupProps } from "reka-ui";
|
|
||||||
import { ContextMenuRadioGroup, useForwardPropsEmits } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuRadioGroupProps>();
|
|
||||||
const emits = defineEmits<ContextMenuRadioGroupEmits>();
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(props, emits);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuRadioGroup data-slot="context-menu-radio-group" v-bind="forwarded">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuRadioGroup>
|
|
||||||
</template>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuRadioItemEmits, ContextMenuRadioItemProps } from "reka-ui";
|
|
||||||
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { CheckIcon } from "@lucide/vue";
|
|
||||||
import { ContextMenuItemIndicator, ContextMenuRadioItem, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { shouldSuppressRepeatedActivation, suppressEvent, type ActionActivationGuard } from "@/lib/connection/actionActivation";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuRadioItemProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
const emits = defineEmits<ContextMenuRadioItemEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
const activationGuard: ActionActivationGuard = {};
|
|
||||||
|
|
||||||
function guardRepeatedClick(event: MouseEvent) {
|
|
||||||
if (props.disabled) return;
|
|
||||||
if (shouldSuppressRepeatedActivation(activationGuard)) {
|
|
||||||
suppressEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuRadioItem
|
|
||||||
data-slot="context-menu-radio-item"
|
|
||||||
v-bind="forwarded"
|
|
||||||
@click.capture="guardRepeatedClick"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*=size-])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<span class="absolute right-2 pointer-events-none">
|
|
||||||
<ContextMenuItemIndicator>
|
|
||||||
<slot name="indicator-icon">
|
|
||||||
<CheckIcon />
|
|
||||||
</slot>
|
|
||||||
</ContextMenuItemIndicator>
|
|
||||||
</span>
|
|
||||||
<slot />
|
|
||||||
</ContextMenuRadioItem>
|
|
||||||
</template>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuSeparatorProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuSeparator } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuSeparatorProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuSeparator data-slot="context-menu-separator" v-bind="delegatedProps" :class="cn('bg-foreground/6 -mx-1 my-0.5 h-px', props.class)" />
|
|
||||||
</template>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
class?: HTMLAttributes["class"];
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<span data-slot="context-menu-shortcut" :class="cn('text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest', props.class)">
|
|
||||||
<slot />
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuSubEmits, ContextMenuSubProps } from "reka-ui";
|
|
||||||
import { ContextMenuSub, useForwardPropsEmits } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuSubProps>();
|
|
||||||
const emits = defineEmits<ContextMenuSubEmits>();
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(props, emits);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuSub data-slot="context-menu-sub" v-bind="forwarded">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuSub>
|
|
||||||
</template>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DropdownMenuSubContentEmits, DropdownMenuSubContentProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuPortal, ContextMenuSubContent, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
import { useFloatingLayerOrder } from "@/components/ui/dialog/useDialogLayerOrder";
|
|
||||||
|
|
||||||
const props = defineProps<DropdownMenuSubContentProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
const emits = defineEmits<DropdownMenuSubContentEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
const { forwardRef } = useFloatingLayerOrder();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuPortal>
|
|
||||||
<ContextMenuSubContent
|
|
||||||
:ref="forwardRef"
|
|
||||||
data-slot="context-menu-sub-content"
|
|
||||||
v-bind="forwarded"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 text-popover-foreground min-w-32 rounded-md ring-foreground/10 ring-1 p-1 duration-100 cn-menu-translucent z-(--dbx-floating-layer-z-index) origin-(--reka-context-menu-content-transform-origin) overflow-hidden',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</ContextMenuSubContent>
|
|
||||||
</ContextMenuPortal>
|
|
||||||
</template>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuSubTriggerProps } from "reka-ui";
|
|
||||||
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ChevronRightIcon } from "@lucide/vue";
|
|
||||||
import { ContextMenuSubTrigger, useForwardProps } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuSubTriggerProps & { class?: HTMLAttributes["class"]; inset?: boolean }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
|
|
||||||
const forwardedProps = useForwardProps(delegatedProps);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuSubTrigger
|
|
||||||
data-slot="context-menu-sub-trigger"
|
|
||||||
:data-inset="inset ? '' : undefined"
|
|
||||||
v-bind="forwardedProps"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-2 rounded-md px-2 py-1 text-[13px] data-inset:pl-7 [&_svg:not([class*=size-])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
<ChevronRightIcon class="cn-rtl-flip ml-auto" />
|
|
||||||
</ContextMenuSubTrigger>
|
|
||||||
</template>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { ContextMenuTriggerProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { ContextMenuTrigger, useForwardProps } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<ContextMenuTriggerProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
const forwardedProps = useForwardProps(delegatedProps);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ContextMenuTrigger data-slot="context-menu-trigger" v-bind="forwardedProps" :class="cn('select-none', props.class)">
|
|
||||||
<slot />
|
|
||||||
</ContextMenuTrigger>
|
|
||||||
</template>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
export { default as ContextMenu } from "./ContextMenu.vue";
|
|
||||||
export { default as ContextMenuCheckboxItem } from "./ContextMenuCheckboxItem.vue";
|
|
||||||
export { default as ContextMenuContent } from "./ContextMenuContent.vue";
|
|
||||||
export { default as ContextMenuGroup } from "./ContextMenuGroup.vue";
|
|
||||||
export { default as ContextMenuItem } from "./ContextMenuItem.vue";
|
|
||||||
export { default as ContextMenuLabel } from "./ContextMenuLabel.vue";
|
|
||||||
export { default as ContextMenuRadioGroup } from "./ContextMenuRadioGroup.vue";
|
|
||||||
export { default as ContextMenuRadioItem } from "./ContextMenuRadioItem.vue";
|
|
||||||
export { default as ContextMenuSeparator } from "./ContextMenuSeparator.vue";
|
|
||||||
export { default as ContextMenuShortcut } from "./ContextMenuShortcut.vue";
|
|
||||||
export { default as ContextMenuSub } from "./ContextMenuSub.vue";
|
|
||||||
export { default as ContextMenuSubContent } from "./ContextMenuSubContent.vue";
|
|
||||||
export { default as ContextMenuSubTrigger } from "./ContextMenuSubTrigger.vue";
|
|
||||||
export { default as ContextMenuTrigger } from "./ContextMenuTrigger.vue";
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogRootEmits, DialogRootProps } from "reka-ui";
|
|
||||||
import { DialogRoot, useForwardPropsEmits } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<DialogRootProps>();
|
|
||||||
const emits = defineEmits<DialogRootEmits>();
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(props, emits);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogRoot v-slot="slotProps" data-slot="sheet" v-bind="forwarded">
|
|
||||||
<slot v-bind="slotProps" />
|
|
||||||
</DialogRoot>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogCloseProps } from "reka-ui";
|
|
||||||
import { DialogClose } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<DialogCloseProps>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogClose data-slot="sheet-close" v-bind="props">
|
|
||||||
<slot />
|
|
||||||
</DialogClose>
|
|
||||||
</template>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogContentEmits, DialogContentProps } from "reka-ui";
|
|
||||||
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { XIcon } from "@lucide/vue";
|
|
||||||
import { DialogClose, DialogContent, DialogPortal, useForwardPropsEmits } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import SheetOverlay from "./SheetOverlay.vue";
|
|
||||||
|
|
||||||
interface SheetContentProps extends DialogContentProps {
|
|
||||||
class?: HTMLAttributes["class"];
|
|
||||||
side?: "top" | "right" | "bottom" | "left";
|
|
||||||
showCloseButton?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<SheetContentProps>(), {
|
|
||||||
side: "right",
|
|
||||||
showCloseButton: true,
|
|
||||||
});
|
|
||||||
const emits = defineEmits<DialogContentEmits>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class", "side", "showCloseButton");
|
|
||||||
|
|
||||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogPortal>
|
|
||||||
<DialogClose as-child>
|
|
||||||
<SheetOverlay />
|
|
||||||
</DialogClose>
|
|
||||||
<DialogContent
|
|
||||||
data-slot="sheet-content"
|
|
||||||
:data-side="side"
|
|
||||||
:class="
|
|
||||||
cn(
|
|
||||||
'bg-popover text-popover-foreground fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10',
|
|
||||||
props.class,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
v-bind="{ ...$attrs, ...forwarded }"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
|
|
||||||
<DialogClose v-if="showCloseButton" data-slot="sheet-close" as-child>
|
|
||||||
<Button variant="ghost" class="absolute top-3 right-3" size="icon-sm">
|
|
||||||
<XIcon />
|
|
||||||
<span class="sr-only">Close</span>
|
|
||||||
</Button>
|
|
||||||
</DialogClose>
|
|
||||||
</DialogContent>
|
|
||||||
</DialogPortal>
|
|
||||||
</template>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogDescriptionProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { DialogDescription } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<DialogDescriptionProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogDescription data-slot="sheet-description" :class="cn('text-muted-foreground text-sm', props.class)" v-bind="delegatedProps">
|
|
||||||
<slot />
|
|
||||||
</DialogDescription>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<{ class?: HTMLAttributes["class"] }>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div data-slot="sheet-footer" :class="cn('gap-2 p-4 mt-auto flex flex-col', props.class)">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<{ class?: HTMLAttributes["class"] }>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div data-slot="sheet-header" :class="cn('gap-0.5 p-4 flex flex-col', props.class)">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogOverlayProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { DialogOverlay } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<DialogOverlayProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogOverlay data-slot="sheet-overlay" :class="cn('bg-black/20 fixed inset-0 z-50 data-open:animate-in data-open:fade-in-0 data-open:duration-200', props.class)" v-bind="delegatedProps">
|
|
||||||
<slot />
|
|
||||||
</DialogOverlay>
|
|
||||||
</template>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogTitleProps } from "reka-ui";
|
|
||||||
import type { HTMLAttributes } from "vue";
|
|
||||||
import { reactiveOmit } from "@vueuse/core";
|
|
||||||
import { DialogTitle } from "reka-ui";
|
|
||||||
import { cn } from "@/lib/common/utils";
|
|
||||||
|
|
||||||
const props = defineProps<DialogTitleProps & { class?: HTMLAttributes["class"] }>();
|
|
||||||
|
|
||||||
const delegatedProps = reactiveOmit(props, "class");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogTitle data-slot="sheet-title" :class="cn('text-foreground text-base font-medium cn-font-heading', props.class)" v-bind="delegatedProps">
|
|
||||||
<slot />
|
|
||||||
</DialogTitle>
|
|
||||||
</template>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { DialogTriggerProps } from "reka-ui";
|
|
||||||
import { DialogTrigger } from "reka-ui";
|
|
||||||
|
|
||||||
const props = defineProps<DialogTriggerProps>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DialogTrigger data-slot="sheet-trigger" v-bind="props">
|
|
||||||
<slot />
|
|
||||||
</DialogTrigger>
|
|
||||||
</template>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
export { default as Sheet } from "./Sheet.vue";
|
|
||||||
export { default as SheetClose } from "./SheetClose.vue";
|
|
||||||
export { default as SheetContent } from "./SheetContent.vue";
|
|
||||||
export { default as SheetDescription } from "./SheetDescription.vue";
|
|
||||||
export { default as SheetFooter } from "./SheetFooter.vue";
|
|
||||||
export { default as SheetHeader } from "./SheetHeader.vue";
|
|
||||||
export { default as SheetTitle } from "./SheetTitle.vue";
|
|
||||||
export { default as SheetTrigger } from "./SheetTrigger.vue";
|
|
||||||
Reference in new issue
Block a user