新增功能:使用cli控制实例启停、在浏览器中打开网页面板
This commit is contained in:
parent
de2c2af2bd
commit
5576f8de39
3 changed files with 98 additions and 33 deletions
|
@ -1,7 +1,17 @@
|
|||
<script setup>
|
||||
import { useConfigStore } from '@/stores/config.js'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { Add, Pencil, Play, Folder, TrashOutline, Archive } from '@vicons/ionicons5'
|
||||
import {
|
||||
Add,
|
||||
Pencil,
|
||||
Play,
|
||||
Folder,
|
||||
TrashOutline,
|
||||
Archive,
|
||||
Browsers,
|
||||
Stop,
|
||||
Search
|
||||
} from '@vicons/ionicons5'
|
||||
|
||||
const notification = useNotification()
|
||||
|
||||
|
@ -64,13 +74,11 @@ function end_update_instance_name() {
|
|||
function open_folder(path) {
|
||||
pywebview.api.open_folder(path)
|
||||
}
|
||||
function start_instance(instance) {
|
||||
pywebview.api.run('webview', 'mower-ng', {
|
||||
instance_path: instance.path
|
||||
})
|
||||
function cli(command, instance) {
|
||||
pywebview.api.cli_control(command, instance.path)
|
||||
}
|
||||
function start_checked_instance() {
|
||||
pywebview.api.start_checked_instance()
|
||||
function batch_cli_control(command) {
|
||||
pywebview.api.batch_cli_control(command)
|
||||
}
|
||||
async function handle_migrate(key) {
|
||||
if (key == 'default') {
|
||||
|
@ -132,7 +140,7 @@ async function handle_migrate(key) {
|
|||
class="launch-btn"
|
||||
type="primary"
|
||||
secondary
|
||||
@click="start_checked_instance"
|
||||
@click="batch_cli_control('launch')"
|
||||
:disabled="!check_all && !check_part"
|
||||
>
|
||||
<template #icon>
|
||||
|
@ -140,6 +148,18 @@ async function handle_migrate(key) {
|
|||
</template>
|
||||
启动所选实例
|
||||
</n-button>
|
||||
<n-button
|
||||
class="launch-btn"
|
||||
type="error"
|
||||
secondary
|
||||
@click="batch_cli_control('exit')"
|
||||
:disabled="!check_all && !check_part"
|
||||
>
|
||||
<template #icon>
|
||||
<n-icon :component="Stop"></n-icon>
|
||||
</template>
|
||||
停止所选实例
|
||||
</n-button>
|
||||
<n-dropdown trigger="click" :options="migrate_options" @select="handle_migrate">
|
||||
<n-button class="launch-btn" type="primary" secondary>
|
||||
<template #icon>
|
||||
|
@ -194,11 +214,26 @@ async function handle_migrate(key) {
|
|||
</n-space>
|
||||
<template #suffix>
|
||||
<n-space :wrap="false">
|
||||
<n-button type="primary" size="small" @click="start_instance(item)">
|
||||
<n-button type="primary" ghost size="small" @click="cli('status', item)">
|
||||
<template #icon>
|
||||
<n-icon :component="Search"></n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-button type="primary" size="small" @click="cli('launch', item)">
|
||||
<template #icon>
|
||||
<n-icon :component="Play"></n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-button type="primary" ghost size="small" @click="cli('webui', item)">
|
||||
<template #icon>
|
||||
<n-icon :component="Browsers"></n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-button type="error" ghost size="small" @click="cli('exit', item)">
|
||||
<template #icon>
|
||||
<n-icon :component="Stop"></n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
<n-popconfirm @positive-click="delete_instance(index, item.path)">
|
||||
<template #trigger>
|
||||
<n-button type="error" ghost size="small">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue