feat: 完成异步任务跟踪架构基础

This commit is contained in:
Junyan Qin
2024-11-01 22:41:26 +08:00
parent 2f05f5b456
commit 6d2a4c038d
16 changed files with 395 additions and 101 deletions
+14 -2
View File
@@ -52,7 +52,7 @@
</v-card>
<div class="plugins-container">
<PluginCard class="plugin-card" v-for="plugin in plugins" :key="plugin.name" :plugin="plugin"
@toggle="togglePlugin" />
@toggle="togglePlugin" @update="updatePlugin" />
</div>
</template>
@@ -88,7 +88,7 @@ const refresh = () => {
onMounted(refresh)
const togglePlugin = (plugin) => {
proxy.$axios.put(`/plugins/toggle/${plugin.author}/${plugin.name}`, {
proxy.$axios.put(`/plugins/${plugin.author}/${plugin.name}/toggle`, {
target_enabled: !plugin.enabled
}).then(res => {
if (res.data.code != 0) {
@@ -101,6 +101,18 @@ const togglePlugin = (plugin) => {
})
}
const updatePlugin = (plugin) => {
proxy.$axios.post(`/plugins/${plugin.author}/${plugin.name}/update`).then(res => {
if (res.data.code != 0) {
snackbar.error(res.data.msg)
return
}
snackbar.success(`已添加更新任务 请到任务列表查看进度`)
}).catch(error => {
snackbar.error(error)
})
}
const isOrchestrationDialogActive = ref(false)
const cancelOrderChanges = () => {