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

fix: 优化 Redis 数据库样式 (#5229)

This commit is contained in:
ssongliu 2024-05-31 14:12:42 +08:00 committed by GitHub
parent bf7a4f3254
commit ac33f5461d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 16 deletions

View File

@ -189,7 +189,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description"> <el-table-column :label="$t('commons.table.description')" prop="description" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<fu-input-rw-switch v-model="row.description" @blur="onChange(row)" /> <fu-input-rw-switch v-model="row.description" @blur="onChange(row)" />
</template> </template>
@ -527,6 +527,9 @@ const loadDBOptions = async () => {
if (currentDB.value) { if (currentDB.value) {
search(); search();
} }
if (currentDB.value.from === 'remote') {
maskShow.value = false;
}
}; };
const onDelete = async (row: Database.MysqlDBInfo) => { const onDelete = async (row: Database.MysqlDBInfo) => {
let param = { let param = {

View File

@ -155,7 +155,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description"> <el-table-column :label="$t('commons.table.description')" prop="description" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<fu-input-rw-switch v-model="row.description" @blur="onChange(row)" /> <fu-input-rw-switch v-model="row.description" @blur="onChange(row)" />
</template> </template>
@ -486,6 +486,9 @@ const loadDBOptions = async () => {
if (currentDB.value) { if (currentDB.value) {
search(); search();
} }
if (currentDB.value.from === 'remote') {
maskShow.value = false;
}
}; };
const onDelete = async (row: Database.PostgresqlDBInfo) => { const onDelete = async (row: Database.PostgresqlDBInfo) => {
let param = { let param = {

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<div class="app-status" style="margin-top: 20px" v-if="currentDB?.from === 'remote'"> <div class="app-status" style="margin-top: 20px" v-if="currentDB && currentDB.from === 'remote'">
<el-card> <el-card>
<div> <div>
<el-tag style="float: left" effect="dark" type="success">Redis</el-tag> <el-tag style="float: left" effect="dark" type="success">Redis</el-tag>
@ -14,13 +14,12 @@
:app-key="'redis'" :app-key="'redis'"
:app-name="appName" :app-name="appName"
v-model:loading="loading" v-model:loading="loading"
v-model:mask-show="maskShow"
@before="onBefore" @before="onBefore"
@after="onAfter" @after="onAfter"
@setting="onSetting" @setting="onSetting"
></AppStatus> ></AppStatus>
</template> </template>
<template #search v-if="!isOnSetting && redisIsExist"> <template #search v-if="!isOnSetting && currentDB">
<el-select v-model="currentDBName" @change="changeDatabase()" class="p-w-200"> <el-select v-model="currentDBName" @change="changeDatabase()" class="p-w-200">
<template #prefix>{{ $t('commons.table.type') }}</template> <template #prefix>{{ $t('commons.table.type') }}</template>
<el-option-group :label="$t('database.local')"> <el-option-group :label="$t('database.local')">
@ -69,7 +68,6 @@
v-show="redisStatus === 'Running' && terminalShow" v-show="redisStatus === 'Running' && terminalShow"
/> />
<el-empty <el-empty
:class="{ mask: maskShow }"
v-if="redisStatus !== 'Running' || (currentDB.from === 'remote' && !redisCliExist)" v-if="redisStatus !== 'Running' || (currentDB.from === 'remote' && !redisCliExist)"
:style="{ height: `calc(100vh - ${loadHeight()})`, 'background-color': '#000' }" :style="{ height: `calc(100vh - ${loadHeight()})`, 'background-color': '#000' }"
:description="loadErrMsg()" :description="loadErrMsg()"
@ -89,12 +87,24 @@
</div> </div>
</div> </div>
<el-card <div v-if="dbOptionsLocal.length === 0 && dbOptionsRemote.length === 0">
v-if="redisStatus != 'Running' && currentDB && !loading && maskShow && currentDB?.from === 'local'" <LayoutContent :title="'Redis ' + $t('menu.database')" :divider="true">
class="mask-prompt" <template #main>
> <div class="app-warn">
<span>{{ $t('commons.service.serviceNotStarted', ['Redis']) }}</span> <div>
</el-card> <span>{{ $t('app.checkInstalledWarn', ['Redis']) }}</span>
<span @click="goRouter('app')">
<el-icon class="ml-2"><Position /></el-icon>
{{ $t('database.goInstall') }}
</span>
<div>
<img src="@/assets/images/no_app.svg" />
</div>
</div>
</div>
</template>
</LayoutContent>
</div>
<Setting ref="settingRef" style="margin-top: 30px" /> <Setting ref="settingRef" style="margin-top: 30px" />
<Conn ref="connRef" @check-exist="reOpenTerminal" @close-terminal="closeTerminal(true)" /> <Conn ref="connRef" @check-exist="reOpenTerminal" @close-terminal="closeTerminal(true)" />
@ -139,7 +149,6 @@ import { getRedisCommandList } from '@/api/modules/host';
const globalStore = GlobalStore(); const globalStore = GlobalStore();
const loading = ref(false); const loading = ref(false);
const maskShow = ref(true);
const terminalRef = ref<InstanceType<typeof Terminal> | null>(null); const terminalRef = ref<InstanceType<typeof Terminal> | null>(null);
const settingRef = ref(); const settingRef = ref();
@ -215,7 +224,6 @@ const changeDatabase = async () => {
} }
for (const item of dbOptionsRemote.value) { for (const item of dbOptionsRemote.value) {
if (item.database == currentDBName.value) { if (item.database == currentDBName.value) {
maskShow.value = false;
currentDB.value = item; currentDB.value = item;
break; break;
} }

View File

@ -89,7 +89,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description"> <el-table-column :label="$t('commons.table.description')" prop="description" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<fu-input-rw-switch v-model="row.description" @blur="onChange(row)" /> <fu-input-rw-switch v-model="row.description" @blur="onChange(row)" />
</template> </template>

View File

@ -122,7 +122,11 @@
<Tooltip @click="toFolder(row.path)" :text="row.path" /> <Tooltip @click="toFolder(row.path)" :text="row.path" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.description')" prop="description"> <el-table-column
:label="$t('commons.table.description')"
prop="description"
show-overflow-tooltip
>
<template #default="{ row }"> <template #default="{ row }">
<fu-input-rw-switch v-model="row.description" @blur="onChange(row)" /> <fu-input-rw-switch v-model="row.description" @blur="onChange(row)" />
</template> </template>