docs: added vite-press docs #4

Merged
sharang merged 3 commits from feature/docs-vitepress into main 2026-03-08 13:59:50 +00:00
5 changed files with 35 additions and 10 deletions
Showing only changes of commit bf5a45c958 - Show all commits

View File

@@ -2,8 +2,11 @@ FROM rust:1.89-bookworm AS builder
RUN cargo install dioxus-cli --version 0.7.3 RUN cargo install dioxus-cli --version 0.7.3
ARG DOCS_URL=/docs
WORKDIR /app WORKDIR /app
COPY . . COPY . .
ENV DOCS_URL=${DOCS_URL}
RUN dx build --release --package compliance-dashboard RUN dx build --release --package compliance-dashboard
FROM debian:bookworm-slim FROM debian:bookworm-slim

12
Dockerfile.docs Normal file
View File

@@ -0,0 +1,12 @@
FROM node:22-alpine AS builder
WORKDIR /app
COPY docs/package.json docs/package-lock.json ./
RUN npm ci
COPY docs/ .
RUN npm run build
FROM nginx:alpine
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
EXPOSE 80

View File

@@ -64,6 +64,8 @@ pub fn Sidebar() -> Element {
}, },
]; ];
let docs_url = option_env!("DOCS_URL").unwrap_or("/docs");
let sidebar_class = if collapsed() { let sidebar_class = if collapsed() {
"sidebar collapsed" "sidebar collapsed"
} else { } else {
@@ -106,6 +108,15 @@ pub fn Sidebar() -> Element {
} }
} }
} }
a {
href: "{docs_url}",
target: "_blank",
class: "nav-item",
Icon { icon: BsBook, width: 18, height: 18 }
if !collapsed() {
span { "Docs" }
}
}
button { button {
class: "sidebar-toggle", class: "sidebar-toggle",
onclick: move |_| collapsed.set(!collapsed()), onclick: move |_| collapsed.set(!collapsed()),

View File

@@ -75,9 +75,9 @@ pub async fn auth_login(
Extension(pending): Extension<PendingOAuthStore>, Extension(pending): Extension<PendingOAuthStore>,
Query(params): Query<HashMap<String, String>>, Query(params): Query<HashMap<String, String>>,
) -> Result<impl IntoResponse, DashboardError> { ) -> Result<impl IntoResponse, DashboardError> {
let kc = state.keycloak.ok_or(DashboardError::Other( let kc = state
"Keycloak not configured".into(), .keycloak
))?; .ok_or(DashboardError::Other("Keycloak not configured".into()))?;
let csrf_state = generate_state(); let csrf_state = generate_state();
let code_verifier = generate_code_verifier(); let code_verifier = generate_code_verifier();
let code_challenge = derive_code_challenge(&code_verifier); let code_challenge = derive_code_challenge(&code_verifier);
@@ -128,9 +128,9 @@ pub async fn auth_callback(
Extension(pending): Extension<PendingOAuthStore>, Extension(pending): Extension<PendingOAuthStore>,
Query(params): Query<HashMap<String, String>>, Query(params): Query<HashMap<String, String>>,
) -> Result<impl IntoResponse, DashboardError> { ) -> Result<impl IntoResponse, DashboardError> {
let kc = state.keycloak.ok_or(DashboardError::Other( let kc = state
"Keycloak not configured".into(), .keycloak
))?; .ok_or(DashboardError::Other("Keycloak not configured".into()))?;
let returned_state = params let returned_state = params
.get("state") .get("state")
@@ -214,9 +214,9 @@ pub async fn logout(
session: Session, session: Session,
Extension(state): Extension<ServerState>, Extension(state): Extension<ServerState>,
) -> Result<impl IntoResponse, DashboardError> { ) -> Result<impl IntoResponse, DashboardError> {
let kc = state.keycloak.ok_or(DashboardError::Other( let kc = state
"Keycloak not configured".into(), .keycloak
))?; .ok_or(DashboardError::Other("Keycloak not configured".into()))?;
session session
.flush() .flush()

View File

@@ -52,4 +52,3 @@ impl KeycloakConfig {
) )
} }
} }