diff --git a/package.json b/package.json index 66f7290..3d6d007 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "pinia": "^3.0.2", "tdesign-mobile-vue": "^1.13.2", "timi-tdesign-mobile": "0.0.9", - "timi-web": "0.0.16", + "timi-web": "0.0.17", "ts-node": "^10.9.2", "vue": "^3.5.16", "vue-router": "4.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3870e7..fdc0730 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: 0.0.9 version: 0.0.9(typescript@5.8.3) timi-web: - specifier: 0.0.16 - version: 0.0.16 + specifier: 0.0.17 + version: 0.0.17 ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@24.12.0)(typescript@5.8.3) @@ -1832,8 +1832,8 @@ packages: resolution: {integrity: sha512-SV8m/FsLsEabSmJ/NvI650fLyb/JCLz7JUNQrkWeoo5xICElsN4x39L3n4lTzu6ARidjpT6uA+XEmA4wnyQmuA==} engines: {node: '>=16.0.0'} - timi-web@0.0.16: - resolution: {integrity: sha512-Tyma/szWvAmPTq7HRtXtRA0Of+YI1Acko96wsosJFRyO+tN1gDEUrwMoY1l2Uw8Q1g6Yv7huS6E6DLd9fA28og==} + timi-web@0.0.17: + resolution: {integrity: sha512-6ycsqfnl+zeQkgOICjhhJYHoo3CtCxnhaNFFirNLVfX/VrrTDjW7DiR+/W8bouZzx6AR19fZKyG+UE0BKKBURg==} engines: {node: '>=16.0.0'} tinycolor2@1.6.0: @@ -3875,7 +3875,7 @@ snapshots: transitivePeerDependencies: - typescript - timi-web@0.0.16: + timi-web@0.0.17: dependencies: axios: 1.13.5 less: 4.5.1 diff --git a/src/api/DockerAPI.ts b/src/api/DockerAPI.ts new file mode 100644 index 0000000..777a9df --- /dev/null +++ b/src/api/DockerAPI.ts @@ -0,0 +1,39 @@ +import { axios } from "timi-web"; +import { useSettingStore } from "@/store/settingStore"; +import type { + DockerContainerHistoryView, + DockerContainerStatusView, + DockerContainerSummaryView +} from "@/types/Docker"; + +async function getContainers(): Promise { + const settingStore = useSettingStore(); + return await axios.get(`${settingStore.resolveBaseURL()}/system/docker/container`, { + timeout: 15000 + }); +} + +async function getContainerStatus(containerId: string): Promise { + const settingStore = useSettingStore(); + return await axios.get(`${settingStore.resolveBaseURL()}/system/docker/container/${encodeURIComponent(containerId)}/status`, { + timeout: 15000 + }); +} + +async function getContainerHistory(containerId: string, params?: { + window?: string; +}): Promise { + const settingStore = useSettingStore(); + return await axios.get(`${settingStore.resolveBaseURL()}/system/docker/container/${encodeURIComponent(containerId)}/history`, { + params: { + ...(params?.window ? { window: params.window } : {}) + }, + timeout: 15000 + }); +} + +export default { + getContainers, + getContainerStatus, + getContainerHistory +}; diff --git a/src/components/TCellInfo.vue b/src/components/TCellInfo.vue index 1419327..af2a5d2 100644 --- a/src/components/TCellInfo.vue +++ b/src/components/TCellInfo.vue @@ -2,12 +2,22 @@