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:
2026-04-10 13:09:09 +03:00
parent 1164289173
commit 32be7c0a59
54 changed files with 728 additions and 272 deletions
@@ -1,12 +1,10 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsInt, IsNotEmpty, IsPositive, IsString } from "class-validator";
import { IsNotEmpty, IsString, IsUUID } from "class-validator";
export class AddScenarioCredentialDto {
@ApiProperty({ example: 1 })
@IsInt()
@IsPositive()
credentialId: number;
@ApiProperty({ example: "uuid-here" })
@IsUUID()
credentialId: string
@ApiProperty({ example: "api_key" })
@IsString()
@IsNotEmpty()
+20 -2
View File
@@ -7,6 +7,7 @@ import {
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
Min,
ValidateNested,
} from "class-validator";
@@ -22,10 +23,11 @@ export class ScenarioStepExportDto {
@IsIn(["login", "exec", "sign"])
type: StepType;
@ApiProperty()
@ApiPropertyOptional()
@IsOptional()
@IsString()
@IsNotEmpty()
sessionName: string | null;
title: string | null;
@ApiPropertyOptional()
@IsOptional()
@@ -41,6 +43,22 @@ export class ScenarioStepExportDto {
}
export class ScenarioExportDto {
@ApiPropertyOptional()
@IsOptional()
@IsIn(["scenario"])
kind?: "scenario";
@ApiPropertyOptional()
@IsOptional()
@IsUUID()
id?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@IsNotEmpty()
title?: string;
@ApiProperty()
@IsString()
@IsNotEmpty()