fix journal path
This commit is contained in:
parent
7fc3917134
commit
dad4ed7591
5 changed files with 53 additions and 54 deletions
|
@ -16,8 +16,6 @@
|
||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"productName": "panorama",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"identifier": "io.mzhang.panorama",
|
"identifier": "io.mzhang.panorama",
|
||||||
"plugins": {},
|
"plugins": {},
|
||||||
"app": {
|
"app": {
|
||||||
|
|
|
@ -50,6 +50,7 @@ export default function NodeDisplay({ id, idx }: NodeDisplayProps) {
|
||||||
|
|
||||||
function NodeDisplayHeaderLoaded({ idx, id, data }) {
|
function NodeDisplayHeaderLoaded({ idx, id, data }) {
|
||||||
const { openNode, closeNode } = useNodeControls();
|
const { openNode, closeNode } = useNodeControls();
|
||||||
|
const updatedAt = data.updated_at && Date.parse(data.updated_at);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -64,9 +65,9 @@ function NodeDisplayHeaderLoaded({ idx, id, data }) {
|
||||||
)}
|
)}
|
||||||
<span>
|
<span>
|
||||||
Type {data.type}{" "}
|
Type {data.type}{" "}
|
||||||
{data.created_at && (
|
{updatedAt && (
|
||||||
<>
|
<>
|
||||||
· Last updated <ReactTimeAgo date={data.updated_at * 1000} />
|
· Last updated <ReactTimeAgo date={updatedAt} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -3,14 +3,15 @@ use std::{
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::{extract::State, Json};
|
||||||
use miette::IntoDiagnostic;
|
use miette::IntoDiagnostic;
|
||||||
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::{error::AppResult, AppState};
|
use crate::{error::AppResult, AppState};
|
||||||
|
|
||||||
// This code is really bad but gives me a quick way to look at all of the data
|
// This code is really bad but gives me a quick way to look at all of the data
|
||||||
// in the data at once. Rip this out once there's any Real Security Mechanism.
|
// in the data at once. Rip this out once there's any Real Security Mechanism.
|
||||||
pub async fn export(State(state): State<AppState>) -> AppResult<()> {
|
pub async fn export(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
||||||
let export = state.export().await?;
|
let export = state.export().await?;
|
||||||
|
|
||||||
let base_dir = PathBuf::from("export");
|
let base_dir = PathBuf::from("export");
|
||||||
|
@ -20,5 +21,5 @@ pub async fn export(State(state): State<AppState>) -> AppResult<()> {
|
||||||
|
|
||||||
serde_json::to_writer_pretty(file, &export).into_diagnostic()?;
|
serde_json::to_writer_pretty(file, &export).into_diagnostic()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(Json(export))
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,7 @@ use crate::{error::AppResult, AppState};
|
||||||
pub(super) struct JournalApi;
|
pub(super) struct JournalApi;
|
||||||
|
|
||||||
pub(super) fn router() -> Router<AppState> {
|
pub(super) fn router() -> Router<AppState> {
|
||||||
Router::new()
|
Router::new().route("/get_todays_journal_id", get(get_todays_journal_id))
|
||||||
.route("/journal/get_todays_journal_id", get(get_todays_journal_id))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
|
|
Loading…
Reference in a new issue