mirror of
https://github.com/block/goose.git
synced 2026-04-28 03:29:36 +00:00
Fix scheduler jobs dates formatting (#5368)
This commit is contained in:
parent
0ca4e0ba4e
commit
774baf1cdb
2 changed files with 2 additions and 10 deletions
|
|
@ -8,8 +8,6 @@ use axum::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use chrono::NaiveDateTime;
|
|
||||||
|
|
||||||
use crate::state::AppState;
|
use crate::state::AppState;
|
||||||
use goose::scheduler::ScheduledJob;
|
use goose::scheduler::ScheduledJob;
|
||||||
|
|
||||||
|
|
@ -82,12 +80,6 @@ pub struct SessionDisplayInfo {
|
||||||
accumulated_output_tokens: Option<i32>,
|
accumulated_output_tokens: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_session_name_to_iso(session_name: &str) -> String {
|
|
||||||
NaiveDateTime::parse_from_str(session_name, "%Y%m%d_%H%M%S")
|
|
||||||
.map(|dt| dt.and_utc().to_rfc3339())
|
|
||||||
.unwrap_or_else(|_| String::new()) // Fallback to empty string if parsing fails
|
|
||||||
}
|
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
post,
|
post,
|
||||||
path = "/schedule/create",
|
path = "/schedule/create",
|
||||||
|
|
@ -326,7 +318,7 @@ async fn sessions_handler(
|
||||||
display_infos.push(SessionDisplayInfo {
|
display_infos.push(SessionDisplayInfo {
|
||||||
id: session_name.clone(),
|
id: session_name.clone(),
|
||||||
name: session.name,
|
name: session.name,
|
||||||
created_at: parse_session_name_to_iso(&session_name),
|
created_at: session.created_at.to_rfc3339(),
|
||||||
working_dir: session.working_dir.to_string_lossy().into_owned(),
|
working_dir: session.working_dir.to_string_lossy().into_owned(),
|
||||||
schedule_id: session.schedule_id,
|
schedule_id: session.schedule_id,
|
||||||
message_count: session.message_count,
|
message_count: session.message_count,
|
||||||
|
|
|
||||||
|
|
@ -631,7 +631,7 @@ const ScheduleDetailView: React.FC<ScheduleDetailViewProps> = ({ scheduleId, onN
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-xs text-text-subtle mt-1">
|
<p className="text-xs text-text-subtle mt-1">
|
||||||
Created:{' '}
|
Created:{' '}
|
||||||
{session.createdAt ? new Date(session.createdAt).toLocaleString() : 'N/A'}
|
{session.createdAt ? formatToLocalDateWithTimezone(session.createdAt) : 'N/A'}
|
||||||
</p>
|
</p>
|
||||||
{session.messageCount !== undefined && (
|
{session.messageCount !== undefined && (
|
||||||
<p className="text-xs text-text-subtle mt-1">
|
<p className="text-xs text-text-subtle mt-1">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue