style: change runtime terminal style (#8764)

This commit is contained in:
CityFun 2025-05-21 11:56:12 +08:00 committed by GitHub
parent 057dcaf2e5
commit b308e4632a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 49 deletions

View file

@ -322,7 +322,7 @@
"installed": false "installed": false
}, },
{ {
"name": "sg11", "name": "sg16",
"check": "SourceGuardian", "check": "SourceGuardian",
"file": "sourceguardian.so", "file": "sourceguardian.so",
"versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"], "versions": ["56","70", "71", "72", "73", "74", "80", "81", "82", "83","84"],

View file

@ -4,29 +4,28 @@
:header="$t('menu.terminal')" :header="$t('menu.terminal')"
@close="handleClose" @close="handleClose"
:resource="title" :resource="title"
size="large" fullScreen
:size="globalStore.isFullScreen ? 'full' : 'large'"
> >
<template #content> <template #content>
<el-form ref="formRef" :model="form" label-position="top"> <Terminal style="height: calc(100vh - 180px)" ref="terminalRef" v-if="terminalOpen"></Terminal>
<el-button v-if="!terminalOpen" @click="initTerm(formRef)"> </template>
{{ $t('commons.button.conn') }} <template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="handleClose">
{{ $t('commons.button.disConn') }}
</el-button> </el-button>
<el-button v-else @click="onClose()">{{ $t('commons.button.disConn') }}</el-button> </span>
<Terminal
style="height: calc(100vh - 200px); margin-top: 18px"
ref="terminalRef"
v-if="terminalOpen"
></Terminal>
</el-form>
</template> </template>
</DrawerPro> </DrawerPro>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, nextTick } from 'vue'; import { reactive, ref, nextTick } from 'vue';
import { ElForm, FormInstance } from 'element-plus';
import Terminal from '@/components/terminal/index.vue'; import Terminal from '@/components/terminal/index.vue';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const title = ref(); const title = ref();
const terminalVisible = ref(false); const terminalVisible = ref(false);
const terminalOpen = ref(false); const terminalOpen = ref(false);
@ -36,7 +35,6 @@ const form = reactive({
user: '', user: '',
containerID: '', containerID: '',
}); });
const formRef = ref();
const terminalRef = ref<InstanceType<typeof Terminal> | null>(null); const terminalRef = ref<InstanceType<typeof Terminal> | null>(null);
interface DialogProps { interface DialogProps {
@ -50,14 +48,10 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
form.isCustom = false; form.isCustom = false;
form.user = ''; form.user = '';
form.command = '/bin/bash'; form.command = '/bin/bash';
terminalOpen.value = false; initTerm();
initTerm(formRef.value);
}; };
const initTerm = (formEl: FormInstance | undefined) => { const initTerm = async () => {
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
terminalOpen.value = true; terminalOpen.value = true;
await nextTick(); await nextTick();
terminalRef.value!.acceptParams({ terminalRef.value!.acceptParams({
@ -66,7 +60,6 @@ const initTerm = (formEl: FormInstance | undefined) => {
error: '', error: '',
initCmd: '', initCmd: '',
}); });
});
}; };
const onClose = () => { const onClose = () => {

View file

@ -79,12 +79,12 @@
:label="$t('commons.table.date')" :label="$t('commons.table.date')"
:formatter="dateFormat" :formatter="dateFormat"
show-overflow-tooltip show-overflow-tooltip
min-width="120" width="180"
fix fix
/> />
<fu-table-operations <fu-table-operations
:ellipsis="mobile ? 0 : 5" :ellipsis="mobile ? 0 : 3"
:min-width="mobile ? 'auto' : 300" :width="mobile ? 'auto' : 200"
:buttons="buttons" :buttons="buttons"
fixed="right" fixed="right"
:label="$t('commons.table.operate')" :label="$t('commons.table.operate')"
@ -160,6 +160,15 @@ const supervisorRef = ref();
const terminalRef = ref(); const terminalRef = ref();
const buttons = [ const buttons = [
{
label: i18n.global.t('commons.button.edit'),
click: function (row: Runtime.Runtime) {
openDetail(row);
},
disabled: function (row: Runtime.Runtime) {
return disabledButton(row, 'edit');
},
},
{ {
label: i18n.global.t('runtime.extension'), label: i18n.global.t('runtime.extension'),
click: function (row: Runtime.Runtime) { click: function (row: Runtime.Runtime) {
@ -169,6 +178,15 @@ const buttons = [
return disabledButton(row, 'extension'); return disabledButton(row, 'extension');
}, },
}, },
{
label: i18n.global.t('menu.terminal'),
click: function (row: Runtime.Runtime) {
openTerminal(row);
},
disabled: function (row: Runtime.Runtime) {
return disabledButton(row, 'config');
},
},
{ {
label: i18n.global.t('commons.operate.stop'), label: i18n.global.t('commons.operate.stop'),
click: function (row: Runtime.Runtime) { click: function (row: Runtime.Runtime) {
@ -196,15 +214,6 @@ const buttons = [
return disabledButton(row, 'restart'); return disabledButton(row, 'restart');
}, },
}, },
{
label: i18n.global.t('commons.button.edit'),
click: function (row: Runtime.Runtime) {
openDetail(row);
},
disabled: function (row: Runtime.Runtime) {
return disabledButton(row, 'edit');
},
},
{ {
label: i18n.global.t('menu.config'), label: i18n.global.t('menu.config'),
click: function (row: Runtime.Runtime) { click: function (row: Runtime.Runtime) {
@ -223,15 +232,7 @@ const buttons = [
return disabledButton(row, 'config'); return disabledButton(row, 'config');
}, },
}, },
{
label: i18n.global.t('menu.terminal'),
click: function (row: Runtime.Runtime) {
openTerminal(row);
},
disabled: function (row: Runtime.Runtime) {
return disabledButton(row, 'config');
},
},
{ {
label: i18n.global.t('commons.button.delete'), label: i18n.global.t('commons.button.delete'),
click: function (row: Runtime.Runtime) { click: function (row: Runtime.Runtime) {