v0.3.7-pre.011
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/tauri.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
//! Tauri runtime assembly for the KSP Backfill desktop application.
|
||||
|
||||
@@ -79,6 +79,7 @@ fn configure_commands(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tau
|
||||
return builder.invoke_handler(tauri::generate_handler![
|
||||
backfill_cancel,
|
||||
backfill_options,
|
||||
backfill_resume,
|
||||
backfill_start,
|
||||
backfill_status,
|
||||
backfill_validate_request,
|
||||
@@ -206,6 +207,32 @@ fn backfill_start(
|
||||
},
|
||||
};
|
||||
let response = launch.response();
|
||||
spawn_backfill_launch(app, launch);
|
||||
return std::result::Result::Ok(response);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn backfill_resume(
|
||||
app: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::BackfillResumeResponseDto, crate::CommandErrorDto> {
|
||||
let launch = state.prepare_backfill_resume();
|
||||
let launch = match launch {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(project_command_error("backfill_resume", crate::TRACING_DOMAIN_RUN, &error));
|
||||
},
|
||||
};
|
||||
let response = crate::BackfillResumeResponseDto {
|
||||
accepted: true,
|
||||
job_id: launch.job_id.as_str().to_owned(),
|
||||
state: ksp_job_api::JobState::Created.code().to_owned(),
|
||||
};
|
||||
spawn_backfill_launch(app, launch);
|
||||
return std::result::Result::Ok(response);
|
||||
}
|
||||
|
||||
fn spawn_backfill_launch(app: tauri::AppHandle, launch: crate::BackfillRunLaunch) {
|
||||
let monitor_app = app.clone();
|
||||
let monitor_source = launch.snapshots.clone();
|
||||
let _monitor_task = tauri::async_runtime::spawn(async move {
|
||||
@@ -224,7 +251,7 @@ fn backfill_start(
|
||||
);
|
||||
}
|
||||
});
|
||||
return std::result::Result::Ok(response);
|
||||
return;
|
||||
}
|
||||
|
||||
async fn monitor_backfill_status(app: tauri::AppHandle, source: ksp_job_backfill_lib::BackfillSnapshotSource) {
|
||||
|
||||
Reference in New Issue
Block a user