1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: 增加全屏按钮

This commit is contained in:
ssongliu 2022-09-01 18:11:23 +08:00 committed by ssongliu
parent bea9321fc8
commit d312dc998f
4 changed files with 17 additions and 3 deletions

View File

@ -5842,6 +5842,11 @@
"neo-async": "^2.6.2" "neo-async": "^2.6.2"
} }
}, },
"screenfull": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/screenfull/-/screenfull-6.0.2.tgz",
"integrity": "sha512-AQdy8s4WhNvUZ6P8F6PB21tSPIYKniic+Ogx0AacBMjKP1GUHN2E9URxQHtCusiwxudnCKkdy4GrHXPPJSkCCw=="
},
"select": { "select": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",

View File

@ -34,6 +34,7 @@
"pinia-plugin-persistedstate": "^1.6.1", "pinia-plugin-persistedstate": "^1.6.1",
"qs": "^6.10.3", "qs": "^6.10.3",
"sass-loader": "^13.0.2", "sass-loader": "^13.0.2",
"screenfull": "^6.0.2",
"unplugin-vue-define-options": "^0.7.3", "unplugin-vue-define-options": "^0.7.3",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-i18n": "^9.1.9", "vue-i18n": "^9.1.9",

View File

@ -3,7 +3,7 @@
<transition-group name="breadcrumb" mode="out-in"> <transition-group name="breadcrumb" mode="out-in">
<el-breadcrumb-item :to="{ path: HOME_URL }" key="/home">{{ $t('menu.home') }}</el-breadcrumb-item> <el-breadcrumb-item :to="{ path: HOME_URL }" key="/home">{{ $t('menu.home') }}</el-breadcrumb-item>
<el-breadcrumb-item v-for="item in matched" :key="item.path" :to="{ path: item.path }"> <el-breadcrumb-item v-for="item in matched" :key="item.path" :to="{ path: item.path }">
{{ $t(item.meta?.title as string) }} {{ item.meta?.title }}
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
</el-breadcrumb> </el-breadcrumb>

View File

@ -104,6 +104,7 @@
></el-empty> ></el-empty>
</div> </div>
</el-tabs> </el-tabs>
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen"></el-button>
<el-dialog v-model="connVisiable" :title="$t('terminal.addHost')" width="30%"> <el-dialog v-model="connVisiable" :title="$t('terminal.addHost')" width="30%">
<el-form ref="hostInfoRef" label-width="100px" label-position="left" :model="hostInfo" :rules="rules"> <el-form ref="hostInfoRef" label-width="100px" label-position="left" :model="hostInfo" :rules="rules">
@ -159,6 +160,8 @@ import { ElMessage } from 'element-plus';
import Terminal from '@/views/terminal/terminal/index.vue'; import Terminal from '@/views/terminal/terminal/index.vue';
import type Node from 'element-plus/es/components/tree/src/model/node'; import type Node from 'element-plus/es/components/tree/src/model/node';
import { ElTree } from 'element-plus'; import { ElTree } from 'element-plus';
import screenfull from 'screenfull';
let timer: NodeJS.Timer | null = null; let timer: NodeJS.Timer | null = null;
const terminalValue = ref(); const terminalValue = ref();
@ -211,6 +214,12 @@ let hostInfo = reactive<Host.HostOperate>({
const ctx = getCurrentInstance() as any; const ctx = getCurrentInstance() as any;
function toggleFullscreen() {
if (screenfull.isEnabled) {
screenfull.toggle();
}
}
const handleTabsRemove = (targetName: string, action: 'remove' | 'add') => { const handleTabsRemove = (targetName: string, action: 'remove' | 'add') => {
if (action !== 'remove') { if (action !== 'remove') {
return; return;
@ -353,8 +362,7 @@ function changeFrameHeight() {
function syncTerminal() { function syncTerminal() {
for (const terminal of terminalTabs.value) { for (const terminal of terminalTabs.value) {
if (ctx && ctx.refs[`Ref${terminal.key}`]) { if (ctx && ctx.refs[`Ref${terminal.key}`][0]) {
console.log(ctx.refs[`Ref${terminal.key}`][0]);
terminal.status = ctx.refs[`Ref${terminal.key}`][0].isWsOpen() ? 'online' : 'closed'; terminal.status = ctx.refs[`Ref${terminal.key}`][0].isWsOpen() ? 'online' : 'closed';
} }
} }