Feat: restart instance

This commit is contained in:
Lazy 2023-11-13 15:01:34 +08:00
parent d250c298bb
commit ddb20ce11d
2 changed files with 22 additions and 2 deletions

View File

@ -73,6 +73,21 @@ export const stopInstance = useDefineApi<
method: "GET"
});
export const restartInstance = useDefineApi<
{
params: {
uuid: string;
remote_uuid: string;
};
},
{
instanceUuid: string;
}
>({
url: "/api/protected_instance/restart",
method: "GET"
});
// 更新实例设置(普通用户)
export const updateInstanceConfig = useDefineApi<
{

View File

@ -18,7 +18,7 @@ import { onMounted, computed, ref } from "vue";
import { useLayoutCardTools } from "@/hooks/useCardTools";
import { getRandomId } from "../../tools/randId";
import IconBtn from "@/components/IconBtn.vue";
import { openInstance, stopInstance } from "@/services/apis/instance";
import { openInstance, stopInstance, restartInstance } from "@/services/apis/instance";
import { CloseOutlined } from "@ant-design/icons-vue";
import { GLOBAL_INSTANCE_NAME } from "../../config/const";
import { INSTANCE_STATUS_TEXT } from "../../hooks/useInstance";
@ -95,7 +95,12 @@ const instanceOperations = arrayFilter([
title: t("TXT_CODE_47dcfa5"),
icon: ReconciliationOutlined,
click: () => {
console.log(3);
restartInstance().execute({
params: {
uuid: instanceId || "",
remote_uuid: daemonId || ""
}
});
}
},
{