fix: 解决容器、终端界面 ios 适配的问题 (#1385)

pull/1393/head
ssongliu 2023-06-15 18:00:17 +08:00 committed by GitHub
parent 80304937e1
commit 7918023322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 12 deletions

View File

@ -8,7 +8,7 @@
>
<template #header>
<DrawerHeader :header="$t('commons.button.log')" :resource="logSearch.container" :back="handleClose">
<template #extra>
<template #extra v-if="!mobile">
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen" plain></el-button>
</template>
</DrawerHeader>
@ -69,7 +69,7 @@
import { cleanContainerLog } from '@/api/modules/container';
import i18n from '@/lang';
import { dateFormatForName } from '@/utils/util';
import { onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
import { computed, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
import { Codemirror } from 'vue-codemirror';
import { javascript } from '@codemirror/lang-javascript';
import { oneDark } from '@codemirror/theme-one-dark';
@ -80,8 +80,10 @@ import screenfull from 'screenfull';
import { GlobalStore } from '@/store';
const extensions = [javascript(), oneDark];
const logVisiable = ref(false);
const mobile = computed(() => {
return globalStore.isMobile();
});
const logInfo = ref<string>('');
const view = shallowRef();
@ -124,15 +126,12 @@ function toggleFullscreen() {
screenfull.toggle();
}
}
screenfull.on('change', () => {
globalStore.isFullScreen = screenfull.isFullscreen;
});
const handleClose = async () => {
logVisiable.value = false;
terminalSocket.value.close();
};
watch(logVisiable, (val) => {
if (screenfull.isEnabled && !val) screenfull.exit();
if (screenfull.isEnabled && !val && !mobile.value) screenfull.exit();
});
const searchLogs = async () => {
if (!Number(logSearch.tail) || Number(logSearch.tail) <= 0) {
@ -192,6 +191,12 @@ const acceptParams = (props: DialogProps): void => {
logSearch.isWatch = false;
logSearch.container = props.container;
searchLogs();
if (!mobile.value) {
screenfull.on('change', () => {
globalStore.isFullScreen = screenfull.isFullscreen;
});
}
};
onBeforeUnmount(() => {

View File

@ -123,14 +123,14 @@
></el-empty>
</div>
</el-tabs>
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen"></el-button>
<el-button @click="toggleFullscreen" v-if="!mobile" class="fullScreen" icon="FullScreen"></el-button>
<HostDialog ref="dialogRef" @on-conn-terminal="onConnTerminal" @load-host-tree="loadHostTree" />
</div>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, watch, nextTick } from 'vue';
import { ref, getCurrentInstance, watch, nextTick, computed } from 'vue';
import Terminal from '@/components/terminal/index.vue';
import HostDialog from '@/views/host/terminal/terminal/host-create.vue';
import type Node from 'element-plus/es/components/tree/src/model/node';
@ -145,15 +145,15 @@ import { GlobalStore } from '@/store';
const dialogRef = ref();
const ctx = getCurrentInstance() as any;
const globalStore = GlobalStore();
const mobile = computed(() => {
return globalStore.isMobile();
});
function toggleFullscreen() {
if (screenfull.isEnabled) {
screenfull.toggle();
}
}
screenfull.on('change', () => {
globalStore.isFullScreen = screenfull.isFullscreen;
});
const localHostID = ref();
@ -209,6 +209,12 @@ const acceptParams = async () => {
}
}
}
if (!mobile.value) {
screenfull.on('change', () => {
globalStore.isFullScreen = screenfull.isFullscreen;
});
}
};
const cleanTimer = () => {
clearInterval(Number(timer));