From ca849de37f8b9dedaf5b0188d35930e90803db49 Mon Sep 17 00:00:00 2001 From: akrike <1625167628@qq.com> Date: Wed, 3 Sep 2025 22:06:35 +0800 Subject: [PATCH] ui update --- resources/src/api/api.ts | 2 +- resources/src/api/process.ts | 5 +- .../src/components/process/ProcessCard.vue | 206 ++++++++++++++++++ resources/src/main.ts | 3 +- resources/src/types/process/process.ts | 34 +++ resources/src/views/process/Process.vue | 49 ++++- 6 files changed, 293 insertions(+), 6 deletions(-) create mode 100644 resources/src/components/process/ProcessCard.vue create mode 100644 resources/src/types/process/process.ts diff --git a/resources/src/api/api.ts b/resources/src/api/api.ts index d62b6e6..7b46fd1 100644 --- a/resources/src/api/api.ts +++ b/resources/src/api/api.ts @@ -40,7 +40,7 @@ class RequestHttp { this.service.interceptors.request.use( (config) => { const token = localStorage.getItem("token") || ""; - config.headers.Authorization = token; + config.headers.Authorization = "bearer " + token; config.url = "/api" + config.url; return config; }, diff --git a/resources/src/api/process.ts b/resources/src/api/process.ts index b7212eb..748b57f 100644 --- a/resources/src/api/process.ts +++ b/resources/src/api/process.ts @@ -1,11 +1,12 @@ +import { ProcessItem } from "../types/process/process"; import api from "./api"; export function getProcessList() { - return api.get("/process", undefined).then((res) => res); + return api.get("/process", undefined).then((res) => res); } export function getProcessListWait() { - return api.get("/process/wait", undefined).then((res) => res); + return api.get("/process/wait", undefined).then((res) => res); } export function killProcessAll(uuid) { diff --git a/resources/src/components/process/ProcessCard.vue b/resources/src/components/process/ProcessCard.vue new file mode 100644 index 0000000..937bfb9 --- /dev/null +++ b/resources/src/components/process/ProcessCard.vue @@ -0,0 +1,206 @@ + + + + diff --git a/resources/src/main.ts b/resources/src/main.ts index d043e77..df4a587 100644 --- a/resources/src/main.ts +++ b/resources/src/main.ts @@ -22,12 +22,13 @@ import i18n from "./plugins/i18n"; import Vue3Lottie from "vue3-lottie"; import { autoAnimatePlugin } from '@formkit/auto-animate/vue' import permission from "./directives/permission" - +import * as echarts from 'echarts'; const pinia = createPinia(); pinia.use(piniaPersist); const app = createApp(App); +app.config.globalProperties.$echarts = echarts; app.directive('permission', permission); app.use(router); app.use(PerfectScrollbarPlugin); diff --git a/resources/src/types/process/process.ts b/resources/src/types/process/process.ts new file mode 100644 index 0000000..9b38f24 --- /dev/null +++ b/resources/src/types/process/process.ts @@ -0,0 +1,34 @@ +export interface ProcessItem { + name: string; + uuid: number; + startTime: Date; + user: string; + usage: Usage; + state: State; + termType: TermType; + cgroupEnable: boolean; + memoryLimit: number | null; + cpuLimit: number | null; +} + +export interface State { + state: number; + info: Info; +} + +export enum Info { + Empty = "", + 重启次数异常 = "重启次数异常", +} + +export enum TermType { + Pty = "pty", +} + +export interface Usage { + cpuCapacity: number; + memCapacity: number; + cpu: number[] | null; + mem: number[] | null; + time: string[] | null; +} diff --git a/resources/src/views/process/Process.vue b/resources/src/views/process/Process.vue index e519b41..4f2d176 100644 --- a/resources/src/views/process/Process.vue +++ b/resources/src/views/process/Process.vue @@ -1,3 +1,48 @@ - + - + + +