diff --git a/glot_core/src/page/snippet_page/output_panel.rs b/glot_core/src/page/snippet_page/output_panel.rs index 2d1c760..3442f76 100644 --- a/glot_core/src/page/snippet_page/output_panel.rs +++ b/glot_core/src/page/snippet_page/output_panel.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use crate::run::FailedRunResult; use crate::run::RunResult; use crate::util::remote_data::RemoteData; @@ -62,10 +64,13 @@ fn view_info(text: &str) -> Markup { } fn view_run_result(run_result: &RunResult) -> Markup { + let duration = format!("{:.2?}", Duration::from_nanos(run_result.duration)); + html! { @if !run_result.stdout.is_empty() { - dt class="px-4 py-1 border-t border-b border-gray-400 text-sm text-slate-700 font-bold bg-green-400" { + dt class="px-4 py-1 flex justify-between border-t border-b border-gray-400 text-sm text-slate-700 font-bold bg-green-400" { pre { "STDOUT" } + pre { (duration) } } dd class="px-4 py-2 overflow-y-auto" { pre { diff --git a/glot_core/src/run.rs b/glot_core/src/run.rs index f805ed9..11002af 100644 --- a/glot_core/src/run.rs +++ b/glot_core/src/run.rs @@ -11,6 +11,7 @@ pub struct RunRequest { #[derive(Clone, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "camelCase")] pub struct RunResult { + pub duration: u64, pub stdout: String, pub stderr: String, pub error: String,