mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-02-05 15:29:35 +08:00
Optimize: instance status
This commit is contained in:
parent
7942f310f7
commit
6abe0c37d0
@ -1,3 +1,4 @@
|
|||||||
|
import { t } from "@/lang/i18n";
|
||||||
export const CARD_FIXED_HEIGHT = 200;
|
export const CARD_FIXED_HEIGHT = 200;
|
||||||
|
|
||||||
export const TERMINAL_CODE = [
|
export const TERMINAL_CODE = [
|
||||||
@ -11,3 +12,11 @@ export const TERMINAL_CODE = [
|
|||||||
"KS_C_5601",
|
"KS_C_5601",
|
||||||
"UTF-16"
|
"UTF-16"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const INSTANCE_STATUS = {
|
||||||
|
"-1": t("状态未知"),
|
||||||
|
"0": t("已停止"),
|
||||||
|
"1": t("正在停止"),
|
||||||
|
"2": t("正在启动"),
|
||||||
|
"3": t("正在运行")
|
||||||
|
};
|
||||||
|
@ -4,6 +4,7 @@ import { onMounted } from "vue";
|
|||||||
import type { LayoutCard } from "@/types";
|
import type { LayoutCard } from "@/types";
|
||||||
import { userInfoApi } from "@/services/apis/index";
|
import { userInfoApi } from "@/services/apis/index";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { INSTANCE_STATUS } from "@/types/const";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
card: LayoutCard;
|
card: LayoutCard;
|
||||||
@ -13,14 +14,6 @@ const router = useRouter();
|
|||||||
|
|
||||||
const { execute, state } = userInfoApi();
|
const { execute, state } = userInfoApi();
|
||||||
|
|
||||||
const status = {
|
|
||||||
"-1": t("状态未知"),
|
|
||||||
"0": t("已停止"),
|
|
||||||
"1": t("正在停止"),
|
|
||||||
"2": t("正在启动"),
|
|
||||||
"3": t("正在运行")
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("实例名称"),
|
title: t("实例名称"),
|
||||||
@ -32,7 +25,7 @@ const columns = [
|
|||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
customRender: (e: { text: "-1" | "1" | "2" | "3" }) => {
|
customRender: (e: { text: "-1" | "1" | "2" | "3" }) => {
|
||||||
return status[e.text] || e.text;
|
return INSTANCE_STATUS[e.text] || e.text;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import { useLayoutCardTools } from "@/hooks/useCardTools";
|
|||||||
import { updateUserInstance } from "@/services/apis";
|
import { updateUserInstance } from "@/services/apis";
|
||||||
import UserResources from "./dialog/UserResources.vue";
|
import UserResources from "./dialog/UserResources.vue";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
|
import { INSTANCE_STATUS } from "@/types/const";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
card: LayoutCard;
|
card: LayoutCard;
|
||||||
@ -113,6 +114,9 @@ const columns = computed(() => {
|
|||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
minWidth: "200px",
|
minWidth: "200px",
|
||||||
|
customRender: (e: { text: "-1" | "1" | "2" | "3" }) => {
|
||||||
|
return INSTANCE_STATUS[e.text] || e.text;
|
||||||
|
},
|
||||||
condition: () => !screen.isPhone.value
|
condition: () => !screen.isPhone.value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user