v0.1.0-pre.060
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: kb_app_demo/frontend/demo_decode_replay.html -->
|
||||
<!-- version: 5 -->
|
||||
<!-- version: 6 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-lg-6">
|
||||
<label class="form-label" for="decodeReplayProgramIdInput">Program ID exact</label>
|
||||
<input id="decodeReplayProgramIdInput" class="form-control font-monospace" placeholder="Vide = tous les programmes des décodeurs sélectionnés" />
|
||||
<input id="decodeReplayProgramIdInput" class="form-control font-monospace" list="decodeReplayProgramIdOptions" placeholder="Vide = tous les programmes des décodeurs sélectionnés" />
|
||||
<datalist id="decodeReplayProgramIdOptions"></datalist>
|
||||
</div>
|
||||
<div class="col-12 col-lg-3">
|
||||
<label class="form-label" for="decodeReplayStateSelect">État instruction</label>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!-- file: kb_app_demo/frontend/demo_sql_replay_candidates.html -->
|
||||
<!-- version: 7 -->
|
||||
<!-- version: 8 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-md-3 col-xl-1">
|
||||
<label for="transactionLimitInput" class="form-label">Limite</label>
|
||||
<input id="transactionLimitInput" class="form-control" type="number" min="1" max="5000" step="1" value="500" />
|
||||
<input id="transactionLimitInput" class="form-control" type="number" min="1" max="100000" step="1" value="500" />
|
||||
</div>
|
||||
<div class="col-6 col-md-3 col-xl-2">
|
||||
<div class="form-check form-switch mb-2">
|
||||
@@ -206,7 +206,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-lg-1">
|
||||
<label for="programLimitInput" class="form-label">Limite</label>
|
||||
<input id="programLimitInput" class="form-control" type="number" min="1" max="5000" step="1" value="500" />
|
||||
<input id="programLimitInput" class="form-control" type="number" min="1" max="100000" step="1" value="500" />
|
||||
</div>
|
||||
<div class="col-12 col-lg-2">
|
||||
<div class="d-grid gap-2">
|
||||
@@ -264,7 +264,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-lg-2">
|
||||
<label for="mintLimitInput" class="form-label">Limite</label>
|
||||
<input id="mintLimitInput" class="form-control" type="number" min="1" max="5000" step="1" value="500" />
|
||||
<input id="mintLimitInput" class="form-control" type="number" min="1" max="100000" step="1" value="500" />
|
||||
</div>
|
||||
<div class="col-12 col-lg-3">
|
||||
<div class="d-grid d-sm-flex gap-2">
|
||||
@@ -322,7 +322,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-lg-2">
|
||||
<label for="ownerLimitInput" class="form-label">Limite</label>
|
||||
<input id="ownerLimitInput" class="form-control" type="number" min="1" max="5000" step="1" value="500" />
|
||||
<input id="ownerLimitInput" class="form-control" type="number" min="1" max="100000" step="1" value="500" />
|
||||
</div>
|
||||
<div class="col-12 col-lg-3">
|
||||
<div class="d-grid d-sm-flex gap-2">
|
||||
@@ -380,7 +380,7 @@
|
||||
</div>
|
||||
<div class="col-6 col-lg-2">
|
||||
<label for="accountLimitInput" class="form-label">Limite</label>
|
||||
<input id="accountLimitInput" class="form-control" type="number" min="1" max="5000" step="1" value="500" />
|
||||
<input id="accountLimitInput" class="form-control" type="number" min="1" max="100000" step="1" value="500" />
|
||||
</div>
|
||||
<div class="col-12 col-lg-3">
|
||||
<div class="d-grid d-sm-flex gap-2">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/frontend/ts/demo_decode_replay.ts
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
import * as bootstrap from "bootstrap";
|
||||
import "simplebar";
|
||||
@@ -279,6 +279,14 @@ async function loadOptions(): Promise<void> {
|
||||
element<HTMLElement>("#decodeReplayVersionBadge").textContent = `Pipeline ${options.pipelineVersion}`;
|
||||
element<HTMLInputElement>("#decodeReplayLimitInput").value = String(options.defaultLimit);
|
||||
element<HTMLInputElement>("#decodeReplayConcurrencyInput").value = String(options.defaultMaxConcurrentInputs);
|
||||
const programOptions = element<HTMLDataListElement>("#decodeReplayProgramIdOptions");
|
||||
programOptions.replaceChildren();
|
||||
for (const program of options.programs) {
|
||||
const option = document.createElement("option");
|
||||
option.value = program.programId;
|
||||
option.label = program.code;
|
||||
programOptions.append(option);
|
||||
}
|
||||
const container = element<HTMLElement>("#decodeReplayDecoderList");
|
||||
container.innerHTML = "";
|
||||
for (const decoder of options.decoders) {
|
||||
|
||||
@@ -94,7 +94,7 @@ let mintTable: Api<DemoSqlReplayEntityRow> | null = null;
|
||||
let ownerTable: Api<DemoSqlReplayEntityRow> | null = null;
|
||||
let accountTable: Api<DemoSqlReplayEntityRow> | null = null;
|
||||
let busyOperationCount = 0;
|
||||
let maximumReplayCandidateLimit = 5_000;
|
||||
let maximumReplayCandidateLimit = 100_000;
|
||||
|
||||
function element<T extends HTMLElement>(selector: string): T {
|
||||
const value = document.querySelector<T>(selector);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_decode_replay.rs
|
||||
// version: 29
|
||||
// version: 30
|
||||
|
||||
//! Tauri commands and UI payloads for contextual instruction decode replay.
|
||||
|
||||
@@ -22,6 +22,20 @@ pub(crate) struct DemoDecodeReplayDecoderOption {
|
||||
pub(crate) program_ids: std::vec::Vec<std::string::String>,
|
||||
}
|
||||
|
||||
/// One known program suggested by the free-form Program ID field.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/kb_app_demo_desktop/demo_decode_replay/DemoDecodeReplayProgramOption.ts"
|
||||
)]
|
||||
pub(crate) struct DemoDecodeReplayProgramOption {
|
||||
/// Stable program code.
|
||||
pub(crate) code: std::string::String,
|
||||
/// Canonical program identifier.
|
||||
pub(crate) program_id: std::string::String,
|
||||
}
|
||||
|
||||
/// Initial options shown by the contextual decode replay demo.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -36,6 +50,8 @@ pub(crate) struct DemoDecodeReplayOptionsPayload {
|
||||
pub(crate) decoders: std::vec::Vec<crate::DemoDecodeReplayDecoderOption>,
|
||||
/// Stable names of materializers currently registered by the demo.
|
||||
pub(crate) materializer_names: std::vec::Vec<std::string::String>,
|
||||
/// Known programs offered as non-blocking autocomplete suggestions.
|
||||
pub(crate) programs: std::vec::Vec<crate::DemoDecodeReplayProgramOption>,
|
||||
/// Default bounded selection limit.
|
||||
pub(crate) default_limit: u32,
|
||||
/// Default maximum concurrent contextual inputs.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_sql_replay_candidates.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Read-only SQL replay candidate browser commands.
|
||||
|
||||
@@ -266,18 +266,6 @@ pub(crate) fn validated_csv_file_name(
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) fn csv_export_directory_from_current_dir(
|
||||
current_dir: &std::path::Path,
|
||||
) -> std::path::PathBuf {
|
||||
let current_name = current_dir.file_name().and_then(std::ffi::OsStr::to_str);
|
||||
if let (std::option::Option::Some("kb_app_demo_desktop"), std::option::Option::Some(parent)) =
|
||||
(current_name, current_dir.parent())
|
||||
{
|
||||
return parent.join("data").join("exports_csv");
|
||||
}
|
||||
return current_dir.join("data").join("exports_csv");
|
||||
}
|
||||
|
||||
pub(crate) async fn available_csv_export_path(
|
||||
export_dir: &std::path::Path,
|
||||
file_name: &str,
|
||||
@@ -373,13 +361,6 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn csv_export_directory_uses_workspace_root_from_demo_crate() {
|
||||
let current_dir = std::path::Path::new("/tmp/khadhroony-bot2/kb_app_demo_desktop");
|
||||
let result = crate::csv_export_directory_from_current_dir(current_dir);
|
||||
assert_eq!(result, std::path::Path::new("/tmp/khadhroony-bot2/data/exports_csv"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn csv_file_name_accepts_split_entity_exports() {
|
||||
let mint_result = crate::validated_csv_file_name("replay_mints.csv");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/lib.rs
|
||||
// version: 10
|
||||
// version: 11
|
||||
|
||||
//! Tauri desktop demo application for `khadhroony-bot3`.
|
||||
|
||||
@@ -95,6 +95,8 @@ pub(crate) use self::demo_decode_replay::DemoDecodeReplayDecoderOption;
|
||||
pub(crate) use self::demo_decode_replay::DemoDecodeReplayObserver;
|
||||
/// Internal demo decode replay item.
|
||||
pub(crate) use self::demo_decode_replay::DemoDecodeReplayOptionsPayload;
|
||||
/// One known program suggested by the free-form Program ID field.
|
||||
pub(crate) use self::demo_decode_replay::DemoDecodeReplayProgramOption;
|
||||
/// Internal demo decode replay item.
|
||||
pub(crate) use self::demo_decode_replay::DemoDecodeReplayProgressPayload;
|
||||
/// Internal demo decode replay item.
|
||||
@@ -267,8 +269,6 @@ pub(crate) use self::demo_sql_replay_candidates::DemoSqlReplayTransactionRequest
|
||||
pub(crate) use self::demo_sql_replay_candidates::DemoSqlReplayTransactionRow;
|
||||
/// Resolves an available CSV path.
|
||||
pub(crate) use self::demo_sql_replay_candidates::available_csv_export_path;
|
||||
/// Resolves the CSV export directory.
|
||||
pub(crate) use self::demo_sql_replay_candidates::csv_export_directory_from_current_dir;
|
||||
/// Parses an entity-kind code.
|
||||
pub(crate) use self::demo_sql_replay_candidates::entity_kind_from_code;
|
||||
/// Converts a PostgreSQL entity row.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/tauri.rs
|
||||
// version: 14
|
||||
// version: 15
|
||||
|
||||
//! Tauri runtime assembly and private command wrappers.
|
||||
|
||||
@@ -270,6 +270,15 @@ fn demo_decode_replay_options(
|
||||
return format!("{}@{}", identity.name, identity.version);
|
||||
})
|
||||
.collect::<std::vec::Vec<_>>();
|
||||
let programs = kb_program_ids::registered_program_ids()
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
return crate::DemoDecodeReplayProgramOption {
|
||||
code: entry.code().to_string(),
|
||||
program_id: entry.program_id().to_string(),
|
||||
};
|
||||
})
|
||||
.collect();
|
||||
let running = state.demo_decode_replay_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
@@ -286,6 +295,7 @@ fn demo_decode_replay_options(
|
||||
pipeline_version: kb_pipeline::DECODE_PIPELINE_VERSION.to_string(),
|
||||
decoders: decoder_options,
|
||||
materializer_names,
|
||||
programs,
|
||||
default_limit: 100,
|
||||
default_max_concurrent_inputs: 4,
|
||||
running,
|
||||
@@ -915,14 +925,7 @@ async fn export_demo_sql_replay_csv(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let current_dir_result = std::env::current_dir();
|
||||
let current_dir = match current_dir_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(format!("cannot resolve current directory: {error}"));
|
||||
},
|
||||
};
|
||||
let export_dir = crate::csv_export_directory_from_current_dir(¤t_dir);
|
||||
let export_dir = crate::workspace_root_dir().join("data").join("exports_csv");
|
||||
let create_result = tokio::fs::create_dir_all(&export_dir).await;
|
||||
if let std::result::Result::Err(error) = create_result {
|
||||
return std::result::Result::Err(format!("cannot create CSV export directory: {error}"));
|
||||
|
||||
Reference in New Issue
Block a user