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

pref: 调整部分界面的高度问题 (#4534)

This commit is contained in:
ssongliu 2024-04-16 18:59:14 +08:00 committed by GitHub
parent 4814a76c47
commit 9e44db53a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 75 additions and 12 deletions

View File

@ -656,7 +656,6 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, containerType,
commandArg = append(commandArg, "-f") commandArg = append(commandArg, "-f")
} }
if !follow { if !follow {
commandArg = append(commandArg, "2>&1")
cmd := exec.Command(commandName, commandArg...) cmd := exec.Command(commandName, commandArg...)
stdout, _ := cmd.CombinedOutput() stdout, _ := cmd.CombinedOutput()
if !utf8.Valid(stdout) { if !utf8.Valid(stdout) {

View File

@ -31,7 +31,7 @@
:placeholder="$t('commons.msg.noneData')" :placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="4" :tabSize="4"
style="margin-top: 10px; height: calc(100vh - 375px)" :style="{ height: `calc(100vh - ${loadHeight()})`, 'margin-top': '10px' }"
:lineWrapping="true" :lineWrapping="true"
:matchBrackets="true" :matchBrackets="true"
theme="cobalt" theme="cobalt"
@ -53,6 +53,8 @@ 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';
import { MsgError, MsgSuccess } from '@/utils/message'; import { MsgError, MsgSuccess } from '@/utils/message';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const extensions = [javascript(), oneDark]; const extensions = [javascript(), oneDark];
@ -63,6 +65,10 @@ const handleReady = (payload) => {
}; };
const terminalSocket = ref<WebSocket>(); const terminalSocket = ref<WebSocket>();
const loadHeight = () => {
return globalStore.openMenuTabs ? '405px' : '375px';
};
const logSearch = reactive({ const logSearch = reactive({
isWatch: false, isWatch: false,
container: '', container: '',

View File

@ -170,7 +170,7 @@
placeholder="# The Docker configuration file does not exist or is empty (/etc/docker/daemon.json)" placeholder="# The Docker configuration file does not exist or is empty (/etc/docker/daemon.json)"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="4" :tabSize="4"
style="margin-top: 10px; height: calc(100vh - 430px)" :style="{ height: `calc(100vh - ${loadHeight()})`, 'margin-top': '10px' }"
:lineWrapping="true" :lineWrapping="true"
:matchBrackets="true" :matchBrackets="true"
theme="cobalt" theme="cobalt"
@ -264,6 +264,8 @@ import {
import { getSettingInfo } from '@/api/modules/setting'; import { getSettingInfo } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { checkNumberRange } from '@/global/form-rules'; import { checkNumberRange } from '@/global/form-rules';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const unset = ref(i18n.global.t('setting.unSetting')); const unset = ref(i18n.global.t('setting.unSetting'));
const submitInput = ref(); const submitInput = ref();
@ -326,6 +328,10 @@ const onSaveFile = async () => {
confirmDialogRefFile.value!.acceptParams(params); confirmDialogRefFile.value!.acceptParams(params);
}; };
const loadHeight = () => {
return globalStore.openMenuTabs ? '450px' : '430px';
};
const onChangeMirrors = () => { const onChangeMirrors = () => {
mirrorRef.value.acceptParams({ mirrors: form.mirrors }); mirrorRef.value.acceptParams({ mirrors: form.mirrors });
}; };

View File

@ -57,7 +57,7 @@
:placeholder="$t('commons.msg.noneData')" :placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="4" :tabSize="4"
style="margin-top: 10px; height: calc(100vh - 375px)" :style="{ height: `calc(100vh - ${loadHeight()})`, 'margin-top': '10px' }"
:lineWrapping="true" :lineWrapping="true"
:matchBrackets="true" :matchBrackets="true"
theme="cobalt" theme="cobalt"
@ -153,6 +153,8 @@ import { Rules } from '@/global/form-rules';
import i18n from '@/lang'; import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import router from '@/routers'; import router from '@/routers';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const loading = ref(false); const loading = ref(false);
@ -196,6 +198,10 @@ const jumpToConf = async () => {
loadMysqlConf(); loadMysqlConf();
}; };
const loadHeight = () => {
return globalStore.openMenuTabs ? '405px' : '375px';
};
const jumpToSlowlog = async () => { const jumpToSlowlog = async () => {
activeName.value = 'slowLog'; activeName.value = 'slowLog';
loadSlowLogs(); loadSlowLogs();

View File

@ -56,6 +56,8 @@ import { loadDBFile, updateMysqlVariables } from '@/api/modules/database';
import { dateFormatForName, downloadWithContent } from '@/utils/util'; import { dateFormatForName, downloadWithContent } from '@/utils/util';
import i18n from '@/lang'; import i18n from '@/lang';
import { MsgError, MsgInfo, MsgSuccess } from '@/utils/message'; import { MsgError, MsgInfo, MsgSuccess } from '@/utils/message';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const extensions = [javascript(), oneDark]; const extensions = [javascript(), oneDark];
const slowLogs = ref(); const slowLogs = ref();
@ -120,7 +122,18 @@ const handleSlowLogs = async () => {
}; };
const getDynamicHeight = () => { const getDynamicHeight = () => {
return variables.slow_query_log === 'ON' ? `calc(100vh - 437px)` : `calc(100vh - 383px)`; if (variables.slow_query_log === 'ON') {
if (globalStore.openMenuTabs) {
return `calc(100vh - 467px)`;
} else {
return `calc(100vh - 437px)`;
}
}
if (globalStore.openMenuTabs) {
return `calc(100vh - 413px)`;
} else {
return `calc(100vh - 383px)`;
}
}; };
const changeSlowLogs = () => { const changeSlowLogs = () => {

View File

@ -33,7 +33,7 @@
:placeholder="$t('commons.msg.noneData')" :placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="8" :tabSize="8"
style="margin-top: 10px; height: calc(100vh - 375px)" :style="{ height: `calc(100vh - ${loadHeight()})`, 'margin-top': '10px' }"
:lineWrapping="true" :lineWrapping="true"
:matchBrackets="true" :matchBrackets="true"
theme="cobalt" theme="cobalt"
@ -104,6 +104,8 @@ import { Rules } from '@/global/form-rules';
import i18n from '@/lang'; import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import router from '@/routers'; import router from '@/routers';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const loading = ref(false); const loading = ref(false);
@ -134,6 +136,10 @@ const props = withDefaults(defineProps<DBProps>(), {
database: '', database: '',
}); });
const loadHeight = () => {
return globalStore.openMenuTabs ? '405px' : '375px';
};
const dialogContainerLogRef = ref(); const dialogContainerLogRef = ref();
const jumpToConf = async () => { const jumpToConf = async () => {
activeName.value = 'conf'; activeName.value = 'conf';

View File

@ -21,7 +21,7 @@
</template> </template>
<template #main v-if="redisIsExist && !isOnSetting"> <template #main v-if="redisIsExist && !isOnSetting">
<Terminal <Terminal
style="height: calc(100vh - 370px)" :style="{ height: `calc(100vh - ${loadHeight()})` }"
:key="isRefresh" :key="isRefresh"
ref="terminalRef" ref="terminalRef"
v-show="terminalShow" v-show="terminalShow"
@ -68,6 +68,8 @@ import { nextTick, onBeforeUnmount, ref } from 'vue';
import { App } from '@/api/interface/app'; import { App } from '@/api/interface/app';
import { GetAppPort } from '@/api/modules/app'; import { GetAppPort } from '@/api/modules/app';
import router from '@/routers'; import router from '@/routers';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const loading = ref(false); const loading = ref(false);
const maskShow = ref(true); const maskShow = ref(true);
@ -94,6 +96,10 @@ const onSetting = async () => {
settingRef.value!.acceptParams({ status: redisStatus.value, redisName: redisName.value }); settingRef.value!.acceptParams({ status: redisStatus.value, redisName: redisName.value });
}; };
const loadHeight = () => {
return globalStore.openMenuTabs ? '400px' : '370px';
};
const goDashboard = async () => { const goDashboard = async () => {
if (redisCommandPort.value === 0) { if (redisCommandPort.value === 0) {
commandVisible.value = true; commandVisible.value = true;

View File

@ -40,7 +40,7 @@
:placeholder="$t('commons.msg.noneData')" :placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="4" :tabSize="4"
style="margin-top: 10px; height: calc(100vh - 380px)" :style="{ height: `calc(100vh - ${loadHeight()})`, 'margin-top': '10px' }"
:lineWrapping="true" :lineWrapping="true"
:matchBrackets="true" :matchBrackets="true"
theme="cobalt" theme="cobalt"
@ -140,6 +140,8 @@ import i18n from '@/lang';
import { checkNumberRange, Rules } from '@/global/form-rules'; import { checkNumberRange, Rules } from '@/global/form-rules';
import { ChangePort, GetAppDefaultConfig } from '@/api/modules/app'; import { ChangePort, GetAppDefaultConfig } from '@/api/modules/app';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const extensions = [javascript(), oneDark]; const extensions = [javascript(), oneDark];
@ -150,6 +152,10 @@ const handleReady = (payload) => {
view.value = payload.view; view.value = payload.view;
}; };
const loadHeight = () => {
return globalStore.openMenuTabs ? '410px' : '380px';
};
const form = reactive({ const form = reactive({
name: '', name: '',
port: 6379, port: 6379,

View File

@ -44,7 +44,7 @@
</span> </span>
</template> </template>
<Terminal <Terminal
style="height: calc(100vh - 229px); background-color: #000" :style="{ height: `calc(100vh - ${loadHeight()})`, 'background-color': '#000' }"
:ref="'t-' + item.index" :ref="'t-' + item.index"
:key="item.Refresh" :key="item.Refresh"
></Terminal> ></Terminal>
@ -121,13 +121,19 @@
</el-tab-pane> </el-tab-pane>
<div v-if="terminalTabs.length === 0"> <div v-if="terminalTabs.length === 0">
<el-empty <el-empty
style="background-color: #000; height: calc(100vh - 200px)" :style="{ height: `calc(100vh - ${loadEmptyHeight()})`, 'background-color': '#000' }"
:description="$t('terminal.emptyTerminal')" :description="$t('terminal.emptyTerminal')"
></el-empty> ></el-empty>
</div> </div>
</el-tabs> </el-tabs>
<el-tooltip :content="loadTooltip()" placement="top"> <el-tooltip :content="loadTooltip()" placement="top">
<el-button @click="toggleFullscreen" v-if="!mobile" class="fullScreen" icon="FullScreen"></el-button> <el-button
@click="toggleFullscreen"
v-if="!mobile"
class="fullScreen"
:style="{ top: loadFullScreenHeight() }"
icon="FullScreen"
></el-button>
</el-tooltip> </el-tooltip>
<HostDialog ref="dialogRef" @on-conn-terminal="onConnTerminal" @load-host-tree="loadHostTree" /> <HostDialog ref="dialogRef" @on-conn-terminal="onConnTerminal" @load-host-tree="loadHostTree" />
@ -236,6 +242,16 @@ const cleanTimer = () => {
} }
}; };
const loadHeight = () => {
return globalStore.openMenuTabs ? '269px' : '229px';
};
const loadEmptyHeight = () => {
return globalStore.openMenuTabs ? '240px' : '200px';
};
const loadFullScreenHeight = () => {
return globalStore.openMenuTabs ? '66px' : '90px';
};
const handleTabsRemove = (targetName: string, action: 'remove' | 'add') => { const handleTabsRemove = (targetName: string, action: 'remove' | 'add') => {
if (action !== 'remove') { if (action !== 'remove') {
return; return;
@ -436,7 +452,6 @@ onMounted(() => {
border: none; border: none;
position: absolute; position: absolute;
right: 50px; right: 50px;
top: 90px;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 14px;
} }