新增 异步任务终止接口

This commit is contained in:
Suwings 2022-03-16 09:30:32 +08:00
parent aeefceb220
commit abbc728faa
2 changed files with 37 additions and 5 deletions

View File

@ -61,6 +61,7 @@ export const API_INSTANCE_UPDATE = `${API_URL}/api/protected_instance/instance_u
export const API_INSTANCE_RESTART = `${API_URL}/api/protected_instance/restart`;
export const API_INSTANCE_OUTPUT = `${API_URL}/api/protected_instance/outputlog`;
export const API_INSTANCE_ASYNC_TASK = `${API_URL}/api/protected_instance/asynchronous`;
export const API_INSTANCE_ASYNC_STOP = `${API_URL}/api/protected_instance/stop_asynchronous`;
export const API_PROCESS_CONFIG_LIST = `${API_URL}/api/protected_instance/process_config/list`;
export const API_PROCESS_CONFIG_FILE = `${API_URL}/api/protected_instance/process_config/file`;

View File

@ -54,7 +54,7 @@
<template #default>
<div v-loading="busy">
<el-row type="flex" justify="space-between" :gutter="10">
<el-col :lg="24">
<el-col :lg="24" v-show="instanceInfo.status !== -1">
<el-popconfirm title="确定执行此操作?" @confirm="openInstance">
<template #reference>
<el-button
@ -68,7 +68,7 @@
</template>
</el-popconfirm>
</el-col>
<el-col :lg="24">
<el-col :lg="24" v-show="instanceInfo.status !== -1">
<el-popconfirm title="确定执行此操作?" @confirm="stopInstance">
<template #reference>
<el-button
@ -82,7 +82,7 @@
</template>
</el-popconfirm>
</el-col>
<el-col :lg="24">
<el-col :lg="24" v-show="instanceInfo.status !== -1">
<el-popconfirm title="确定执行此操作?" @confirm="restartInstance">
<template #reference>
<el-button
@ -97,7 +97,7 @@
</template>
</el-popconfirm>
</el-col>
<el-col :lg="24">
<el-col :lg="24" v-show="instanceInfo.status !== -1">
<el-popconfirm title="确定执行此操作?" @confirm="killInstance">
<template #reference>
<el-button
@ -113,6 +113,21 @@
</template>
</el-popconfirm>
</el-col>
<el-col :lg="24" v-show="instanceInfo.status === -1">
<el-popconfirm title="确定执行此操作?" @confirm="stopAsynchronousTask">
<template #reference>
<el-button
icon="el-icon-switch-button"
type="danger"
plain
style="width: 100%"
size="small"
class="row-mt"
>终止正在运行的任务
</el-button>
</template>
</el-popconfirm>
</el-col>
<el-col :lg="24" v-if="instanceInfo.config.updateCommand">
<el-popconfirm title="确定执行此操作?" @confirm="updateInstace">
<template #reference>
@ -453,7 +468,8 @@ import {
API_INSTANCE_UPDATE,
API_INSTANCE_STOP,
API_INSTANCE_OUTPUT,
API_INSTANCE_ASYNC_TASK
API_INSTANCE_ASYNC_TASK,
API_INSTANCE_ASYNC_STOP
} from "../service/common";
import router from "../router";
import { parseforwardAddress, request } from "../service/protocol";
@ -661,6 +677,21 @@ export default {
setTimeout(() => (this.busy = false), 200);
}
},
//
async stopAsynchronousTask() {
try {
await request({
method: "GET",
url: API_INSTANCE_ASYNC_STOP,
params: { remote_uuid: this.serviceUuid, uuid: this.instanceUuid }
});
} catch (error) {
this.$message({ message: error.toString(), type: "error" });
} finally {
setTimeout(() => (this.busy = false), 200);
}
},
//
async updateInstace() {
try {
await request({