Compare commits

...
Author SHA1 Message Date
ars9 6e5da08719 feat(client): include version in exported scenario and snippet filenames
CI / changes (pull_request) Successful in 10s
CI / server (pull_request) Skipped
CI / client (pull_request) Successful in 1m21s
CI / image (pull_request) Skipped
- request the exact version being exported via ?version=N so file
  content always matches the filename
- name downloads <scenario>-v<N>.yaml and snippet-<alias>-v<N>.yaml
2026-10-07 17:34:21 +03:00
ars9 1abd95f9e1 Merge pull request 'fix(install): read prompts from the terminal and start liqa' (#11) from fix/install-tty into master
CI / changes (push) Successful in 6s
CI / server (push) Skipped
CI / client (push) Skipped
CI / image (push) Skipped
Reviewed-on: #11
2026-10-02 15:53:43 +03:00
3 changed files with 16 additions and 6 deletions

No files matched your search

+12 -3
View File
@@ -123,8 +123,9 @@ export const snippets = {
versions(id: string): Promise<SnippetVersion[]> { versions(id: string): Promise<SnippetVersion[]> {
return request(`/snippets/${id}/versions`); return request(`/snippets/${id}/versions`);
}, },
exportSnippet(id: string): Promise<unknown> { exportSnippet(id: string, version?: number): Promise<unknown> {
return request(`/snippets/${id}/export`); const query = version === undefined ? '' : `?version=${version}`;
return request(`/snippets/${id}/export${query}`);
}, },
}; };
@@ -247,7 +248,12 @@ export const scenarios = {
}, },
exportScenario( exportScenario(
id: string, id: string,
options: { includeEnvironment: boolean; credentialIds: string[]; snippetIds: string[] } = { options: {
includeEnvironment: boolean;
credentialIds: string[];
snippetIds: string[];
version?: number;
} = {
includeEnvironment: false, includeEnvironment: false,
credentialIds: [], credentialIds: [],
snippetIds: [], snippetIds: [],
@@ -255,6 +261,9 @@ export const scenarios = {
): Promise<string> { ): Promise<string> {
const params = new URLSearchParams(); const params = new URLSearchParams();
params.set('includeEnvironment', String(options.includeEnvironment)); params.set('includeEnvironment', String(options.includeEnvironment));
if (options.version !== undefined) {
params.set('version', String(options.version));
}
for (const cid of options.credentialIds) { for (const cid of options.credentialIds) {
params.append('credentialIds', cid); params.append('credentialIds', cid);
} }
@@ -229,12 +229,13 @@ export function ScenarioDetailPage() {
includeEnvironment, includeEnvironment,
credentialIds: credIds, credentialIds: credIds,
snippetIds: Array.from(includedSnippetIds), snippetIds: Array.from(includedSnippetIds),
version: scenario.version,
}); });
const blob = new Blob([yamlContent], { type: 'application/yaml' }); const blob = new Blob([yamlContent], { type: 'application/yaml' });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
const a = document.createElement('a'); const a = document.createElement('a');
a.href = url; a.href = url;
a.download = `${scenario.name}.yaml`; a.download = `${scenario.name}-v${scenario.version}.yaml`;
a.click(); a.click();
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
setExportModalOpen(false); setExportModalOpen(false);
@@ -51,12 +51,12 @@ export function SnippetDetailPage() {
const handleExport = async () => { const handleExport = async () => {
if (!snippet) return; if (!snippet) return;
const data = await snippets.exportSnippet(snippet.id); const data = await snippets.exportSnippet(snippet.id, snippet.version);
const blob = new Blob([yamlStringify(data)], { type: 'application/yaml' }); const blob = new Blob([yamlStringify(data)], { type: 'application/yaml' });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
const a = document.createElement('a'); const a = document.createElement('a');
a.href = url; a.href = url;
a.download = `snippet-${snippet.alias}.yaml`; a.download = `snippet-${snippet.alias}-v${snippet.version}.yaml`;
a.click(); a.click();
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}; };