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

fix: 修改容器部分 bug

This commit is contained in:
ssongliu 2023-02-23 11:39:47 +08:00 committed by ssongliu
parent cd89caa0c4
commit 0a20aaa3fa
22 changed files with 409 additions and 365 deletions

View File

@ -40,6 +40,5 @@ type ImageRepoOption struct {
} }
type ImageRepoDelete struct { type ImageRepoDelete struct {
DeleteInsecure bool `json:"deleteInsecure"` Ids []uint `json:"ids" validate:"required"`
Ids []uint `json:"ids" validate:"required"`
} }

View File

@ -55,7 +55,10 @@ func (u *ContainerService) PageVolume(req dto.SearchWithPage) (int64, interface{
for _, val := range item.Labels { for _, val := range item.Labels {
tag = append(tag, val) tag = append(tag, val)
} }
createTime, _ := time.Parse("2006-01-02T15:04:05Z", item.CreatedAt) if len(item.CreatedAt) > 19 {
item.CreatedAt = item.CreatedAt[0:19]
}
createTime, _ := time.Parse("2006-01-02T15:04:05", item.CreatedAt)
data = append(data, dto.Volume{ data = append(data, dto.Volume{
CreatedAt: createTime, CreatedAt: createTime,
Name: item.Name, Name: item.Name,

View File

@ -92,32 +92,9 @@ func (u *ImageRepoService) BatchDelete(req dto.ImageRepoDelete) error {
return errors.New("The default value cannot be edit !") return errors.New("The default value cannot be edit !")
} }
} }
if !req.DeleteInsecure {
if err := imageRepoRepo.Delete(commonRepo.WithIdsIn(req.Ids)); err != nil {
return err
}
return nil
}
repos, err := imageRepoRepo.List(commonRepo.WithIdsIn(req.Ids))
if err != nil {
return err
}
for _, repo := range repos {
if repo.Protocol == "http" {
_ = u.handleRegistries("", repo.DownloadUrl, "delete")
}
if repo.Auth {
_, _ = cmd.Execf("docker logout %s://%s", repo.Protocol, repo.DownloadUrl)
}
}
if err := imageRepoRepo.Delete(commonRepo.WithIdsIn(req.Ids)); err != nil { if err := imageRepoRepo.Delete(commonRepo.WithIdsIn(req.Ids)); err != nil {
return err return err
} }
stdout, err := cmd.Exec("systemctl restart docker")
if err != nil {
return errors.New(string(stdout))
}
return nil return nil
} }

View File

@ -157,7 +157,6 @@ export namespace Container {
} }
export interface RepoDelete { export interface RepoDelete {
ids: Array<number>; ids: Array<number>;
deleteInsecure: boolean;
} }
export interface RepoInfo { export interface RepoInfo {
id: number; id: number;

View File

@ -336,11 +336,14 @@ export default {
log: 'Logs', log: 'Logs',
slowLog: 'Slowlogs', slowLog: 'Slowlogs',
noData: 'No slow log yet...',
isOn: 'Is on', isOn: 'Is on',
longQueryTime: 'Slow query threshold', longQueryTime: 'Slow query threshold',
status: 'The current state', status: 'The current state',
baseParam: 'Basic parameter',
performanceParam: 'Performance parameter',
terminal: 'Terminal mode', terminal: 'Terminal mode',
second: 'Second', second: 'Second',
timeout: 'Timeout', timeout: 'Timeout',
@ -403,6 +406,8 @@ export default {
last10Min: 'Last 10 Minutes', last10Min: 'Last 10 Minutes',
newName: 'New name', newName: 'New name',
user: 'User',
command: 'Command',
custom: 'Custom', custom: 'Custom',
emptyUser: 'When empty, you will log in as default', emptyUser: 'When empty, you will log in as default',
containerTerminal: 'Terminal', containerTerminal: 'Terminal',
@ -490,6 +495,8 @@ export default {
registrieHelper: 'One in a row, for example:\n172.16.10.111:8081 \n172.16.10.112:8081', registrieHelper: 'One in a row, for example:\n172.16.10.111:8081 \n172.16.10.112:8081',
compose: 'Compose', compose: 'Compose',
apps: 'Apps',
local: 'Local',
createCompose: 'Create compose', createCompose: 'Create compose',
composeTemplate: 'Compose template', composeTemplate: 'Compose template',
createComposeTemplate: 'Create compose template', createComposeTemplate: 'Create compose template',

View File

@ -295,6 +295,8 @@ export default {
zipFormat: 'ziptar.gz 压缩包结构test.zip test.tar.gz 压缩包内必需包含 test.sql', zipFormat: 'ziptar.gz 压缩包结构test.zip test.tar.gz 压缩包内必需包含 test.sql',
currentStatus: '当前状态', currentStatus: '当前状态',
baseParam: '基础参数',
performanceParam: '性能参数',
runTime: '启动时间', runTime: '启动时间',
connections: '总连接数', connections: '总连接数',
bytesSent: '发送', bytesSent: '发送',
@ -344,6 +346,7 @@ export default {
log: '日志', log: '日志',
slowLog: '慢日志', slowLog: '慢日志',
noData: '暂无慢日志...',
isOn: '是否开启', isOn: '是否开启',
longQueryTime: '慢查询阈值', longQueryTime: '慢查询阈值',
@ -417,6 +420,8 @@ export default {
last10Min: '最近 10 分钟', last10Min: '最近 10 分钟',
newName: '新名称', newName: '新名称',
user: '用户',
command: '命令',
custom: '自定义', custom: '自定义',
containerTerminal: '终端', containerTerminal: '终端',
emptyUser: '为空时将使用容器默认的用户登录', emptyUser: '为空时将使用容器默认的用户登录',
@ -504,6 +509,8 @@ export default {
registrieHelper: '一行一个\n172.16.10.111:8081 \n172.16.10.112:8081', registrieHelper: '一行一个\n172.16.10.111:8081 \n172.16.10.112:8081',
compose: '编排', compose: '编排',
apps: '应用商店',
local: '本地',
createCompose: '创建编排', createCompose: '创建编排',
composeTemplate: '编排模版', composeTemplate: '编排模版',
createComposeTemplate: '创建编排模版', createComposeTemplate: '创建编排模版',

View File

@ -5,6 +5,10 @@ export function formatImageStdout(stdout: string) {
for (let i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
if (isJson(lines[i])) { if (isJson(lines[i])) {
const data = JSON.parse(lines[i]); const data = JSON.parse(lines[i]);
if (data.stream) {
lines[i] = data.stream;
continue;
}
if (data.id) { if (data.id) {
lines[i] = data.id + ': ' + data.status; lines[i] = data.id + ': ' + data.status;
} else { } else {

View File

@ -32,13 +32,12 @@
</el-card> </el-card>
</div> </div>
<LayoutContent <LayoutContent
v-loading="loading"
style="margin-top: 30px" style="margin-top: 30px"
back-name="Compose" back-name="Compose"
:title="$t('container.containerList')" :title="$t('container.containerList')"
:reload="true" :reload="true"
> >
<template #toolbar> <template #main>
<el-button-group> <el-button-group>
<el-button :disabled="checkStatus('start')" @click="onOperate('start')"> <el-button :disabled="checkStatus('start')" @click="onOperate('start')">
{{ $t('container.start') }} {{ $t('container.start') }}
@ -62,11 +61,10 @@
{{ $t('container.remove') }} {{ $t('container.remove') }}
</el-button> </el-button>
</el-button-group> </el-button-group>
</template>
<template #main>
<ComplexTable <ComplexTable
:pagination-config="paginationConfig" :pagination-config="paginationConfig"
v-model:selects="selects" v-model:selects="selects"
style="margin-top: 20px"
:data="data" :data="data"
@search="search" @search="search"
> >

View File

@ -60,8 +60,9 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('container.from')" prop="createdBy" min-width="80" fix> <el-table-column :label="$t('container.from')" prop="createdBy" min-width="80" fix>
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.createdBy === ''">Local</span> <span v-if="row.createdBy === ''">{{ $t('container.local') }}</span>
<span v-else>{{ row.createdBy }}</span> <span v-if="row.createdBy === 'Apps'">{{ $t('container.apps') }}</span>
<span v-if="row.createdBy === '1Panel'">1Panel</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -194,7 +195,7 @@ const buttons = [
onEdit(row); onEdit(row);
}, },
disabled: (row: any) => { disabled: (row: any) => {
return row.createdBy !== '1Panel'; return row.createdBy === 'Local';
}, },
}, },
{ {

View File

@ -4,43 +4,42 @@
<DrawerHeader :header="$t('container.containerTerminal')" :back="handleClose" /> <DrawerHeader :header="$t('container.containerTerminal')" :back="handleClose" />
</template> </template>
<el-form ref="formRef" :model="form" label-position="top"> <el-form ref="formRef" :model="form" label-position="top">
<el-row :gutter="20" type="flex" justify="center"> <el-form-item :label="$t('container.user')" prop="user">
<el-col :span="12"> <el-input placeholder="root" clearable v-model="form.user" />
<el-form-item label="User" prop="user"> </el-form-item>
<el-input clearable v-model="form.user" /> <el-form-item
<span class="input-help">{{ $t('container.emptyUser') }}</span> v-if="form.isCustom"
</el-form-item> :label="$t('container.command')"
</el-col> prop="command"
<el-col :span="12"> :rules="Rules.requiredInput"
<el-form-item v-if="form.isCustom" label="Command" prop="command" :rules="Rules.requiredInput"> >
<el-checkbox style="width: 100px" border v-model="form.isCustom" @change="onChangeCommand"> <el-checkbox style="width: 100px" border v-model="form.isCustom" @change="onChangeCommand">
{{ $t('container.custom') }} {{ $t('container.custom') }}
</el-checkbox> </el-checkbox>
<el-input style="width: calc(100% - 100px)" clearable v-model="form.command" /> <el-input style="width: calc(100% - 100px)" clearable v-model="form.command" />
</el-form-item> </el-form-item>
<el-form-item v-if="!form.isCustom" label="Command" prop="command" :rules="Rules.requiredSelect"> <el-form-item
<el-checkbox style="width: 100px" border v-model="form.isCustom" @change="onChangeCommand"> v-if="!form.isCustom"
{{ $t('container.custom') }} :label="$t('container.command')"
</el-checkbox> prop="command"
<el-select style="width: calc(100% - 100px)" filterable clearable v-model="form.command"> :rules="Rules.requiredSelect"
<el-option value="/bin/ash" label="/bin/ash" /> >
<el-option value="/bin/bash" label="/bin/bash" /> <el-checkbox style="width: 100px" border v-model="form.isCustom" @change="onChangeCommand">
<el-option value="/bin/sh" label="/bin/sh" /> {{ $t('container.custom') }}
</el-select> </el-checkbox>
</el-form-item> <el-select style="width: calc(100% - 100px)" filterable clearable v-model="form.command">
</el-col> <el-option value="/bin/ash" label="/bin/ash" />
</el-row> <el-option value="/bin/bash" label="/bin/bash" />
<el-option value="/bin/sh" label="/bin/sh" />
</el-select>
</el-form-item>
<el-button type="primary" v-if="!terminalOpen" @click="initTerm(formRef)">
{{ $t('commons.button.conn') }}
</el-button>
<el-button type="primary" v-else @click="handleClose()">{{ $t('commons.button.disconn') }}</el-button>
<div style="height: calc(100vh - 290px)" :id="'terminal-exec'"></div> <div style="height: calc(100vh - 290px)" :id="'terminal-exec'"></div>
</el-form> </el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="terminalVisiable = false">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" v-if="!terminalOpen" @click="initTerm(formRef)">
{{ $t('commons.button.conn') }}
</el-button>
<el-button type="primary" v-else @click="handleClose()">{{ $t('commons.button.disconn') }}</el-button>
</span>
</template>
</el-drawer> </el-drawer>
</template> </template>

View File

@ -13,7 +13,7 @@
<el-col :span="22"> <el-col :span="22">
<el-form ref="formRef" label-position="top" :model="form" label-width="80px"> <el-form ref="formRef" label-position="top" :model="form" label-width="80px">
<el-form-item :label="$t('container.tag')" :rules="Rules.requiredSelect" prop="tagName"> <el-form-item :label="$t('container.tag')" :rules="Rules.requiredSelect" prop="tagName">
<el-select filterable v-model="form.tagName"> <el-select filterable v-model="form.tagName" @change="form.name = form.tagName">
<el-option v-for="item in form.tags" :key="item" :value="item" :label="item" /> <el-option v-for="item in form.tags" :key="item" :value="item" :label="item" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -27,7 +27,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('container.label')" :rules="Rules.requiredInput" prop="name"> <el-form-item :label="$t('container.image')" :rules="Rules.requiredInput" prop="name">
<el-input v-model.trim="form.name"> <el-input v-model.trim="form.name">
<template #prepend>{{ loadDetailInfo(form.repoID) }}/</template> <template #prepend>{{ loadDetailInfo(form.repoID) }}/</template>
</el-input> </el-input>
@ -114,8 +114,8 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
drawerVisiable.value = true; drawerVisiable.value = true;
form.tags = params.tags; form.tags = params.tags;
form.repoID = 1; form.repoID = 1;
form.tagName = ''; form.tagName = form.tags.length !== 0 ? form.tags[0] : '';
form.name = ''; form.name = form.tags.length !== 0 ? form.tags[0] : '';
dialogData.value.repos = params.repos; dialogData.value.repos = params.repos;
}; };
const emit = defineEmits<{ (e: 'search'): void }>(); const emit = defineEmits<{ (e: 'search'): void }>();

View File

@ -1,67 +0,0 @@
<template>
<el-dialog v-model="repoVisiable" :destroy-on-close="true" :close-on-click-modal="false" width="30%">
<template #header>
<div class="card-header">
<span>{{ $t('commons.button.delete') }}</span>
</div>
</template>
<el-form v-loading="loading" label-width="20px">
<el-form-item>
<el-checkbox v-model="isDelete">{{ $t('container.delInsecure') }}</el-checkbox>
<span class="input-help">{{ $t('container.delInsecureHelper') }}</span>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button :disabled="loading" @click="repoVisiable = false">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button :disabled="loading" type="primary" @click="onSubmit()">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import i18n from '@/lang';
import { ElForm } from 'element-plus';
import { deleteImageRepo } from '@/api/modules/container';
import { MsgSuccess } from '@/utils/message';
const loading = ref(false);
const isDelete = ref(false);
interface DialogProps {
ids?: Array<number>;
}
const repoVisiable = ref(false);
const ids = ref();
const acceptParams = (params: DialogProps): void => {
ids.value = params.ids;
repoVisiable.value = true;
};
const emit = defineEmits<{ (e: 'search'): void }>();
const onSubmit = async () => {
loading.value = true;
await deleteImageRepo({ ids: ids.value, deleteInsecure: isDelete.value })
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
emit('search');
repoVisiable.value = false;
})
.catch(() => {
loading.value = false;
});
return;
};
defineExpose({
acceptParams,
});
</script>

View File

@ -71,7 +71,6 @@
</template> </template>
</LayoutContent> </LayoutContent>
<OperatorDialog @search="search" ref="dialogRef" /> <OperatorDialog @search="search" ref="dialogRef" />
<DeleteDialog @search="search" ref="dialogDeleteRef" />
</div> </div>
</template> </template>
@ -80,7 +79,6 @@ import LayoutContent from '@/layout/layout-content.vue';
import ComplexTable from '@/components/complex-table/index.vue'; import ComplexTable from '@/components/complex-table/index.vue';
import TableSetting from '@/components/table-setting/index.vue'; import TableSetting from '@/components/table-setting/index.vue';
import OperatorDialog from '@/views/container/repo/operator/index.vue'; import OperatorDialog from '@/views/container/repo/operator/index.vue';
import DeleteDialog from '@/views/container/repo/delete/index.vue';
import { reactive, onMounted, ref } from 'vue'; import { reactive, onMounted, ref } from 'vue';
import { dateFormat } from '@/utils/util'; import { dateFormat } from '@/utils/util';
import { Container } from '@/api/interface/container'; import { Container } from '@/api/interface/container';
@ -148,19 +146,14 @@ const onOpenDialog = async (
dialogRef.value!.acceptParams(params); dialogRef.value!.acceptParams(params);
}; };
const dialogDeleteRef = ref();
const onDelete = async (row: Container.RepoInfo) => { const onDelete = async (row: Container.RepoInfo) => {
if (row.protocol === 'https') { ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.button.delete'), {
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.button.delete'), { confirmButtonText: i18n.global.t('commons.button.confirm'),
confirmButtonText: i18n.global.t('commons.button.confirm'), cancelButtonText: i18n.global.t('commons.button.cancel'),
cancelButtonText: i18n.global.t('commons.button.cancel'), }).then(async () => {
}).then(async () => { await deleteImageRepo({ ids: [row.id] });
await deleteImageRepo({ ids: [row.id], deleteInsecure: false }); search();
search(); });
});
return;
}
dialogDeleteRef.value!.acceptParams({ ids: [row.id] });
}; };
const buttons = [ const buttons = [

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div v-loading="loading">
<div class="a-card" style="margin-top: 20px"> <div class="a-card" style="margin-top: 20px">
<el-card> <el-card>
<div> <div>
@ -35,7 +35,7 @@
</el-card> </el-card>
</div> </div>
<LayoutContent v-loading="loading" style="margin-top: 20px" :title="$t('container.setting')" :divider="true"> <LayoutContent style="margin-top: 20px" :title="$t('container.setting')" :divider="true">
<template #main> <template #main>
<el-radio-group v-model="confShowType" @change="changeMode"> <el-radio-group v-model="confShowType" @change="changeMode">
<el-radio-button label="base">{{ $t('database.baseConf') }}</el-radio-button> <el-radio-button label="base">{{ $t('database.baseConf') }}</el-radio-button>
@ -169,10 +169,17 @@ const onOperator = async (operation: string) => {
let param = { let param = {
operation: operation, operation: operation,
}; };
await dockerOperate(param); loading.value = true;
search(); await dockerOperate(param)
changeMode(); .then(() => {
MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); loading.value = false;
search();
changeMode();
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
.catch(() => {
loading.value = false;
});
}; };
const onSubmitSave = async () => { const onSubmitSave = async () => {

View File

@ -43,15 +43,22 @@
@search="search" @search="search"
> >
<el-table-column type="selection" fix /> <el-table-column type="selection" fix />
<el-table-column <el-table-column :label="$t('commons.table.name')" min-width="80" prop="name" fix>
:label="$t('commons.table.name')"
show-overflow-tooltip
min-width="80"
prop="name"
fix
>
<template #default="{ row }"> <template #default="{ row }">
<el-link @click="onInspect(row.name)" type="primary">{{ row.name }}</el-link> <el-tooltip
v-if="row.name.length > 20"
class="box-item"
effect="dark"
:content="row.name"
placement="top"
>
<el-link @click="onInspect(row.name)" type="primary">
{{ row.name.substring(0, 20) }}...
</el-link>
</el-tooltip>
<el-link v-else @click="onInspect(row.name)" type="primary">
{{ row.name }}
</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@ -135,7 +135,7 @@
</template> </template>
</el-dialog> </el-dialog>
<PasswordDialog ref="passwordRef" /> <PasswordDialog ref="passwordRef" @search="search" />
<RootPasswordDialog ref="rootPasswordRef" /> <RootPasswordDialog ref="rootPasswordRef" />
<RemoteAccessDialog ref="remoteAccessRef" /> <RemoteAccessDialog ref="remoteAccessRef" />
<UploadDialog ref="uploadRef" /> <UploadDialog ref="uploadRef" />

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-show="onSetting"> <div v-show="onSetting" v-loading="loading">
<LayoutContent :title="'MySQL ' + $t('database.setting')" :reload="true" v-loading="loading"> <LayoutContent :title="'MySQL ' + $t('database.setting')" :reload="true">
<template #buttons> <template #buttons>
<el-button type="primary" :plain="activeName !== 'conf'" @click="activeName = 'conf'"> <el-button type="primary" :plain="activeName !== 'conf'" @click="activeName = 'conf'">
{{ $t('database.confChange') }} {{ $t('database.confChange') }}
@ -78,18 +78,17 @@
<Status v-show="activeName === 'status'" ref="statusRef" /> <Status v-show="activeName === 'status'" ref="statusRef" />
<Variables v-show="activeName === 'tuning'" ref="variablesRef" /> <Variables v-show="activeName === 'tuning'" ref="variablesRef" />
<div v-show="activeName === 'port'"> <div v-show="activeName === 'port'">
<el-form :model="baseInfo" ref="panelFormRef" label-width="120px"> <el-form :model="baseInfo" ref="panelFormRef" label-position="top">
<el-row> <el-row>
<el-col :span="1"><br /></el-col> <el-col :span="1"><br /></el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item :label="$t('setting.port')" prop="port" :rules="Rules.port"> <el-form-item :label="$t('setting.port')" prop="port" :rules="Rules.port">
<el-input clearable type="number" v-model.number="baseInfo.port"> <el-input clearable type="number" v-model.number="baseInfo.port" />
<template #append> </el-form-item>
<el-button @click="onSavePort(panelFormRef)" icon="Collection"> <el-form-item>
{{ $t('commons.button.save') }} <el-button type="primary" @click="onSavePort(panelFormRef)" icon="Collection">
</el-button> {{ $t('commons.button.save') }}
</template> </el-button>
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -22,7 +22,7 @@
</el-button> </el-button>
<codemirror <codemirror
:autofocus="true" :autofocus="true"
placeholder="None data" :placeholder="$t('database.noData')"
:indent-with-tab="true" :indent-with-tab="true"
:tabSize="4" :tabSize="4"
style="margin-top: 10px; height: calc(100vh - 392px)" style="margin-top: 10px; height: calc(100vh - 392px)"

View File

@ -1,108 +1,143 @@
<template> <template>
<div> <div>
<el-row :gutter="20"> <el-form label-position="top">
<el-col :span="8"> <span class="title">{{ $t('database.baseParam') }}</span>
<el-row style="margin-top: 20px"> <el-divider class="devider" />
<table style="width: 100%" class="myTable"> <el-row type="flex" style="margin-left: 50px" justify="center">
<tr> <el-form-item style="width: 25%">
<td>{{ $t('database.runTime') }}</td> <template #label>
<td>{{ mysqlStatus.run }}</td> <span class="status-label">{{ $t('database.runTime') }}</span>
</tr> </template>
<tr> <span class="status-count">{{ mysqlStatus.run }}</span>
<td>{{ $t('database.connections') }}</td> </el-form-item>
<td>{{ mysqlStatus.connections }}</td> <el-form-item style="width: 25%">
</tr> <template #label>
<tr> <span class="status-label">{{ $t('database.connections') }}</span>
<td>{{ $t('database.bytesSent') }}</td> </template>
<td>{{ mysqlStatus!.bytesSent }}</td> <span class="status-count">{{ mysqlStatus.connections }}</span>
</tr> </el-form-item>
<tr> <el-form-item style="width: 25%">
<td>{{ $t('database.bytesReceived') }}</td> <template #label>
<td>{{ mysqlStatus!.bytesReceived }}</td> <span class="status-label">{{ $t('database.bytesSent') }}</span>
</tr> </template>
</table> <span class="status-count">{{ mysqlStatus.bytesSent }}</span>
</el-row> </el-form-item>
<el-row style="margin-top: 20px"> <el-form-item style="width: 25%">
<table style="width: 100%" class="myTable"> <template #label>
<tr> <span class="status-label">{{ $t('database.bytesReceived') }}</span>
<td>{{ $t('database.queryPerSecond') }}</td> </template>
<td>{{ mysqlStatus!.queryPerSecond }}</td> <span class="status-count">{{ mysqlStatus.bytesReceived }}</span>
</tr> </el-form-item>
<tr>
<td>{{ $t('database.queryPerSecond') }}</td> <el-form-item style="width: 25%">
<td>{{ mysqlStatus!.txPerSecond }}</td> <template #label>
</tr> <span class="status-label">{{ $t('database.queryPerSecond') }}</span>
<tr> </template>
<td>File</td> <span class="status-count">{{ mysqlStatus.queryPerSecond }}</span>
<td>{{ mysqlStatus!.file }}</td> </el-form-item>
</tr> <el-form-item style="width: 25%">
<tr> <template #label>
<td>Position</td> <span class="status-label">{{ $t('database.txPerSecond') }}</span>
<td>{{ mysqlStatus!.position }}</td> </template>
</tr> <span class="status-count">{{ mysqlStatus.txPerSecond }}</span>
</table> </el-form-item>
</el-row> <el-form-item style="width: 25%">
</el-col> <template #label>
<el-col :span="16"> <span class="status-label">File</span>
<table style="margin-top: 20px; width: 100%" class="myTable"> </template>
<tr> <span class="status-count">{{ mysqlStatus.file }}</span>
<td>{{ $t('database.queryPerSecond') }}</td> </el-form-item>
<td>{{ mysqlStatus!.connInfo }}</td> <el-form-item style="width: 25%">
<td>{{ $t('database.connInfoHelper') }}</td> <template #label>
</tr> <span class="status-label">Position</span>
<tr> </template>
<td>{{ $t('database.threadCacheHit') }}</td> <span class="status-count">{{ mysqlStatus.position }}</span>
<td>{{ mysqlStatus!.threadCacheHit }}</td> </el-form-item>
<td>{{ $t('database.threadCacheHitHelper') }}</td> </el-row>
</tr>
<tr> <span class="title">{{ $t('database.performanceParam') }}</span>
<td>{{ $t('database.indexHit') }}</td> <el-divider class="devider" />
<td>{{ mysqlStatus!.indexHit }}</td> <el-row type="flex" style="margin-left: 50px" justify="center">
<td>{{ $t('database.indexHitHelper') }}</td> <el-form-item style="width: 25%">
</tr> <template #label>
<tr> <span class="status-label">{{ $t('database.queryPerSecond') }}</span>
<td>{{ $t('database.innodbIndexHit') }}</td> </template>
<td>{{ mysqlStatus!.innodbIndexHit }}</td> <span class="status-count">{{ mysqlStatus.queryPerSecond }}</span>
<td>{{ $t('database.innodbIndexHitHelper') }}</td> <span class="input-help">{{ $t('database.connInfoHelper') }}</span>
</tr> </el-form-item>
<tr> <el-form-item style="width: 25%">
<td>{{ $t('database.cacheHit') }}</td> <template #label>
<td>{{ mysqlStatus!.cacheHit }}</td> <span class="status-label">{{ $t('database.threadCacheHit') }}</span>
<td>{{ $t('database.cacheHitHelper') }}</td> </template>
</tr> <span class="status-count">{{ mysqlStatus.threadCacheHit }}</span>
<tr> <span class="input-help">{{ $t('database.threadCacheHitHelper') }}</span>
<td>{{ $t('database.tmpTableToDB') }}</td> </el-form-item>
<td>{{ mysqlStatus!.tmpTableToDB }}</td> <el-form-item style="width: 25%">
<td>{{ $t('database.tmpTableToDBHelper') }}</td> <template #label>
</tr> <span class="status-label">{{ $t('database.indexHit') }}</span>
<tr> </template>
<td>{{ $t('database.openTables') }}</td> <span class="status-count">{{ mysqlStatus.indexHit }}</span>
<td>{{ mysqlStatus!.openTables }}</td> <span class="input-help">{{ $t('database.indexHitHelper') }}</span>
<td>{{ $t('database.openTablesHelper') }}</td> </el-form-item>
</tr> <el-form-item style="width: 25%">
<tr> <template #label>
<td>{{ $t('database.selectFullJoin') }}</td> <span class="status-label">{{ $t('database.innodbIndexHit') }}</span>
<td>{{ mysqlStatus!.selectFullJoin }}</td> </template>
<td>{{ $t('database.selectFullJoinHelper') }}</td> <span class="status-count">{{ mysqlStatus.innodbIndexHit }}</span>
</tr> <span class="input-help">{{ $t('database.innodbIndexHitHelper') }}</span>
<tr> </el-form-item>
<td>{{ $t('database.selectRangeCheck') }}</td> <el-form-item style="width: 25%">
<td>{{ mysqlStatus!.selectRangeCheck }}</td> <template #label>
<td>{{ $t('database.selectRangeCheckHelper') }}</td> <span class="status-label">{{ $t('database.cacheHit') }}</span>
</tr> </template>
<tr> <span class="status-count">{{ mysqlStatus.cacheHit }}</span>
<td>{{ $t('database.sortMergePasses') }}</td> <span class="input-help">{{ $t('database.cacheHitHelper') }}</span>
<td>{{ mysqlStatus!.sortMergePasses }}</td> </el-form-item>
<td>{{ $t('database.sortMergePassesHelper') }}</td> <el-form-item style="width: 25%">
</tr> <template #label>
<tr> <span class="status-label">{{ $t('database.tmpTableToDB') }}</span>
<td>{{ $t('database.tableLocksWaited') }}</td> </template>
<td>{{ mysqlStatus!.tableLocksWaited }}</td> <span class="status-count">{{ mysqlStatus.tmpTableToDB }}</span>
<td>{{ $t('database.tableLocksWaitedHelper') }}</td> <span class="input-help">{{ $t('database.tmpTableToDBHelper') }}</span>
</tr> </el-form-item>
</table> <el-form-item style="width: 25%">
</el-col> <template #label>
</el-row> <span class="status-label">{{ $t('database.openTables') }}</span>
</template>
<span class="status-count">{{ mysqlStatus.openTables }}</span>
<span class="input-help">{{ $t('database.openTablesHelper') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">{{ $t('database.selectFullJoin') }}</span>
</template>
<span class="status-count">{{ mysqlStatus.selectFullJoin }}</span>
<span class="input-help">{{ $t('database.selectFullJoinHelper') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">{{ $t('database.selectRangeCheck') }}</span>
</template>
<span class="status-count">{{ mysqlStatus.selectRangeCheck }}</span>
<span class="input-help">{{ $t('database.selectRangeCheckHelper') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">{{ $t('database.sortMergePasses') }}</span>
</template>
<span class="status-count">{{ mysqlStatus.sortMergePasses }}</span>
<span class="input-help">{{ $t('database.sortMergePassesHelper') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">{{ $t('database.tableLocksWaited') }}</span>
</template>
<span class="status-count">{{ mysqlStatus.tableLocksWaited }}</span>
<span class="input-help">{{ $t('database.tableLocksWaitedHelper') }}</span>
</el-form-item>
<el-form-item style="width: 25%"></el-form-item>
</el-row>
</el-form>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -176,3 +211,25 @@ defineExpose({
acceptParams, acceptParams,
}); });
</script> </script>
<style lang="scss" scoped>
.status-count {
font-size: 24px;
}
.status-label {
font-size: 14px;
color: #646a73;
}
.devider {
display: block;
height: 1px;
width: 100%;
margin: 12px 0;
border-top: 1px var(--el-border-color) var(--el-border-style);
}
.title {
font-size: 20px;
font-weight: 500;
margin-left: 50px;
}
</style>

View File

@ -94,18 +94,17 @@
</el-form> </el-form>
</div> </div>
<div v-if="activeName === 'port'"> <div v-if="activeName === 'port'">
<el-form :model="form" ref="portRef" label-width="120px"> <el-form :model="form" ref="portRef" label-position="top">
<el-row> <el-row>
<el-col :span="1"><br /></el-col> <el-col :span="1"><br /></el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item :label="$t('setting.port')" prop="port" :rules="Rules.port"> <el-form-item :label="$t('setting.port')" prop="port" :rules="Rules.port">
<el-input clearable type="number" v-model.number="form.port"> <el-input clearable type="number" v-model.number="form.port" />
<template #append> </el-form-item>
<el-button @click="onSavePort(portRef)" icon="Collection"> <el-form-item>
{{ $t('commons.button.save') }} <el-button @click="onSavePort(portRef)" icon="Collection">
</el-button> {{ $t('commons.button.save') }}
</template> </el-button>
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -49,13 +49,13 @@
<el-input type="number" v-model="row.second"></el-input> <el-input type="number" v-model="row.second"></el-input>
</td> </td>
<td width="60px"> <td width="60px">
<span>{{ $t('database.rdbHelper1') }}</span> {{ $t('database.rdbHelper1') }}
</td> </td>
<td width="32%"> <td width="32%">
<el-input type="number" v-model="row.count"></el-input> <el-input type="number" v-model="row.count"></el-input>
</td> </td>
<td width="12%"> <td width="12%">
<span>{{ $t('database.rdbHelper2') }}</span> {{ $t('database.rdbHelper2') }}
</td> </td>
<td> <td>
<el-button link type="primary" style="font-size: 10px" @click="handleDelete(index)"> <el-button link type="primary" style="font-size: 10px" @click="handleDelete(index)">

View File

@ -1,77 +1,110 @@
<template> <template>
<div v-if="statusShow"> <div v-if="statusShow">
<el-row> <el-form label-position="top">
<el-col :span="1"><br /></el-col> <span class="title">{{ $t('database.baseParam') }}</span>
<el-col :span="12"> <el-divider class="devider" />
<table style="width: 100%" class="myTable"> <el-row type="flex" style="margin-left: 50px" justify="center">
<tr> <el-form-item style="width: 25%">
<td>uptime_in_days</td> <template #label>
<td>{{ redisStatus!.uptime_in_days }}</td> <span class="status-label">uptime_in_days</span>
<td>{{ $t('database.uptimeInDays') }}</td> </template>
</tr> <span class="status-count">{{ redisStatus.uptime_in_days }}</span>
<tr> <span class="input-help">{{ $t('database.uptimeInDays') }}</span>
<td>tcp_port</td> </el-form-item>
<td>{{ redisStatus!.tcp_port }}</td> <el-form-item style="width: 25%">
<td>{{ $t('database.tcpPort') }}</td> <template #label>
</tr> <span class="status-label">tcp_port</span>
<tr> </template>
<td>connected_clients</td> <span class="status-count">{{ redisStatus.tcp_port }}</span>
<td>{{ redisStatus!.connected_clients }}</td> <span class="input-help">{{ $t('database.tcpPort') }}</span>
<td>{{ $t('database.connectedClients') }}</td> </el-form-item>
</tr> <el-form-item style="width: 25%">
<tr> <template #label>
<td>used_memory_rss</td> <span class="status-label">connected_clients</span>
<td>{{ redisStatus!.used_memory_rss }}</td> </template>
<td>{{ $t('database.usedMemoryRss') }}</td> <span class="status-count">{{ redisStatus.connected_clients }}</span>
</tr> <span class="input-help">{{ $t('database.connectedClients') }}</span>
<tr> </el-form-item>
<td>used_memory</td> <el-form-item style="width: 25%"></el-form-item>
<td>{{ redisStatus!.used_memory }}</td> </el-row>
<td>{{ $t('database.usedMemory') }}</td>
</tr> <span class="title">{{ $t('database.performanceParam') }}</span>
<tr> <el-divider class="devider" />
<td>mem_fragmentation_ratio</td> <el-row type="flex" style="margin-left: 50px" justify="center">
<td>{{ redisStatus!.mem_fragmentation_ratio }}</td> <el-form-item style="width: 25%">
<td>{{ $t('database.tmpTableToDBHelper') }}</td> <template #label>
</tr> <span class="status-label">used_memory_rss</span>
<tr> </template>
<td>total_connections_received</td> <span class="status-count">{{ redisStatus.used_memory_rss }}</span>
<td>{{ redisStatus!.total_connections_received }}</td> <span class="input-help">{{ $t('database.usedMemoryRss') }}</span>
<td>{{ $t('database.totalConnectionsReceived') }}</td> </el-form-item>
</tr> <el-form-item style="width: 25%">
<tr> <template #label>
<td>total_commands_processed</td> <span class="status-label">used_memory</span>
<td>{{ redisStatus!.total_commands_processed }}</td> </template>
<td>{{ $t('database.totalCommandsProcessed') }}</td> <span class="status-count">{{ redisStatus.used_memory }}</span>
</tr> <span class="input-help">{{ $t('database.usedMemory') }}</span>
<tr> </el-form-item>
<td>instantaneous_ops_per_sec</td> <el-form-item style="width: 25%">
<td>{{ redisStatus!.instantaneous_ops_per_sec }}</td> <template #label>
<td>{{ $t('database.instantaneousOpsPerSec') }}</td> <span class="status-label">mem_fragmentation_ratio</span>
</tr> </template>
<tr> <span class="status-count">{{ redisStatus.mem_fragmentation_ratio }}</span>
<td>keyspace_hits</td> <span class="input-help">{{ $t('database.tmpTableToDBHelper') }}</span>
<td>{{ redisStatus!.keyspace_hits }}</td> </el-form-item>
<td>{{ $t('database.keyspaceHits') }}</td> <el-form-item style="width: 25%">
</tr> <template #label>
<tr> <span class="status-label">total_connections_received</span>
<td>keyspace_misses</td> </template>
<td>{{ redisStatus!.keyspace_misses }}</td> <span class="status-count">{{ redisStatus.total_connections_received }}</span>
<td>{{ $t('database.keyspaceMisses') }}</td> <span class="input-help">{{ $t('database.totalConnectionsReceived') }}</span>
</tr> </el-form-item>
<tr> <el-form-item style="width: 25%">
<td>hit</td> <template #label>
<td>{{ redisStatus!.hit }}</td> <span class="status-label">total_commands_processed</span>
<td>{{ $t('database.hit') }}</td> </template>
</tr> <span class="status-count">{{ redisStatus.total_commands_processed }}</span>
<tr> <span class="input-help">{{ $t('database.totalCommandsProcessed') }}</span>
<td>latest_fork_usec</td> </el-form-item>
<td>{{ redisStatus!.latest_fork_usec }}</td> <el-form-item style="width: 25%">
<td>{{ $t('database.latestForkUsec') }}</td> <template #label>
</tr> <span class="status-label">instantaneous_ops_per_sec</span>
</table> </template>
</el-col> <span class="status-count">{{ redisStatus.instantaneous_ops_per_sec }}</span>
</el-row> <span class="input-help">{{ $t('database.instantaneousOpsPerSec') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">keyspace_hits</span>
</template>
<span class="status-count">{{ redisStatus.keyspace_hits }}</span>
<span class="input-help">{{ $t('database.keyspaceHits') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">keyspace_misses</span>
</template>
<span class="status-count">{{ redisStatus.keyspace_misses }}</span>
<span class="input-help">{{ $t('database.keyspaceMisses') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">hit</span>
</template>
<span class="status-count">{{ redisStatus.hit }}</span>
<span class="input-help">{{ $t('database.hit') }}</span>
</el-form-item>
<el-form-item style="width: 25%">
<template #label>
<span class="status-label">latest_fork_usec</span>
</template>
<span class="status-count">{{ redisStatus.latest_fork_usec }}</span>
<span class="input-help">{{ $t('database.latestForkUsec') }}</span>
</el-form-item>
<el-form-item style="width: 25%"></el-form-item>
<el-form-item style="width: 25%"></el-form-item>
</el-row>
</el-form>
</div> </div>
</template> </template>
@ -138,3 +171,25 @@ defineExpose({
onClose, onClose,
}); });
</script> </script>
<style lang="scss" scoped>
.status-count {
font-size: 24px;
}
.status-label {
font-size: 14px;
color: #646a73;
}
.devider {
display: block;
height: 1px;
width: 100%;
margin: 12px 0;
border-top: 1px var(--el-border-color) var(--el-border-style);
}
.title {
font-size: 20px;
font-weight: 500;
margin-left: 50px;
}
</style>