mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-16 23:01:31 +02:00
Share one exporter, and flush the file before saying it is written (#686)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
caeebebc75
commit
f827aae46d
@@ -1,27 +0,0 @@
|
||||
use crate::Result;
|
||||
use yaak_models::query_manager::QueryManager;
|
||||
use yaak_models::util::get_workspace_export_resources;
|
||||
|
||||
pub struct ExportDataParams<'a> {
|
||||
pub query_manager: &'a QueryManager,
|
||||
pub yaak_version: &'a str,
|
||||
pub workspace_ids: Vec<&'a str>,
|
||||
pub include_private_environments: bool,
|
||||
}
|
||||
|
||||
/// The export document, as JSON.
|
||||
///
|
||||
/// Returned rather than written: where an export goes is the host's to decide, and a browser
|
||||
/// tab has no path to be handed. The desktop hands the bytes to its save dialog; a tab hands
|
||||
/// them to a download. Neither needs this function to know which.
|
||||
pub fn export_data(params: ExportDataParams<'_>) -> Result<String> {
|
||||
let db = params.query_manager.connect();
|
||||
let export_data = get_workspace_export_resources(
|
||||
&db,
|
||||
params.yaak_version,
|
||||
params.workspace_ids,
|
||||
params.include_private_environments,
|
||||
)?;
|
||||
|
||||
Ok(serde_json::to_string_pretty(&export_data)?)
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
pub mod error;
|
||||
pub mod example;
|
||||
pub mod export;
|
||||
pub mod import;
|
||||
pub mod plugin_events;
|
||||
pub mod response_body;
|
||||
|
||||
Reference in New Issue
Block a user