mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
fix: 解决容器、终端界面 ios 适配的问题 (#1385)
This commit is contained in:
parent
80304937e1
commit
7918023322
2 changed files with 23 additions and 12 deletions
|
@ -8,7 +8,7 @@
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<DrawerHeader :header="$t('commons.button.log')" :resource="logSearch.container" :back="handleClose">
|
<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>
|
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen" plain></el-button>
|
||||||
</template>
|
</template>
|
||||||
</DrawerHeader>
|
</DrawerHeader>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
import { cleanContainerLog } from '@/api/modules/container';
|
import { cleanContainerLog } from '@/api/modules/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { dateFormatForName } from '@/utils/util';
|
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 { Codemirror } from 'vue-codemirror';
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
import { oneDark } from '@codemirror/theme-one-dark';
|
import { oneDark } from '@codemirror/theme-one-dark';
|
||||||
|
@ -80,8 +80,10 @@ import screenfull from 'screenfull';
|
||||||
import { GlobalStore } from '@/store';
|
import { GlobalStore } from '@/store';
|
||||||
|
|
||||||
const extensions = [javascript(), oneDark];
|
const extensions = [javascript(), oneDark];
|
||||||
|
|
||||||
const logVisiable = ref(false);
|
const logVisiable = ref(false);
|
||||||
|
const mobile = computed(() => {
|
||||||
|
return globalStore.isMobile();
|
||||||
|
});
|
||||||
|
|
||||||
const logInfo = ref<string>('');
|
const logInfo = ref<string>('');
|
||||||
const view = shallowRef();
|
const view = shallowRef();
|
||||||
|
@ -124,15 +126,12 @@ function toggleFullscreen() {
|
||||||
screenfull.toggle();
|
screenfull.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screenfull.on('change', () => {
|
|
||||||
globalStore.isFullScreen = screenfull.isFullscreen;
|
|
||||||
});
|
|
||||||
const handleClose = async () => {
|
const handleClose = async () => {
|
||||||
logVisiable.value = false;
|
logVisiable.value = false;
|
||||||
terminalSocket.value.close();
|
terminalSocket.value.close();
|
||||||
};
|
};
|
||||||
watch(logVisiable, (val) => {
|
watch(logVisiable, (val) => {
|
||||||
if (screenfull.isEnabled && !val) screenfull.exit();
|
if (screenfull.isEnabled && !val && !mobile.value) screenfull.exit();
|
||||||
});
|
});
|
||||||
const searchLogs = async () => {
|
const searchLogs = async () => {
|
||||||
if (!Number(logSearch.tail) || Number(logSearch.tail) <= 0) {
|
if (!Number(logSearch.tail) || Number(logSearch.tail) <= 0) {
|
||||||
|
@ -192,6 +191,12 @@ const acceptParams = (props: DialogProps): void => {
|
||||||
logSearch.isWatch = false;
|
logSearch.isWatch = false;
|
||||||
logSearch.container = props.container;
|
logSearch.container = props.container;
|
||||||
searchLogs();
|
searchLogs();
|
||||||
|
|
||||||
|
if (!mobile.value) {
|
||||||
|
screenfull.on('change', () => {
|
||||||
|
globalStore.isFullScreen = screenfull.isFullscreen;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
|
|
@ -123,14 +123,14 @@
|
||||||
></el-empty>
|
></el-empty>
|
||||||
</div>
|
</div>
|
||||||
</el-tabs>
|
</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" />
|
<HostDialog ref="dialogRef" @on-conn-terminal="onConnTerminal" @load-host-tree="loadHostTree" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 Terminal from '@/components/terminal/index.vue';
|
||||||
import HostDialog from '@/views/host/terminal/terminal/host-create.vue';
|
import HostDialog from '@/views/host/terminal/terminal/host-create.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';
|
||||||
|
@ -145,15 +145,15 @@ import { GlobalStore } from '@/store';
|
||||||
const dialogRef = ref();
|
const dialogRef = ref();
|
||||||
const ctx = getCurrentInstance() as any;
|
const ctx = getCurrentInstance() as any;
|
||||||
const globalStore = GlobalStore();
|
const globalStore = GlobalStore();
|
||||||
|
const mobile = computed(() => {
|
||||||
|
return globalStore.isMobile();
|
||||||
|
});
|
||||||
|
|
||||||
function toggleFullscreen() {
|
function toggleFullscreen() {
|
||||||
if (screenfull.isEnabled) {
|
if (screenfull.isEnabled) {
|
||||||
screenfull.toggle();
|
screenfull.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screenfull.on('change', () => {
|
|
||||||
globalStore.isFullScreen = screenfull.isFullscreen;
|
|
||||||
});
|
|
||||||
|
|
||||||
const localHostID = ref();
|
const localHostID = ref();
|
||||||
|
|
||||||
|
@ -209,6 +209,12 @@ const acceptParams = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mobile.value) {
|
||||||
|
screenfull.on('change', () => {
|
||||||
|
globalStore.isFullScreen = screenfull.isFullscreen;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const cleanTimer = () => {
|
const cleanTimer = () => {
|
||||||
clearInterval(Number(timer));
|
clearInterval(Number(timer));
|
||||||
|
|
Loading…
Add table
Reference in a new issue