Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions crates/hotfix-status/src/api.rs

This file was deleted.

19 changes: 0 additions & 19 deletions crates/hotfix-status/src/data_provider.rs

This file was deleted.

176 changes: 0 additions & 176 deletions crates/hotfix-status/src/lib.rs

This file was deleted.

15 changes: 0 additions & 15 deletions crates/hotfix-status/src/ui.rs

This file was deleted.

32 changes: 32 additions & 0 deletions crates/hotfix-web-ui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "hotfix-web-ui"
description = "Web dashboard UI components for the HotFIX engine"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true

[dependencies]
hotfix = { version = "0.3.0", path = "../hotfix" }

anyhow = { workspace = true }
askama = { workspace = true, features = ["serde_json"] }
async-trait = { workspace = true }
axum = { workspace = true }
chrono = { workspace = true }
displaydoc = { workspace = true }
mime_guess = { workspace = true }
rust-embed = { workspace = true, features = ["axum-ex"] }
thiserror = { workspace = true }

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tower = { workspace = true }

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
use axum::http::{StatusCode, Uri, header};
use axum::extract::Path;
use axum::http::{StatusCode, header};
use axum::response::{IntoResponse, Response};
use rust_embed::Embed;

#[derive(Embed)]
#[folder = "assets/"]
struct Assets;

pub(crate) async fn static_handler(uri: Uri) -> impl IntoResponse {
let mut path = uri.path().trim_start_matches('/').to_string();

if path.starts_with("static/") {
path = path.replace("static/", "");
}

pub(crate) async fn static_handler(Path(path): Path<String>) -> impl IntoResponse {
StaticFile(path)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::AppState;
use crate::data_provider::DataProvider;
use crate::error::AppResult;
use crate::SessionInfoProvider;
use crate::error::DashboardResult;
use askama::Template;
use axum::extract::State;
use axum::extract::{FromRef, State};
use axum::response::{Html, IntoResponse};
use chrono::Utc;
use hotfix::session::SessionInfo;
Expand All @@ -16,10 +15,14 @@ struct DashboardTemplate<'a> {
timestamp_string: &'a str,
}

pub(crate) async fn dashboard_handler<P: DataProvider>(
State(state): State<AppState<P>>,
) -> AppResult<impl IntoResponse> {
let session_info = state.data_provider.get_session_info().await?;
pub(crate) async fn dashboard_handler<S, P>(
State(provider): State<P>,
) -> DashboardResult<impl IntoResponse>
where
S: Clone + Send + Sync + 'static,
P: SessionInfoProvider + FromRef<S>,
{
let session_info = provider.get_session_info().await?;
let timestamp_string = Utc::now().to_rfc3339();

let template = DashboardTemplate {
Expand Down
Loading