- WorkflowBatchImportWizard:目录扫描/多文件 → dry-run 逐文件报告 → 确认导入; warn 可补用途、需确认与 fail 项不导入不标可运行、重复导入全量 conflict 跳过 - WorkflowLibrary:view=meta 轻量列表(搜索/分类/模型/媒介/收藏/最近/启停/ 去重/批量标注),完整 JSON 仅操作时按需加载;试运行复用 WorkflowTestDialog; 保留用途确认、输出指定、单文件导入等既有能力 - api/types:listMeta、convert、importBatch、importScanDry/Commit、touch、 dedupe 客户端与 WorkflowMeta/转换报告类型;update 支持 favorite/tags/ category/model_family - i18n 130 键 ×7 语言;changelog Co-authored-by: multica-agent <github@multica.ai>
1344 lines
39 KiB
Svelte
1344 lines
39 KiB
Svelte
<script lang="ts">
|
||
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
|
||
import Button from '$lib/components/ui/Button.svelte';
|
||
import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte';
|
||
import EmptyState from '$lib/components/ui/EmptyState.svelte';
|
||
import Icon from '$lib/components/ui/Icon.svelte';
|
||
import Switch from '$lib/components/ui/Switch.svelte';
|
||
import WorkflowImportDrawer from '$lib/components/WorkflowImportDrawer.svelte';
|
||
import WorkflowTestDialog from '$lib/components/WorkflowTestDialog.svelte';
|
||
import WorkflowBatchImportWizard from '$lib/components/workflows/WorkflowBatchImportWizard.svelte';
|
||
import WorkflowMetaDialog from '$lib/components/workflows/WorkflowMetaDialog.svelte';
|
||
import {
|
||
apiErrorMessage,
|
||
workflows,
|
||
type ComfyEndpoint,
|
||
type Workflow,
|
||
type WorkflowMeta,
|
||
type WorkflowOutputMapEntry,
|
||
type WorkflowUsage,
|
||
} from '$lib/api';
|
||
import { WORKFLOW_USAGES } from '$lib/comfy/types';
|
||
import { t } from '$lib/i18n.svelte';
|
||
import { toast } from '$lib/toast';
|
||
|
||
/**
|
||
* 工作流库 (HEL-682 / S4):以 view=meta 轻量元数据驱动的管理列表——
|
||
* 搜索 / 分类·模型·媒介筛选 / 收藏 / 最近使用 / 启停 / 去重 / 批量标注,
|
||
* 全程不下载每条的完整工作流 JSON;完整数据只在试运行、输出映射等
|
||
* 操作时按需单条加载。试运行复用 WorkflowTestDialog。
|
||
*/
|
||
interface Props {
|
||
rows: WorkflowMeta[];
|
||
endpoints: ComfyEndpoint[];
|
||
}
|
||
|
||
let { rows, endpoints }: Props = $props();
|
||
|
||
const client = useQueryClient();
|
||
|
||
// ------------------------------------------------------------------
|
||
// Category label (S2 stores the key; the label never leaks dir names)
|
||
// ------------------------------------------------------------------
|
||
const CATEGORY_LABELS: Record<string, string> = {
|
||
basic: 'wfCat.basic',
|
||
audio_tts: 'wfCat.audioTts',
|
||
music: 'wfCat.music',
|
||
image: 'wfCat.image',
|
||
video: 'wfCat.video',
|
||
digital_human: 'wfCat.digitalHuman',
|
||
motion_transfer: 'wfCat.motionTransfer',
|
||
};
|
||
function categoryLabel(key: string | null | undefined): string {
|
||
if (!key) return '';
|
||
const k = CATEGORY_LABELS[key];
|
||
return k ? t(k) : key;
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Filters / search / sort
|
||
// ------------------------------------------------------------------
|
||
let search = $state('');
|
||
let kindFilter = $state<'all' | 'image' | 'video'>('all');
|
||
let statusFilter = $state<'all' | 'pending' | 'enabled' | 'disabled'>('all');
|
||
let favOnly = $state(false);
|
||
let catFilter = $state('all');
|
||
let familyFilter = $state('all');
|
||
let mediaFilter = $state('all');
|
||
let sortBy = $state<'recent' | 'name'>('recent');
|
||
let visibleCount = $state(60);
|
||
let searchInput = $state<HTMLInputElement | null>(null);
|
||
|
||
const categories = $derived(
|
||
[...new Set(rows.map((r) => r.category).filter((c): c is string => !!c))].sort(),
|
||
);
|
||
const families = $derived(
|
||
[...new Set(rows.map((r) => r.model_family).filter((f): f is string => !!f))].sort(),
|
||
);
|
||
|
||
const filtered = $derived.by(() => {
|
||
const q = search.trim().toLowerCase();
|
||
let list = rows.filter((r) => {
|
||
if (kindFilter !== 'all' && r.kind !== kindFilter) return false;
|
||
if (favOnly && !r.favorite) return false;
|
||
if (catFilter !== 'all' && (r.category ?? '') !== catFilter) return false;
|
||
if (familyFilter !== 'all' && (r.model_family ?? '') !== familyFilter) return false;
|
||
if (mediaFilter !== 'all') {
|
||
const io = r.media_io ?? { in: [], out: [] };
|
||
if (!io.in.includes(mediaFilter) && !io.out.includes(mediaFilter)) return false;
|
||
}
|
||
if (statusFilter === 'pending' && !r.needs_mapping) return false;
|
||
if (statusFilter === 'enabled' && !r.is_enabled) return false;
|
||
if (statusFilter === 'disabled' && r.is_enabled) return false;
|
||
if (q) {
|
||
const hay = [
|
||
r.name,
|
||
r.description ?? '',
|
||
(r.tags ?? []).join(' '),
|
||
r.model_family ?? '',
|
||
categoryLabel(r.category),
|
||
r.source_path ?? '',
|
||
]
|
||
.join(' ')
|
||
.toLowerCase();
|
||
if (!hay.includes(q)) return false;
|
||
}
|
||
return true;
|
||
});
|
||
if (sortBy === 'name') list = [...list].sort((a, b) => a.name.localeCompare(b.name, 'zh'));
|
||
return list;
|
||
});
|
||
|
||
const visible = $derived(filtered.slice(0, visibleCount));
|
||
|
||
$effect(() => {
|
||
// any filter change collapses the incremental list back to page one
|
||
void search;
|
||
void kindFilter;
|
||
void statusFilter;
|
||
void favOnly;
|
||
void catFilter;
|
||
void familyFilter;
|
||
void mediaFilter;
|
||
void sortBy;
|
||
visibleCount = 60;
|
||
});
|
||
|
||
function resetFilters() {
|
||
search = '';
|
||
kindFilter = 'all';
|
||
statusFilter = 'all';
|
||
favOnly = false;
|
||
catFilter = 'all';
|
||
familyFilter = 'all';
|
||
mediaFilter = 'all';
|
||
}
|
||
|
||
const hasActiveFilter = $derived(
|
||
search.trim() !== '' ||
|
||
kindFilter !== 'all' ||
|
||
statusFilter !== 'all' ||
|
||
favOnly ||
|
||
catFilter !== 'all' ||
|
||
familyFilter !== 'all' ||
|
||
mediaFilter !== 'all',
|
||
);
|
||
|
||
// ------------------------------------------------------------------
|
||
// Selection + batch actions
|
||
// ------------------------------------------------------------------
|
||
let selected = $state<Set<number>>(new Set());
|
||
|
||
const allVisibleSelected = $derived(
|
||
visible.length > 0 && visible.every((r) => selected.has(r.id)),
|
||
);
|
||
|
||
function toggleRow(id: number, on: boolean) {
|
||
const next = new Set(selected);
|
||
if (on) next.add(id);
|
||
else next.delete(id);
|
||
selected = next;
|
||
}
|
||
|
||
function toggleSelectVisible() {
|
||
const next = new Set(selected);
|
||
if (allVisibleSelected) {
|
||
for (const r of visible) next.delete(r.id);
|
||
} else {
|
||
for (const r of visible) next.add(r.id);
|
||
}
|
||
selected = next;
|
||
}
|
||
|
||
let batchPending = $state(false);
|
||
let batchEnableDir = $state<boolean | null>(null);
|
||
let metaDialogOpen = $state(false);
|
||
let metaTargets = $state<WorkflowMeta[]>([]);
|
||
|
||
async function batchSetEnabled(enabled: boolean) {
|
||
batchPending = true;
|
||
batchEnableDir = enabled;
|
||
let done = 0;
|
||
let failed = 0;
|
||
try {
|
||
for (const row of rows) {
|
||
if (!selected.has(row.id)) continue;
|
||
if (row.is_enabled === enabled) {
|
||
done++;
|
||
continue;
|
||
}
|
||
try {
|
||
await workflows.update(row.id, { is_enabled: enabled });
|
||
done++;
|
||
} catch {
|
||
failed++;
|
||
}
|
||
}
|
||
} finally {
|
||
batchPending = false;
|
||
batchEnableDir = null;
|
||
}
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
if (failed === 0) toast.success(t('wl.batchDone', { n: done }));
|
||
else toast.error(t('wl.batchPartial', { n: done, m: failed }));
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Single-row actions (favorite / enable / usage / bind / delete / meta)
|
||
// ------------------------------------------------------------------
|
||
const favMutation = createMutation({
|
||
mutationFn: ({ id, fav }: { id: number; fav: boolean }) =>
|
||
workflows.update(id, { favorite: fav }),
|
||
onSuccess: () => client.invalidateQueries({ queryKey: ['workflows'] }),
|
||
onError: (err) => toast.error(apiErrorMessage(err)),
|
||
});
|
||
|
||
const wfConfirmMutation = createMutation({
|
||
mutationFn: ({ id, usage }: { id: number; usage: WorkflowUsage }) =>
|
||
workflows.update(id, { usage, usage_source: 'user' }),
|
||
onSuccess: (wf) => {
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
toast.success(t('conn.wfConfirmed', { usage: usageLabel(wf.usage) }));
|
||
},
|
||
onError: (err) => toast.error(apiErrorMessage(err)),
|
||
});
|
||
|
||
const wfBindMutation = createMutation({
|
||
mutationFn: ({ id, endpointId }: { id: number; endpointId: string | null }) =>
|
||
workflows.update(id, { endpoint_id: endpointId }),
|
||
onSuccess: () => client.invalidateQueries({ queryKey: ['workflows'] }),
|
||
});
|
||
|
||
const wfDeleteMutation = createMutation({
|
||
mutationFn: (id: number) => workflows.delete(id),
|
||
onSuccess: (_res, id) => {
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
const next = new Set(selected);
|
||
next.delete(id);
|
||
selected = next;
|
||
toast.success(t('conn.wfDeleted'));
|
||
},
|
||
onError: (err) => toast.error(apiErrorMessage(err)),
|
||
});
|
||
|
||
function usageLabel(u: WorkflowUsage | null | undefined): string {
|
||
return u ? t(`usage.${u}`) : t('usage.pending');
|
||
}
|
||
|
||
function openMetaDialog(targetRows: WorkflowMeta[]) {
|
||
metaTargets = targetRows;
|
||
metaDialogOpen = true;
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Lazy full-row loads — the ONLY place full workflow JSON is fetched
|
||
// ------------------------------------------------------------------
|
||
const fullCache = $state<Record<number, Workflow>>({});
|
||
const fullPending = $state<Record<number, boolean>>({});
|
||
|
||
async function ensureFull(id: number): Promise<Workflow | null> {
|
||
if (fullCache[id]) return fullCache[id];
|
||
if (fullPending[id]) return null;
|
||
fullPending[id] = true;
|
||
try {
|
||
const wf = await workflows.get(id);
|
||
fullCache[id] = wf;
|
||
return wf;
|
||
} catch (err) {
|
||
toast.error(apiErrorMessage(err));
|
||
return null;
|
||
} finally {
|
||
delete fullPending[id];
|
||
}
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Test run (reuses WorkflowTestDialog) + L2 recheck
|
||
// ------------------------------------------------------------------
|
||
let testOpen = $state(false);
|
||
let testWf = $state<Workflow | null>(null);
|
||
let openingTestId = $state<number | null>(null);
|
||
|
||
async function openTest(row: WorkflowMeta) {
|
||
openingTestId = row.id;
|
||
const wf = await ensureFull(row.id);
|
||
openingTestId = null;
|
||
if (wf) {
|
||
testWf = wf;
|
||
testOpen = true;
|
||
}
|
||
}
|
||
|
||
let wfRecheckId = $state<number | null>(null);
|
||
type ConnectionCheck = Awaited<ReturnType<typeof workflows.check>>;
|
||
const wfRecheckResult = $state<Record<number, ConnectionCheck>>({});
|
||
|
||
async function recheckRow(row: WorkflowMeta) {
|
||
wfRecheckId = row.id;
|
||
try {
|
||
const res = await workflows.check(row.id, { refresh: true });
|
||
wfRecheckResult[row.id] = res;
|
||
} catch (err) {
|
||
toast.error(apiErrorMessage(err));
|
||
} finally {
|
||
wfRecheckId = null;
|
||
}
|
||
}
|
||
|
||
function recheckLine(row: WorkflowMeta): { tone: 'ok' | 'bad' | 'warn'; text: string } | null {
|
||
const check = wfRecheckResult[row.id];
|
||
if (!check) return null;
|
||
if (!check.reachable) return { tone: 'warn', text: t('conn.wfCheckUnreachable') };
|
||
if (check.ok) return { tone: 'ok', text: t('conn.wfCheckOk') };
|
||
return { tone: 'bad', text: t('conn.wfCheckProblems', { n: check.findings.length }) };
|
||
}
|
||
|
||
function lastTestLine(wf: Workflow | undefined): string | null {
|
||
const lt = wf?.last_test;
|
||
if (!lt) return null;
|
||
if (lt.status === 'done' && lt.output_count > 0) {
|
||
return t('conn.wfTestPassed', { n: lt.output_count, time: formatDbTime(lt.completed_at ?? lt.created_at) });
|
||
}
|
||
if (lt.status === 'pending' || lt.status === 'running') {
|
||
return t('conn.wfTestRunning', { time: formatDbTime(lt.created_at) });
|
||
}
|
||
return t('conn.wfTestFailed', { time: formatDbTime(lt.completed_at ?? lt.created_at) });
|
||
}
|
||
|
||
function formatDbTime(at: string | null): string {
|
||
if (!at) return '—';
|
||
const ts = Date.parse(at.replace(' ', 'T') + 'Z');
|
||
const d = new Date(Number.isFinite(ts) ? ts : at);
|
||
if (Number.isNaN(d.getTime())) return '—';
|
||
const p = (n: number) => String(n).padStart(2, '0');
|
||
return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Output-node designation (HEL-638) — kept, on the lazy full row
|
||
// ------------------------------------------------------------------
|
||
let wfMapEditId = $state<number | null>(null);
|
||
let wfMapPicked = $state<Record<string, boolean>>({});
|
||
let wfMapKind = $state<Record<string, 'image' | 'video'>>({});
|
||
|
||
function rowNeedsOutputMap(row: WorkflowMeta): boolean {
|
||
return row.output_map_source == null;
|
||
}
|
||
|
||
async function toggleWfMapEdit(row: WorkflowMeta) {
|
||
if (wfMapEditId === row.id) {
|
||
wfMapEditId = null;
|
||
return;
|
||
}
|
||
const wf = await ensureFull(row.id);
|
||
if (!wf) return;
|
||
const picked: Record<string, boolean> = {};
|
||
const kinds: Record<string, 'image' | 'video'> = {};
|
||
const mapped = new Map((wf.output_map ?? []).map((e) => [e.nodeId, e.kind]));
|
||
for (const c of (wf.output_schema ?? []).filter((o) => o.evidence === 'unknown_node')) {
|
||
const known = mapped.get(c.nodeId);
|
||
if (known) picked[c.nodeId] = true;
|
||
kinds[c.nodeId] = known ?? c.suggested_kind ?? 'image';
|
||
}
|
||
wfMapPicked = picked;
|
||
wfMapKind = kinds;
|
||
wfMapEditId = row.id;
|
||
}
|
||
|
||
const wfMapMutation = createMutation({
|
||
mutationFn: ({ id, outputMap }: { id: number; outputMap: WorkflowOutputMapEntry[] }) =>
|
||
workflows.update(
|
||
id,
|
||
outputMap.length
|
||
? { output_map: outputMap, output_map_source: 'user' }
|
||
: { output_map: [] },
|
||
),
|
||
onSuccess: (wf) => {
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
if (wf) fullCache[wf.id] = wf;
|
||
wfMapEditId = null;
|
||
const nodes = (wf.output_map ?? []).map((e) => e.nodeId).join('、');
|
||
toast.success(
|
||
wf.output_map?.length
|
||
? t('conn.wfOutputApplied', { nodes })
|
||
: t('conn.wfOutputCleared'),
|
||
);
|
||
},
|
||
onError: (err) => toast.error(apiErrorMessage(err)),
|
||
});
|
||
|
||
function submitWfMap(row: WorkflowMeta) {
|
||
const wf = fullCache[row.id];
|
||
if (!wf || $wfMapMutation.isPending) return;
|
||
const outputMap = (wf.output_schema ?? [])
|
||
.filter((o) => o.evidence === 'unknown_node')
|
||
.filter((c) => wfMapPicked[c.nodeId])
|
||
.map((c) => ({
|
||
nodeId: c.nodeId,
|
||
kind: wfMapKind[c.nodeId] ?? c.suggested_kind ?? 'image',
|
||
label: c.label,
|
||
...(c.class_type ? { class_type: c.class_type } : {}),
|
||
}));
|
||
$wfMapMutation.mutate({ id: row.id, outputMap });
|
||
}
|
||
|
||
// ------------------------------------------------------------------
|
||
// Import wizards + dedupe
|
||
// ------------------------------------------------------------------
|
||
let batchOpen = $state(false);
|
||
let singleOpen = $state(false);
|
||
|
||
let dedupeOpen = $state(false);
|
||
const dedupeMutation = createMutation({
|
||
mutationFn: () => workflows.dedupe(),
|
||
onSuccess: (res) => {
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
toast.success(res.removed > 0 ? t('wl.dedupeDone', { n: res.removed }) : t('wl.dedupeNone'));
|
||
},
|
||
onError: (err) => toast.error(apiErrorMessage(err)),
|
||
onSettled: () => (dedupeOpen = false),
|
||
});
|
||
|
||
const anyOverlay = $derived(batchOpen || singleOpen || testOpen || metaDialogOpen);
|
||
|
||
function onWindowKeydown(e: KeyboardEvent) {
|
||
if (e.key !== '/') return;
|
||
const el = e.target as HTMLElement | null;
|
||
if (
|
||
el &&
|
||
(el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT' || el.isContentEditable)
|
||
) {
|
||
return;
|
||
}
|
||
if (anyOverlay) return;
|
||
e.preventDefault();
|
||
searchInput?.focus();
|
||
}
|
||
|
||
function mediaIcon(kind: string): 'image' | 'film' | 'music' {
|
||
if (kind === 'video') return 'film';
|
||
if (kind === 'audio') return 'music';
|
||
return 'image';
|
||
}
|
||
|
||
function mediaTitle(kind: string): string {
|
||
if (kind === 'video') return t('wl.mediaVideo');
|
||
if (kind === 'audio') return t('wl.mediaAudio');
|
||
return t('wl.mediaImage');
|
||
}
|
||
|
||
const pendingCount = $derived(rows.filter((r) => !r.usage).length);
|
||
const favCount = $derived(rows.filter((r) => r.favorite).length);
|
||
</script>
|
||
|
||
<svelte:window onkeydown={onWindowKeydown} />
|
||
|
||
<section class="wf-panel" id="wf-library">
|
||
<div class="panel-head">
|
||
<h2>{t('conn.wfTitle')}</h2>
|
||
<span class="panel-hint">{t('wl.hint')}</span>
|
||
<span class="panel-actions">
|
||
<Button variant="secondary" size="sm" onclick={() => (singleOpen = true)}>
|
||
<Icon name="upload" size={13} />
|
||
{t('conn.wfImportAction')}
|
||
</Button>
|
||
<Button variant="secondary" size="sm" onclick={() => (dedupeOpen = true)}>
|
||
<Icon name="copy" size={13} />
|
||
{t('wl.dedupe')}
|
||
</Button>
|
||
<Button variant="primary" size="sm" onclick={() => (batchOpen = true)}>
|
||
<Icon name="folder" size={13} />
|
||
{t('wl.batchImport')}
|
||
</Button>
|
||
</span>
|
||
</div>
|
||
|
||
{#if rows.length === 0}
|
||
<EmptyState title={t('conn.wfEmpty')} />
|
||
<p class="missing-note">{t('conn.missingMaterial')}</p>
|
||
{:else}
|
||
<p class="wf-count">
|
||
{t('conn.wfCount', {
|
||
n: rows.length,
|
||
m: rows.filter((r) => r.kind === 'image').length,
|
||
k: rows.filter((r) => r.kind === 'video').length,
|
||
})}
|
||
{#if pendingCount}
|
||
<span class="wf-pending-note">· {t('conn.wfPendingCount', { n: pendingCount })}</span>
|
||
{/if}
|
||
{#if favCount}
|
||
<span class="wf-pending-note">· {t('wl.favCount', { n: favCount })}</span>
|
||
{/if}
|
||
</p>
|
||
|
||
<div class="wl-toolbar">
|
||
<div class="wl-search-wrap">
|
||
<Icon name="search" size={14} />
|
||
<input
|
||
bind:this={searchInput}
|
||
class="a-input wl-search"
|
||
value={search}
|
||
oninput={(e) => (search = e.currentTarget.value)}
|
||
placeholder={t('wl.searchPh')}
|
||
aria-label={t('wl.searchPh')}
|
||
/>
|
||
<span class="a-kbd">/</span>
|
||
</div>
|
||
<div class="wl-filters" role="group" aria-label={t('wl.filterLabel')}>
|
||
<button type="button" class="a-chip" class:sel={kindFilter === 'all'} aria-pressed={kindFilter === 'all'} onclick={() => (kindFilter = 'all')}>
|
||
<span class="lbl">{t('wl.filterAll')}</span>
|
||
</button>
|
||
<button type="button" class="a-chip" class:sel={kindFilter === 'image'} aria-pressed={kindFilter === 'image'} onclick={() => (kindFilter = 'image')}>
|
||
<span class="lbl">{t('conn.wfKindImage')}</span>
|
||
<span class="chip-count">{rows.filter((r) => r.kind === 'image').length}</span>
|
||
</button>
|
||
<button type="button" class="a-chip" class:sel={kindFilter === 'video'} aria-pressed={kindFilter === 'video'} onclick={() => (kindFilter = 'video')}>
|
||
<span class="lbl">{t('conn.wfKindVideo')}</span>
|
||
<span class="chip-count">{rows.filter((r) => r.kind === 'video').length}</span>
|
||
</button>
|
||
<button type="button" class="a-chip" class:sel={favOnly} aria-pressed={favOnly} onclick={() => (favOnly = !favOnly)} title={t('wl.favAria')}>
|
||
<Icon name="star" size={12} />
|
||
<span class="lbl">{t('wl.filterFav')}</span>
|
||
<span class="chip-count">{favCount}</span>
|
||
</button>
|
||
<button type="button" class="a-chip" class:sel={statusFilter === 'pending'} aria-pressed={statusFilter === 'pending'} onclick={() => (statusFilter = statusFilter === 'pending' ? 'all' : 'pending')}>
|
||
<span class="lbl">{t('wl.filterPending')}</span>
|
||
<span class="chip-count">{rows.filter((r) => r.needs_mapping).length}</span>
|
||
</button>
|
||
<button type="button" class="a-chip" class:sel={statusFilter === 'disabled'} aria-pressed={statusFilter === 'disabled'} onclick={() => (statusFilter = statusFilter === 'disabled' ? 'all' : 'disabled')}>
|
||
<span class="lbl">{t('wl.filterDisabled')}</span>
|
||
</button>
|
||
</div>
|
||
<div class="wl-selects">
|
||
<select class="a-select" aria-label={t('wl.categoryLabel')} value={catFilter} onchange={(e) => (catFilter = e.currentTarget.value)}>
|
||
<option value="all">{t('wl.categoryAll')}{categories.length ? ` (${categories.length})` : ''}</option>
|
||
{#each categories as c (c)}
|
||
<option value={c}>{categoryLabel(c)}</option>
|
||
{/each}
|
||
</select>
|
||
<select class="a-select" aria-label={t('wl.familyLabel')} value={familyFilter} onchange={(e) => (familyFilter = e.currentTarget.value)}>
|
||
<option value="all">{t('wl.familyAll')}{families.length ? ` (${families.length})` : ''}</option>
|
||
{#each families as f (f)}
|
||
<option value={f}>{f}</option>
|
||
{/each}
|
||
</select>
|
||
<select class="a-select" aria-label={t('wl.mediaLabel')} value={mediaFilter} onchange={(e) => (mediaFilter = e.currentTarget.value)}>
|
||
<option value="all">{t('wl.mediaAll')}</option>
|
||
<option value="image">{t('wl.mediaImage')}</option>
|
||
<option value="video">{t('wl.mediaVideo')}</option>
|
||
<option value="audio">{t('wl.mediaAudio')}</option>
|
||
</select>
|
||
<select class="a-select" aria-label={t('wl.sortLabel')} value={sortBy} onchange={(e) => (sortBy = e.currentTarget.value as 'recent' | 'name')}>
|
||
<option value="recent">{t('wl.sortRecent')}</option>
|
||
<option value="name">{t('wl.sortName')}</option>
|
||
</select>
|
||
{#if hasActiveFilter}
|
||
<button type="button" class="a-btn ghost sm" onclick={resetFilters}>{t('wl.resetFilters')}</button>
|
||
{/if}
|
||
</div>
|
||
</div>
|
||
|
||
{#if filtered.length === 0}
|
||
<EmptyState title={t('wl.noMatch')} />
|
||
{:else}
|
||
<p class="wl-result-count">{t('wl.resultCount', { n: filtered.length, m: rows.length })}</p>
|
||
|
||
{#if selected.size > 0}
|
||
<div class="wl-batchbar" role="toolbar" aria-label={t('wl.batchLabel')}>
|
||
<span class="wl-batch-n">{t('wl.selected', { n: selected.size })}</span>
|
||
<Button variant="secondary" size="sm" disabled={batchPending} onclick={() => openMetaDialog(rows.filter((r) => selected.has(r.id)))}>
|
||
<Icon name="edit" size={13} />
|
||
{t('wl.batchAnnotate')}
|
||
</Button>
|
||
<Button variant="secondary" size="sm" loading={batchPending && batchEnableDir === true} disabled={batchPending} onclick={() => void batchSetEnabled(true)}>
|
||
{t('wl.batchEnable')}
|
||
</Button>
|
||
<Button variant="secondary" size="sm" loading={batchPending && batchEnableDir === false} disabled={batchPending} onclick={() => void batchSetEnabled(false)}>
|
||
{t('wl.batchDisable')}
|
||
</Button>
|
||
<Button variant="ghost" size="sm" disabled={batchPending} onclick={() => (selected = new Set())}>
|
||
{t('wl.clearSel')}
|
||
</Button>
|
||
</div>
|
||
{/if}
|
||
|
||
<div class="wl-headrow">
|
||
<input
|
||
type="checkbox"
|
||
class="wl-check"
|
||
aria-label={t('wl.selectAll')}
|
||
checked={allVisibleSelected}
|
||
onchange={() => toggleSelectVisible()}
|
||
/>
|
||
<span class="wl-head-name">{t('common.name')}</span>
|
||
<span class="wl-head-meta">{t('wl.headMeta')}</span>
|
||
<span class="wl-head-actions">{t('wl.headActions')}</span>
|
||
</div>
|
||
|
||
<div class="wf-table">
|
||
{#each visible as row (row.id)}
|
||
{@const full = fullCache[row.id]}
|
||
<div class="wf-row" class:pending={!row.usage} class:sel={selected.has(row.id)}>
|
||
<input
|
||
type="checkbox"
|
||
class="wl-check"
|
||
aria-label={t('wl.rowCheckAria', { name: row.name })}
|
||
checked={selected.has(row.id)}
|
||
onchange={(e) => toggleRow(row.id, e.currentTarget.checked)}
|
||
/>
|
||
<span class="wf-kind {row.kind}">
|
||
<Icon name={row.kind === 'image' ? 'image' : 'film'} size={14} />
|
||
</span>
|
||
<button
|
||
type="button"
|
||
class="wl-fav"
|
||
class:on={row.favorite}
|
||
aria-pressed={row.favorite}
|
||
aria-label={row.favorite ? t('wl.unfavAria') : t('wl.favAria')}
|
||
title={row.favorite ? t('wl.unfavAria') : t('wl.favAria')}
|
||
onclick={() => $favMutation.mutate({ id: row.id, fav: !row.favorite })}
|
||
>
|
||
<Icon name="star" size={14} />
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="wf-name"
|
||
title={row.description ?? row.name}
|
||
onclick={() => openMetaDialog([row])}
|
||
>
|
||
{row.name}
|
||
</button>
|
||
{#if row.category}
|
||
<span class="tag tag-cat">{categoryLabel(row.category)}</span>
|
||
{/if}
|
||
{#if row.model_family}
|
||
<span class="tag tag-family">{row.model_family}</span>
|
||
{/if}
|
||
{#if (row.media_io?.in ?? []).length || (row.media_io?.out ?? []).length}
|
||
<span class="wl-media" aria-hidden="true">
|
||
{#each row.media_io.in as m (m)}
|
||
<span class="wl-m" title="{t('wl.mediaIn')}:{mediaTitle(m)}"><Icon name={mediaIcon(m)} size={12} /></span>
|
||
{/each}
|
||
{#if (row.media_io.out ?? []).length}
|
||
<span class="wl-arrow">→</span>
|
||
{#each row.media_io.out as m (m)}
|
||
<span class="wl-m" title="{t('wl.mediaOut')}:{mediaTitle(m)}"><Icon name={mediaIcon(m)} size={12} /></span>
|
||
{/each}
|
||
{/if}
|
||
</span>
|
||
{/if}
|
||
{#if row.usage}
|
||
<span
|
||
class="tag tag-usage"
|
||
title={row.usage_source === 'user' ? t('conn.wfSourceUser') : t('conn.wfSourceAuto')}
|
||
>
|
||
{usageLabel(row.usage)}
|
||
</span>
|
||
{:else}
|
||
<select
|
||
class="a-select wf-confirm-select"
|
||
aria-label={t('conn.wfConfirmAria')}
|
||
disabled={$wfConfirmMutation.isPending}
|
||
onchange={(e) => {
|
||
const usage = e.currentTarget.value as WorkflowUsage;
|
||
if (usage) $wfConfirmMutation.mutate({ id: row.id, usage });
|
||
e.currentTarget.value = '';
|
||
}}
|
||
>
|
||
<option value="">{t('usage.pending')}…</option>
|
||
{#each WORKFLOW_USAGES as u (u)}
|
||
<option value={u}>{usageLabel(u)}</option>
|
||
{/each}
|
||
</select>
|
||
{/if}
|
||
{#if rowNeedsOutputMap(row)}
|
||
<button
|
||
type="button"
|
||
class="tag tag-mapbtn"
|
||
class:open={wfMapEditId === row.id}
|
||
title={t('conn.wfOutputNeedMap')}
|
||
onclick={() => void toggleWfMapEdit(row)}
|
||
>
|
||
<Icon name="alert" size={12} />
|
||
{t('conn.wfOutputPendingBadge')}
|
||
</button>
|
||
{/if}
|
||
{#if !row.is_enabled && row.usage && !rowNeedsOutputMap(row)}
|
||
<span class="tag tag-disabled">{t('conn.wfDisabledBadge')}</span>
|
||
{/if}
|
||
{#if full && (full.warnings ?? []).some((w) => w.level === 'error')}
|
||
<span class="tag tag-error" title={(full.warnings ?? []).filter((w) => w.level === 'error').map((w) => w.message).join('\n')}>
|
||
{t('conn.wfBrokenBadge')}
|
||
</span>
|
||
{/if}
|
||
|
||
<span class="wf-acts">
|
||
<Switch
|
||
checked={row.is_enabled}
|
||
label={t('wl.enableAria', { name: row.name })}
|
||
disabled={!row.usage || rowNeedsOutputMap(row)}
|
||
onchange={(next) => {
|
||
if (next) void workflows.update(row.id, { is_enabled: true }).then(
|
||
() => client.invalidateQueries({ queryKey: ['workflows'] }),
|
||
(err) => toast.error(apiErrorMessage(err)),
|
||
);
|
||
else void workflows.update(row.id, { is_enabled: false }).then(
|
||
() => client.invalidateQueries({ queryKey: ['workflows'] }),
|
||
(err) => toast.error(apiErrorMessage(err)),
|
||
);
|
||
}}
|
||
/>
|
||
{#if !row.usage || rowNeedsOutputMap(row)}
|
||
<span class="wl-switch-hint" title={t('wl.enableBlocked')}>?</span>
|
||
{/if}
|
||
<button
|
||
type="button"
|
||
class="link-accent wf-test-btn"
|
||
title={t('wft.title')}
|
||
disabled={openingTestId === row.id}
|
||
onclick={() => void openTest(row)}
|
||
>
|
||
<Icon name="play" size={13} />
|
||
{openingTestId === row.id ? t('common.loading') : t('conn.wfTestBtn')}
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="link-accent wf-test-btn"
|
||
disabled={wfRecheckId === row.id}
|
||
title={t('conn.wfCheckBtn')}
|
||
onclick={() => void recheckRow(row)}
|
||
>
|
||
<Icon name="retry" size={13} />
|
||
{wfRecheckId === row.id ? t('conn.wfChecking') : t('conn.wfCheckBtn')}
|
||
</button>
|
||
<select
|
||
class="a-select"
|
||
aria-label={t('conn.wfConnection')}
|
||
value={row.endpoint_id ?? ''}
|
||
onchange={(e) =>
|
||
$wfBindMutation.mutate({
|
||
id: row.id,
|
||
endpointId: e.currentTarget.value || null,
|
||
})}
|
||
>
|
||
<option value="">{t('conn.wfConnectionActive')}</option>
|
||
{#each endpoints as ep (ep.id)}
|
||
<option value={ep.id}>{ep.name}</option>
|
||
{/each}
|
||
</select>
|
||
<button
|
||
type="button"
|
||
class="link-accent wf-test-btn"
|
||
title={t('wl.editMeta')}
|
||
onclick={() => openMetaDialog([row])}
|
||
>
|
||
<Icon name="edit" size={13} />
|
||
{t('wl.editMeta')}
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="link-danger"
|
||
title={t('common.delete')}
|
||
onclick={() => $wfDeleteMutation.mutate(row.id)}
|
||
>
|
||
<Icon name="trash" size={14} />
|
||
</button>
|
||
</span>
|
||
</div>
|
||
{@const lastLine = lastTestLine(full)}
|
||
{@const used = row.last_used_at ? `${t('wl.lastUsed')}:${formatDbTime(row.last_used_at)}` : null}
|
||
{@const recheck = recheckLine(row)}
|
||
{#if lastLine || used || recheck}
|
||
<div class="wf-meta-row">
|
||
{#if used}<span class="wf-meta-item">{used}</span>{/if}
|
||
{#if lastLine}<span class="wf-meta-item">{t('conn.wfLastTest')}:{lastLine}</span>{/if}
|
||
{#if recheck}
|
||
<span class="wf-meta-item recheck" class:ok={recheck.tone === 'ok'} class:bad={recheck.tone === 'bad'} class:warn={recheck.tone === 'warn'}>
|
||
<span class="wf-recheck-text">{recheck.text}</span>
|
||
</span>
|
||
{/if}
|
||
</div>
|
||
{/if}
|
||
{#if wfMapEditId === row.id && full}
|
||
<div class="wf-map-editor">
|
||
<p class="wf-map-hint">{t('conn.wfOutputHint')}</p>
|
||
<div class="wf-slot-rows">
|
||
{#each (full.output_schema ?? []).filter((o) => o.evidence === 'unknown_node') as c (c.nodeId)}
|
||
<div class="wf-slot-row" class:off={!wfMapPicked[c.nodeId]}>
|
||
<label class="wf-out-check">
|
||
<input
|
||
type="checkbox"
|
||
checked={wfMapPicked[c.nodeId] ?? false}
|
||
onchange={(e) =>
|
||
(wfMapPicked = {
|
||
...wfMapPicked,
|
||
[c.nodeId]: e.currentTarget.checked,
|
||
})}
|
||
/>
|
||
<span class="wf-slot-id mono">{c.nodeId}</span>
|
||
<span class="wf-slot-name" title={c.class_type}>{c.label}</span>
|
||
</label>
|
||
<select
|
||
class="a-select"
|
||
aria-label={t('conn.wfOutputKindAria')}
|
||
disabled={!wfMapPicked[c.nodeId]}
|
||
value={wfMapKind[c.nodeId] ?? c.suggested_kind ?? 'image'}
|
||
onchange={(e) =>
|
||
(wfMapKind = {
|
||
...wfMapKind,
|
||
[c.nodeId]: e.currentTarget.value as 'image' | 'video',
|
||
})}
|
||
>
|
||
<option value="image">{t('conn.wfKindImage')}</option>
|
||
<option value="video">{t('conn.wfKindVideo')}</option>
|
||
</select>
|
||
</div>
|
||
{/each}
|
||
</div>
|
||
<div class="form-actions">
|
||
<Button variant="secondary" size="sm" onclick={() => (wfMapEditId = null)}>
|
||
{t('conn.wfMapCancel')}
|
||
</Button>
|
||
<Button
|
||
variant="primary"
|
||
size="sm"
|
||
disabled={!Object.values(wfMapPicked).some(Boolean)}
|
||
loading={$wfMapMutation.isPending}
|
||
onclick={() => submitWfMap(row)}
|
||
>
|
||
{t('conn.wfOutputApply')}
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
{/if}
|
||
{/each}
|
||
</div>
|
||
{#if filtered.length > visibleCount}
|
||
<button type="button" class="a-btn ghost wl-more" onclick={() => (visibleCount += 100)}>
|
||
{t('wl.moreCount', { n: Math.min(100, filtered.length - visibleCount), m: filtered.length })}
|
||
</button>
|
||
{/if}
|
||
{/if}
|
||
{/if}
|
||
</section>
|
||
|
||
<WorkflowBatchImportWizard
|
||
bind:open={batchOpen}
|
||
{endpoints}
|
||
onimported={() => client.invalidateQueries({ queryKey: ['workflows'] })}
|
||
/>
|
||
<WorkflowImportDrawer
|
||
bind:open={singleOpen}
|
||
{endpoints}
|
||
onchanged={() => client.invalidateQueries({ queryKey: ['workflows'] })}
|
||
/>
|
||
<WorkflowTestDialog
|
||
bind:open={testOpen}
|
||
workflow={testWf}
|
||
{endpoints}
|
||
onchanged={() => {
|
||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||
if (testWf) {
|
||
delete fullCache[testWf.id];
|
||
void ensureFull(testWf.id);
|
||
}
|
||
}}
|
||
/>
|
||
<WorkflowMetaDialog
|
||
bind:open={metaDialogOpen}
|
||
targets={metaTargets}
|
||
{categories}
|
||
{families}
|
||
/>
|
||
|
||
<ConfirmDialog
|
||
bind:open={dedupeOpen}
|
||
title={t('wl.dedupeTitle')}
|
||
message={t('wl.dedupeConfirm')}
|
||
confirmLabel={t('wl.dedupe')}
|
||
danger
|
||
onconfirm={() => $dedupeMutation.mutate()}
|
||
/>
|
||
|
||
<style>
|
||
.wf-panel {
|
||
background: var(--surface);
|
||
border: 1px solid var(--border);
|
||
border-radius: 10px;
|
||
padding: 18px 20px;
|
||
}
|
||
.panel-head {
|
||
display: flex;
|
||
align-items: baseline;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
margin-bottom: 14px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.panel-head h2 {
|
||
margin: 0;
|
||
font-size: 14.5px;
|
||
font-weight: 600;
|
||
color: var(--text);
|
||
}
|
||
.panel-hint {
|
||
font-size: 11.5px;
|
||
color: var(--text-3);
|
||
}
|
||
.panel-actions {
|
||
display: inline-flex;
|
||
gap: 8px;
|
||
}
|
||
.wf-count {
|
||
margin: 0 0 10px;
|
||
font-size: 11.5px;
|
||
color: var(--text-3);
|
||
}
|
||
.wf-pending-note {
|
||
color: var(--warn);
|
||
}
|
||
.missing-note {
|
||
margin: 10px 0 0;
|
||
font-size: 11.5px;
|
||
color: var(--text-3);
|
||
border-left: 2px solid var(--accent);
|
||
padding-left: 10px;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
/* ---------------- toolbar ---------------- */
|
||
.wl-toolbar {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
margin-bottom: 10px;
|
||
}
|
||
.wl-search-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
color: var(--text-3);
|
||
}
|
||
.wl-search-wrap :global(.icon) {
|
||
flex-shrink: 0;
|
||
}
|
||
.wl-search {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
.wl-filters {
|
||
display: flex;
|
||
gap: 6px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.wl-selects {
|
||
display: flex;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
}
|
||
.wl-selects .a-select {
|
||
width: auto;
|
||
min-width: 120px;
|
||
font-size: 12px;
|
||
}
|
||
.wl-result-count {
|
||
margin: 0 0 8px;
|
||
font-size: 11px;
|
||
color: var(--text-3);
|
||
}
|
||
|
||
/* ---------------- batch bar ---------------- */
|
||
.wl-batchbar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
padding: 8px 10px;
|
||
margin-bottom: 8px;
|
||
border-radius: 8px;
|
||
border: 1px dashed var(--accent);
|
||
background: var(--accent-dim);
|
||
}
|
||
.wl-batch-n {
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: var(--accent);
|
||
margin-right: 4px;
|
||
}
|
||
|
||
/* ---------------- head row + list ---------------- */
|
||
.wl-headrow {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 4px 10px 8px;
|
||
border-bottom: 1px solid var(--border);
|
||
font-size: 10.5px;
|
||
font-weight: 600;
|
||
color: var(--text-3);
|
||
letter-spacing: 0.04em;
|
||
}
|
||
.wl-headrow .wl-check {
|
||
margin-top: 0;
|
||
}
|
||
.wl-head-name {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
.wl-head-meta,
|
||
.wl-head-actions {
|
||
flex-shrink: 0;
|
||
}
|
||
.wl-head-actions {
|
||
margin-left: auto;
|
||
}
|
||
.wf-table {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
margin-top: 6px;
|
||
}
|
||
.wf-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 8px 10px;
|
||
border-radius: 8px;
|
||
transition: background-color 150ms;
|
||
}
|
||
.wf-row:hover {
|
||
background: var(--surface-2);
|
||
}
|
||
.wf-row.sel {
|
||
background: var(--accent-dim);
|
||
}
|
||
.wl-check {
|
||
flex-shrink: 0;
|
||
accent-color: var(--accent);
|
||
}
|
||
.wf-kind {
|
||
width: 28px;
|
||
height: 28px;
|
||
border-radius: 7px;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
}
|
||
.wf-kind.image,
|
||
.wf-kind.video {
|
||
color: var(--text-2);
|
||
background: var(--bg-4);
|
||
}
|
||
.wl-fav {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 26px;
|
||
height: 26px;
|
||
border: none;
|
||
border-radius: 7px;
|
||
background: transparent;
|
||
color: var(--text-3);
|
||
cursor: pointer;
|
||
flex-shrink: 0;
|
||
padding: 0;
|
||
}
|
||
.wl-fav:hover {
|
||
background: var(--surface-3);
|
||
color: var(--text);
|
||
}
|
||
.wl-fav:focus-visible {
|
||
outline: 2px solid var(--accent);
|
||
outline-offset: 1px;
|
||
}
|
||
.wl-fav.on {
|
||
color: var(--accent);
|
||
}
|
||
.wl-fav.on :global(svg) {
|
||
fill: var(--accent);
|
||
}
|
||
.wf-name {
|
||
flex: 1;
|
||
min-width: 120px;
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: var(--text);
|
||
background: none;
|
||
border: none;
|
||
padding: 2px 4px;
|
||
font-family: inherit;
|
||
text-align: left;
|
||
cursor: text;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
border-radius: 4px;
|
||
}
|
||
.wf-name:hover {
|
||
color: var(--accent);
|
||
}
|
||
.wf-name:focus-visible {
|
||
outline: 2px solid var(--accent);
|
||
outline-offset: 1px;
|
||
}
|
||
.wf-row.pending .wf-name {
|
||
color: var(--text-3);
|
||
}
|
||
.tag {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
padding: 2px 9px;
|
||
border-radius: 999px;
|
||
font-size: 10.5px;
|
||
font-weight: 600;
|
||
flex-shrink: 0;
|
||
}
|
||
.tag-cat,
|
||
.tag-family,
|
||
.tag-usage {
|
||
color: var(--text-2);
|
||
background: var(--bg-4);
|
||
}
|
||
.tag-family {
|
||
font-family: var(--mono, monospace);
|
||
font-weight: 500;
|
||
}
|
||
.tag-disabled {
|
||
color: var(--text-3);
|
||
background: var(--surface-3);
|
||
}
|
||
.tag-error {
|
||
color: var(--error);
|
||
background: var(--error-dim);
|
||
}
|
||
.tag-mapbtn {
|
||
cursor: pointer;
|
||
color: var(--error);
|
||
background: var(--error-dim);
|
||
border: 1px solid transparent;
|
||
}
|
||
.tag-mapbtn.open {
|
||
color: var(--accent);
|
||
background: var(--accent-dim);
|
||
border-color: var(--accent);
|
||
}
|
||
.wl-media {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 3px;
|
||
color: var(--text-3);
|
||
flex-shrink: 0;
|
||
}
|
||
.wl-m {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
}
|
||
.wl-arrow {
|
||
font-size: 10px;
|
||
}
|
||
.wf-acts {
|
||
margin-left: auto;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
flex-shrink: 0;
|
||
flex-wrap: wrap;
|
||
justify-content: flex-end;
|
||
}
|
||
.wl-switch-hint {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 14px;
|
||
height: 14px;
|
||
border-radius: 50%;
|
||
border: 1px solid var(--border-strong);
|
||
font-size: 9px;
|
||
color: var(--text-3);
|
||
cursor: help;
|
||
}
|
||
.wf-test-btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
white-space: nowrap;
|
||
}
|
||
.wf-test-btn:disabled {
|
||
opacity: 0.6;
|
||
cursor: default;
|
||
}
|
||
.wf-row .a-select {
|
||
width: 180px;
|
||
font-size: 12px;
|
||
}
|
||
.wf-confirm-select {
|
||
max-width: 150px;
|
||
font-size: 11px;
|
||
}
|
||
.wf-row .link-danger {
|
||
background: none;
|
||
border: none;
|
||
padding: 5px 8px;
|
||
font-family: inherit;
|
||
font-size: 12px;
|
||
color: var(--error);
|
||
cursor: pointer;
|
||
border-radius: 6px;
|
||
opacity: 0.85;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
}
|
||
.wf-row .link-danger:hover:not(:disabled) {
|
||
opacity: 1;
|
||
background: var(--error-dim);
|
||
}
|
||
.link-accent {
|
||
background: none;
|
||
border: none;
|
||
padding: 0;
|
||
font-family: inherit;
|
||
font-size: 12px;
|
||
color: var(--text-2);
|
||
cursor: pointer;
|
||
}
|
||
.link-accent:hover {
|
||
color: var(--text);
|
||
}
|
||
|
||
/* ---------------- meta rows / map editor ---------------- */
|
||
.wf-meta-row {
|
||
display: flex;
|
||
gap: 14px;
|
||
flex-wrap: wrap;
|
||
padding: 0 10px 8px;
|
||
margin-top: -2px;
|
||
}
|
||
.wf-meta-item {
|
||
font-size: 10.5px;
|
||
color: var(--text-3);
|
||
}
|
||
.wf-meta-item.recheck .wf-recheck-text {
|
||
color: var(--text-3);
|
||
}
|
||
.wf-meta-item.recheck.ok .wf-recheck-text {
|
||
color: var(--success);
|
||
}
|
||
.wf-meta-item.recheck.bad .wf-recheck-text {
|
||
color: var(--error);
|
||
}
|
||
.wf-meta-item.recheck.warn .wf-recheck-text {
|
||
color: var(--warn);
|
||
}
|
||
.wf-map-editor {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
padding: 10px 12px;
|
||
margin: 2px 0 6px;
|
||
border-radius: 7px;
|
||
border: 1px dashed var(--border);
|
||
background: var(--surface);
|
||
}
|
||
.wf-map-hint {
|
||
margin: 0;
|
||
font-size: 11.5px;
|
||
color: var(--text-3);
|
||
}
|
||
.wf-slot-rows {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 5px;
|
||
}
|
||
.wf-slot-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 5px 8px;
|
||
border-radius: 7px;
|
||
background: var(--surface-2);
|
||
border: 1px solid var(--border);
|
||
}
|
||
.wf-slot-id {
|
||
font-size: 10.5px;
|
||
color: var(--text-3);
|
||
min-width: 64px;
|
||
}
|
||
.wf-slot-name {
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: 12px;
|
||
color: var(--text);
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
.wf-slot-row .a-select {
|
||
width: 130px;
|
||
}
|
||
.wf-slot-row.off {
|
||
opacity: 0.55;
|
||
}
|
||
.wf-out-check {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex: 1;
|
||
min-width: 0;
|
||
cursor: pointer;
|
||
}
|
||
.wf-out-check input[type='checkbox'] {
|
||
accent-color: var(--accent);
|
||
}
|
||
.wf-map-editor .form-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
gap: 8px;
|
||
}
|
||
.wl-more {
|
||
margin-top: 10px;
|
||
width: 100%;
|
||
}
|
||
|
||
@media (max-width: 1023px) {
|
||
.wf-row {
|
||
flex-wrap: wrap;
|
||
}
|
||
.wf-name {
|
||
flex-basis: 100%;
|
||
order: 5;
|
||
}
|
||
.wf-row .a-select {
|
||
flex: 1;
|
||
min-width: 160px;
|
||
}
|
||
.wf-acts {
|
||
width: 100%;
|
||
justify-content: flex-start;
|
||
}
|
||
}
|
||
</style>
|