feat(export-import): add yaml export/import with id upsert for credentials, snippets, and scenarios
- all entities export a kind field (credential/snippet/scenario) for safe type checking on import - import upserts by id: overwrites if id exists, creates with explicit id otherwise - scenario export now includes id and step ids; import deletes old steps before recreating - add GET /:id/export and POST /import endpoints to credential and snippet controllers - add UuidBadge ui component: shortens uuid to first+last 4 hex chars, tooltip, clipboard copy with animated ClipboardCheck icon pop - apply UuidBadge across all entity id display sites (detail pages, card footers, table columns) - add export/import buttons to CredentialsPage, SnippetsPage, CredentialDetailPage, SnippetDetailPage
This commit is contained in:
1 parent
1164289173
commit
32be7c0a59
54 files changed
+728
-272
No files matched your search
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { runs } from '../../api';
|
||||
import type { ScenarioRun, ScenarioRunStep, ScenarioRunStatus } from '../../api';
|
||||
import { AutoRefreshIndicator, Badge, Table, Timestamp, type TableColumn } from '../../ui';
|
||||
import { AutoRefreshIndicator, Badge, Table, Timestamp, UuidBadge, type TableColumn } from '../../ui';
|
||||
import type { BadgeVariant } from '../../ui';
|
||||
import styles from '../Page.module.css';
|
||||
|
||||
@@ -57,7 +57,7 @@ export function AllRunsPage() {
|
||||
}, []);
|
||||
|
||||
const columns: TableColumn<AllRunRow>[] = [
|
||||
{ key: 'id', header: t('runs.col_id'), render: (r) => r.id, width: 60 },
|
||||
{ key: 'id', header: t('runs.col_id'), render: (r) => <UuidBadge id={r.id} />, width: 60 },
|
||||
{
|
||||
key: 'scenario',
|
||||
header: t('runs.col_scenario'),
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
Notification,
|
||||
Table,
|
||||
Timestamp,
|
||||
UuidBadge,
|
||||
type TableColumn,
|
||||
} from '../../ui';
|
||||
import type { BadgeVariant } from '../../ui';
|
||||
@@ -82,7 +83,7 @@ export function RunDetailPage() {
|
||||
if (!id || !runId) return;
|
||||
let cancelled = false;
|
||||
|
||||
Promise.all([scenarios.get(Number(id)), runs.get(Number(id), Number(runId))])
|
||||
Promise.all([scenarios.get(id), runs.get(id, runId)])
|
||||
.then(([sc, r]) => {
|
||||
if (cancelled) return;
|
||||
setScenario(sc);
|
||||
@@ -91,7 +92,7 @@ export function RunDetailPage() {
|
||||
setPolling(true);
|
||||
pollRef.current = setInterval(async () => {
|
||||
try {
|
||||
const updated = await runs.get(Number(id), Number(runId));
|
||||
const updated = await runs.get(id, runId);
|
||||
if (cancelled) return;
|
||||
setRun(updated);
|
||||
setPulseKey((k) => k + 1);
|
||||
@@ -183,7 +184,7 @@ export function RunDetailPage() {
|
||||
<DescriptionList
|
||||
layout="comfortable"
|
||||
items={[
|
||||
{ term: t('runs.field_id'), detail: run.id },
|
||||
{ term: t('runs.field_id'), detail: <UuidBadge id={run.id} /> },
|
||||
{
|
||||
term: t('runs.field_status'),
|
||||
detail: (
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Play } from 'lucide-react';
|
||||
import { scenarios, runs } from '../../api';
|
||||
import type { Scenario, ScenarioRun, ScenarioRunStep, ScenarioRunStatus } from '../../api';
|
||||
import { AutoRefreshIndicator, Badge, Breadcrumbs, Button, Table, Timestamp, type TableColumn } from '../../ui';
|
||||
import { AutoRefreshIndicator, Badge, Breadcrumbs, Button, Table, Timestamp, UuidBadge, type TableColumn } from '../../ui';
|
||||
import type { BadgeVariant } from '../../ui';
|
||||
import styles from '../Page.module.css';
|
||||
|
||||
@@ -39,7 +39,7 @@ export function RunsPage() {
|
||||
const load = useCallback(() => {
|
||||
if (!id) return;
|
||||
setLoading(true);
|
||||
Promise.all([scenarios.get(Number(id)), runs.list(Number(id))])
|
||||
Promise.all([scenarios.get(id!), runs.list(id!)])
|
||||
.then(([sc, res]) => {
|
||||
setScenario(sc);
|
||||
setItems(res.data);
|
||||
@@ -58,12 +58,12 @@ export function RunsPage() {
|
||||
}, [load]);
|
||||
|
||||
const handleRun = async () => {
|
||||
const run = await scenarios.run(Number(id));
|
||||
const run = await scenarios.run(id!);
|
||||
navigate(`/scenarios/${id}/runs/${run.id}`);
|
||||
};
|
||||
|
||||
const columns: TableColumn<RunRow>[] = [
|
||||
{ key: 'id', header: t('runs.col_id'), render: (r) => r.id, width: 60 },
|
||||
{ key: 'id', header: t('runs.col_id'), render: (r) => <UuidBadge id={r.id} />, width: 60 },
|
||||
{
|
||||
key: 'status',
|
||||
header: t('runs.col_status'),
|
||||
|
||||
Reference in new issue
Block a user