Compare commits
6 Commits
0.0.3
...
20f64cd35d
| Author | SHA1 | Date | |
|---|---|---|---|
| 20f64cd35d | |||
| 6bd6dbad38 | |||
| df81605ecc | |||
| 8c12ca0024 | |||
| 70835f04fa | |||
| e7eb9b8b16 |
72
.gitea/workflows/frontend.yaml
Normal file
72
.gitea/workflows/frontend.yaml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: Frontend Actions
|
||||||
|
run-name: ${{ gitea.actor }} is running frontend actions
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./ui
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Load Cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
ui/node_modules
|
||||||
|
key: ${{ runner.os }}-node-check-${{ hashFiles('ui/package-lock.json') }}
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Run Eslint
|
||||||
|
run: npm run lint
|
||||||
|
- name: Run Prettier
|
||||||
|
run: npm run fmt -- . --check
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./ui
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Load Cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
ui/node_modules
|
||||||
|
key: ${{ runner.os }}-node-build-${{ hashFiles('ui/package-lock.json') }}
|
||||||
|
- run: node --version
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Build UI
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./ui
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Load Cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
ui/node_modules
|
||||||
|
key: ${{ runner.os }}-node-test-${{ hashFiles('ui/package-lock.json') }}
|
||||||
|
- run: node --version
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Run tests
|
||||||
|
run: npm run test
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
.env
|
.env
|
||||||
package/
|
package/
|
||||||
package.tar.zst
|
*.tar.zst
|
||||||
|
|||||||
1
backend/Cargo.lock
generated
1
backend/Cargo.lock
generated
@ -1896,6 +1896,7 @@ dependencies = [
|
|||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service 0.3.3",
|
"tower-service 0.3.3",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -11,7 +11,7 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
serde_json = "1.0.141"
|
serde_json = "1.0.141"
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
tower = { version = "0.5.2", features = ["full"] }
|
tower = { version = "0.5.2", features = ["full"] }
|
||||||
tower-http = { version = "0.6.6", features = ["timeout", "trace", "auth"] }
|
tower-http = { version = "0.6.6", features = ["timeout", "trace", "auth", "request-id"] }
|
||||||
tower-http-util = "0.1.0"
|
tower-http-util = "0.1.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
|
|||||||
@ -7,12 +7,25 @@ use crate::config;
|
|||||||
use axum::extract::Request;
|
use axum::extract::Request;
|
||||||
use axum::routing::get;
|
use axum::routing::get;
|
||||||
use axum::{Router, body::Body};
|
use axum::{Router, body::Body};
|
||||||
|
use http::HeaderName;
|
||||||
use tower::ServiceBuilder;
|
use tower::ServiceBuilder;
|
||||||
|
use tower_http::request_id::{MakeRequestId, RequestId, SetRequestIdLayer};
|
||||||
use tower_http::timeout::TimeoutLayer;
|
use tower_http::timeout::TimeoutLayer;
|
||||||
use tower_http::trace::TraceLayer;
|
use tower_http::trace::TraceLayer;
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct RequestIdLayer;
|
||||||
|
|
||||||
|
impl MakeRequestId for RequestIdLayer {
|
||||||
|
fn make_request_id<B>(&mut self, _: &http::Request<B>) -> Option<RequestId> {
|
||||||
|
let id = Uuid::now_v7().to_string();
|
||||||
|
|
||||||
|
Some(RequestId::new(id.parse().unwrap()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn app(config: &config::Config) -> (Router, mpsc::Receiver<bool>) {
|
pub fn app(config: &config::Config) -> (Router, mpsc::Receiver<bool>) {
|
||||||
let (tx, rx) = mpsc::channel();
|
let (tx, rx) = mpsc::channel();
|
||||||
(
|
(
|
||||||
@ -22,15 +35,29 @@ pub fn app(config: &config::Config) -> (Router, mpsc::Receiver<bool>) {
|
|||||||
.nest("/admin", admin::router(tx, config))
|
.nest("/admin", admin::router(tx, config))
|
||||||
.layer(
|
.layer(
|
||||||
ServiceBuilder::new()
|
ServiceBuilder::new()
|
||||||
|
.layer(SetRequestIdLayer::new(
|
||||||
|
HeaderName::from_static("x-request-id"),
|
||||||
|
RequestIdLayer,
|
||||||
|
))
|
||||||
.layer(
|
.layer(
|
||||||
TraceLayer::new_for_http().make_span_with(|req: &Request<Body>| {
|
TraceLayer::new_for_http().make_span_with(|req: &Request<Body>| {
|
||||||
tracing::span!(
|
if let Some(req_id) = req.headers().get("x-request-id") {
|
||||||
Level::DEBUG,
|
tracing::span!(
|
||||||
"request",
|
Level::DEBUG,
|
||||||
trace_id = Uuid::now_v7().to_string(),
|
"request",
|
||||||
method = format!("{}", req.method()),
|
req_id = req_id.to_str().unwrap(),
|
||||||
uri = format!("{}", req.uri()),
|
method = format!("{}", req.method()),
|
||||||
)
|
uri = format!("{}", req.uri()),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
tracing::span!(
|
||||||
|
Level::DEBUG,
|
||||||
|
"request",
|
||||||
|
req_id = "<missing>",
|
||||||
|
method = format!("{}", req.method()),
|
||||||
|
uri = format!("{}", req.uri()),
|
||||||
|
)
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.layer(TimeoutLayer::new(Duration::from_secs(10))),
|
.layer(TimeoutLayer::new(Duration::from_secs(10))),
|
||||||
|
|||||||
@ -6,6 +6,15 @@ services:
|
|||||||
command: --host 0.0.0.0
|
command: --host 0.0.0.0
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build: ./ui
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
command: --host 0.0.0.0
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
24
ui/.dockerignore
Normal file
24
ui/.dockerignore
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Nuxt dev/build outputs
|
||||||
|
.output
|
||||||
|
.data
|
||||||
|
.nuxt
|
||||||
|
.nitro
|
||||||
|
.cache
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
.DS_Store
|
||||||
|
.fleet
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Local env files
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
15
ui/Dockerfile
Normal file
15
ui/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM node:24-alpine AS base
|
||||||
|
|
||||||
|
FROM base AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM base AS prod
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/.output ./ui
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
|
ENTRYPOINT [ "node", "/app/ui/server/index.mjs" ]
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<NuxtRouteAnnouncer />
|
<NuxtRouteAnnouncer />
|
||||||
<NuxtWelcome />
|
<NuxtPage />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
14
ui/app/pages/index.spec.ts
Normal file
14
ui/app/pages/index.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @noErrors
|
||||||
|
import { it, expect } from "vitest";
|
||||||
|
// ---cut---
|
||||||
|
// tests/components/SomeComponents.nuxt.spec.ts
|
||||||
|
import { mountSuspended } from "@nuxt/test-utils/runtime";
|
||||||
|
import Index from "~/pages/index.vue";
|
||||||
|
|
||||||
|
// tests/App.nuxt.spec.ts
|
||||||
|
it("can also mount an app", async () => {
|
||||||
|
const component = await mountSuspended(Index, { route: "/test" });
|
||||||
|
expect(component.html()).toMatchInlineSnapshot(`
|
||||||
|
"<h1>Hello World</h1>"
|
||||||
|
`);
|
||||||
|
});
|
||||||
3
ui/app/pages/index.vue
Normal file
3
ui/app/pages/index.vue
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
</template>
|
||||||
@ -1,6 +1,9 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
import withNuxt from './.nuxt/eslint.config.mjs'
|
import withNuxt from "./.nuxt/eslint.config.mjs";
|
||||||
|
|
||||||
export default withNuxt(
|
export default withNuxt({
|
||||||
// Your custom configs here
|
rules: {
|
||||||
)
|
"prefer-const": "warn",
|
||||||
|
"no-unexpected-multiline": 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@ -1,6 +1,14 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: "2025-07-15",
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
modules: ['@nuxt/eslint', '@nuxt/icon', '@nuxt/test-utils']
|
modules: [
|
||||||
})
|
"@nuxt/eslint",
|
||||||
|
"@nuxt/icon",
|
||||||
|
"@nuxt/test-utils",
|
||||||
|
"@nuxt/test-utils/module",
|
||||||
|
],
|
||||||
|
nitro: {
|
||||||
|
preset: "node-server",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
802
ui/package-lock.json
generated
802
ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,14 +7,31 @@
|
|||||||
"dev": "nuxt dev",
|
"dev": "nuxt dev",
|
||||||
"generate": "nuxt generate",
|
"generate": "nuxt generate",
|
||||||
"preview": "nuxt preview",
|
"preview": "nuxt preview",
|
||||||
"postinstall": "nuxt prepare"
|
"postinstall": "nuxt prepare",
|
||||||
|
"test": "vitest run",
|
||||||
|
"watch": "vitest watch",
|
||||||
|
"lint": "eslint",
|
||||||
|
"fmt": "prettier"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/eslint": "1.6.0",
|
"@nuxt/eslint": "1.6.0",
|
||||||
"@nuxt/icon": "^1.15.0",
|
"@nuxt/icon": "^1.15.0",
|
||||||
"@nuxt/test-utils": "^3.19.2",
|
|
||||||
"nuxt": "^4.0.1",
|
"nuxt": "^4.0.1",
|
||||||
"vue": "^3.5.17",
|
"vue": "^3.5.17",
|
||||||
"vue-router": "^4.5.1"
|
"vue-router": "^4.5.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/css": "^0.10.0",
|
||||||
|
"@eslint/js": "^9.32.0",
|
||||||
|
"@nuxt/test-utils": "^3.19.2",
|
||||||
|
"@vue/test-utils": "^2.4.6",
|
||||||
|
"eslint": "^9.32.0",
|
||||||
|
"eslint-plugin-vue": "^10.3.0",
|
||||||
|
"globals": "^16.3.0",
|
||||||
|
"happy-dom": "^18.0.1",
|
||||||
|
"playwright-core": "^1.54.1",
|
||||||
|
"prettier": "3.6.2",
|
||||||
|
"typescript-eslint": "^8.38.0",
|
||||||
|
"vitest": "^3.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
ui/vitest.config.ts
Normal file
7
ui/vitest.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { defineVitestConfig } from "@nuxt/test-utils/config";
|
||||||
|
|
||||||
|
export default defineVitestConfig({
|
||||||
|
test: {
|
||||||
|
environment: "nuxt",
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user