mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-27 08:00:14 +00:00
fix: 增加数据库 dashboard 工具跳转
This commit is contained in:
@@ -7,7 +7,13 @@
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<el-row>
|
||||
<el-alert type="warning" :description="$t('app.deleteHelper')" center show-icon :closable="false" />
|
||||
<el-alert
|
||||
type="warning"
|
||||
:description="$t('app.deleteHelper', [$t('app.database')])"
|
||||
center
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-col :span="12" :offset="6">
|
||||
<br />
|
||||
<el-descriptions border :column="1">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<el-button type="primary" icon="Plus" @click="onOpenDialog()">
|
||||
{{ $t('commons.button.create') }}
|
||||
</el-button>
|
||||
<el-button>phpMyAdmin</el-button>
|
||||
<el-button @click="goDashboard" icon="Position">phpMyAdmin</el-button>
|
||||
</template>
|
||||
<el-table-column type="selection" fix />
|
||||
<el-table-column :label="$t('commons.table.name')" prop="name" />
|
||||
@@ -132,12 +132,14 @@ import { ElForm, ElMessage } from 'element-plus';
|
||||
import { Database } from '@/api/interface/database';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { App } from '@/api/interface/app';
|
||||
import { GetAppPort } from '@/api/modules/app';
|
||||
|
||||
const selects = ref<any>([]);
|
||||
const mysqlName = ref();
|
||||
const isOnSetting = ref<boolean>();
|
||||
|
||||
const checkRef = ref();
|
||||
const phpadminPort = ref();
|
||||
|
||||
const data = ref();
|
||||
const paginationConfig = reactive({
|
||||
@@ -212,11 +214,21 @@ const search = async () => {
|
||||
paginationConfig.total = res.data.total;
|
||||
};
|
||||
|
||||
const goDashboard = async () => {
|
||||
window.open('http://localhost:' + phpadminPort.value, '_blank');
|
||||
};
|
||||
|
||||
const loadDashboardPort = async () => {
|
||||
const res = await GetAppPort('phpmyadmin');
|
||||
phpadminPort.value = res.data;
|
||||
};
|
||||
|
||||
const checkExist = (data: App.CheckInstalled) => {
|
||||
mysqlIsExist.value = data.isExist;
|
||||
mysqlName.value = data.name;
|
||||
if (mysqlIsExist.value) {
|
||||
search();
|
||||
loadDashboardPort();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
v-model="mysqlConf"
|
||||
:readOnly="true"
|
||||
/>
|
||||
<el-button type="primary" style="width: 120px; margin-top: 10px" @click="onSaveFile()">
|
||||
<el-button type="primary" style="margin-top: 10px" @click="onSaveFile()">
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
</el-collapse-item>
|
||||
@@ -76,11 +76,11 @@
|
||||
<el-collapse-item :title="$t('database.performanceTuning')" name="4">
|
||||
<Variables ref="variablesRef" />
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="日志" name="5">
|
||||
<el-collapse-item :title="$t('database.log')" name="5">
|
||||
<ContainerLog ref="dialogContainerLogRef" />
|
||||
</el-collapse-item>
|
||||
|
||||
<el-collapse-item title="慢日志" name="6">
|
||||
<el-collapse-item :title="$t('database.slowLog')" name="6">
|
||||
<SlowLog ref="slowLogRef" />
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
|
||||
@@ -64,17 +64,9 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
icon="Collection"
|
||||
@click="onSaveStart(variableFormRef)"
|
||||
type="primary"
|
||||
size="default"
|
||||
>
|
||||
<el-button @click="onSaveStart(variableFormRef)" type="primary">
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
<el-button icon="RefreshLeft" size="default">
|
||||
{{ $t('database.restart') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"><br /></el-col>
|
||||
@@ -285,7 +277,7 @@ const onSaveVariables = async () => {
|
||||
if (oldVariables.value?.max_connections !== mysqlVariables.max_connections) {
|
||||
param.push({ param: 'max_connections', value: mysqlVariables.max_connections });
|
||||
}
|
||||
await updateMysqlVariables(mysqlName.value, param);
|
||||
await updateMysqlVariables(param);
|
||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
<div v-show="redisIsExist">
|
||||
<Setting ref="settingRef" style="margin-top: 20px" />
|
||||
|
||||
<Terminal v-show="!isOnSetting" style="margin-top: 20px" ref="terminalRef" />
|
||||
<el-button style="margin-top: 20px" type="p" @click="goDashboard" icon="Position">Redis-Command</el-button>
|
||||
<Terminal v-show="!isOnSetting" ref="terminalRef" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -18,21 +19,34 @@ import Terminal from '@/views/database/redis/terminal/index.vue';
|
||||
import AppStatus from '@/components/app-status/index.vue';
|
||||
import { ref } from 'vue';
|
||||
import { App } from '@/api/interface/app';
|
||||
import { GetAppPort } from '@/api/modules/app';
|
||||
|
||||
const terminalRef = ref();
|
||||
const settingRef = ref();
|
||||
const isOnSetting = ref(false);
|
||||
const redisIsExist = ref(false);
|
||||
|
||||
const redisCommandPort = ref();
|
||||
|
||||
const onSetting = async () => {
|
||||
isOnSetting.value = true;
|
||||
terminalRef.value.onClose();
|
||||
settingRef.value!.acceptParams();
|
||||
};
|
||||
|
||||
const goDashboard = async () => {
|
||||
window.open('http://localhost:' + redisCommandPort.value, '_blank');
|
||||
};
|
||||
|
||||
const loadDashboardPort = async () => {
|
||||
const res = await GetAppPort('phpmyadmin');
|
||||
redisCommandPort.value = res.data;
|
||||
};
|
||||
|
||||
const checkExist = (data: App.CheckInstalled) => {
|
||||
redisIsExist.value = data.isExist;
|
||||
if (redisIsExist.value) {
|
||||
loadDashboardPort();
|
||||
terminalRef.value.acceptParams();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="demo-collapse" v-show="settingShow">
|
||||
<el-card style="margin-top: 5px">
|
||||
<LayoutContent :header="$t('database.setting')" back-name="Redis" :reload="true">
|
||||
<LayoutContent :header="$t('database.setting')" back-name="Redis" :reload="true" v-loading="loading">
|
||||
<el-collapse v-model="activeName" accordion>
|
||||
<el-collapse-item :title="$t('database.baseSetting')" name="1">
|
||||
<el-radio-group v-model="confShowType" @change="onChangeMode">
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-form-item :label="$t('setting.port')" prop="port" :rules="Rules.port">
|
||||
<el-input clearable type="number" v-model.number="form.port">
|
||||
<template #append>
|
||||
<el-button @click="onChangePort(formRef)" icon="Collection">
|
||||
<el-button @click="onSavePort()" icon="Collection">
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -44,12 +44,7 @@
|
||||
<span class="input-help">{{ $t('database.maxmemoryHelper') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="default"
|
||||
@click="onSave(formRef)"
|
||||
style="width: 90px"
|
||||
>
|
||||
<el-button type="primary" @click="onSave(formRef)">
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
@@ -92,6 +87,7 @@
|
||||
</el-card>
|
||||
|
||||
<ConfirmDialog ref="confirmDialogRef" @confirm="onSubmitSave"></ConfirmDialog>
|
||||
<ConfirmDialog ref="confirmDialogRef2" @confirm="onChangePort(formRef)"></ConfirmDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -114,6 +110,8 @@ import { ChangePort } from '@/api/modules/app';
|
||||
const extensions = [javascript(), oneDark];
|
||||
const confShowType = ref('base');
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
const form = reactive({
|
||||
name: '',
|
||||
port: 6379,
|
||||
@@ -136,6 +134,7 @@ const persistenceRef = ref();
|
||||
const formRef = ref<FormInstance>();
|
||||
const mysqlConf = ref();
|
||||
const confirmDialogRef = ref();
|
||||
const confirmDialogRef2 = ref();
|
||||
|
||||
const settingShow = ref<boolean>(false);
|
||||
|
||||
@@ -149,6 +148,15 @@ const onClose = (): void => {
|
||||
settingShow.value = false;
|
||||
};
|
||||
|
||||
const onSavePort = async () => {
|
||||
let params = {
|
||||
header: i18n.global.t('database.confChange'),
|
||||
operationInfo: i18n.global.t('database.restartNowHelper1'),
|
||||
submitInputInfo: i18n.global.t('database.restartNow'),
|
||||
};
|
||||
confirmDialogRef2.value!.acceptParams(params);
|
||||
};
|
||||
|
||||
const onChangePort = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
const result = await formEl.validateField('port', callback);
|
||||
@@ -160,9 +168,15 @@ const onChangePort = async (formEl: FormInstance | undefined) => {
|
||||
name: form.name,
|
||||
port: form.port,
|
||||
};
|
||||
await ChangePort(params);
|
||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||
return;
|
||||
loading.value = true;
|
||||
await ChangePort(params)
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
function callback(error: any) {
|
||||
if (error) {
|
||||
@@ -193,9 +207,16 @@ const onSave = async (formEl: FormInstance | undefined) => {
|
||||
requirepass: form.requirepass,
|
||||
maxmemory: form.maxmemory + '',
|
||||
};
|
||||
await updateRedisConf(param);
|
||||
loadform();
|
||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||
loading.value = true;
|
||||
await updateRedisConf(param)
|
||||
.then(() => {
|
||||
loadform();
|
||||
loading.value = false;
|
||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-show="terminalShow" style="height: 100%">
|
||||
<el-card style="margin-top: 5px">
|
||||
<div style="height: calc(100vh - 220px)" :id="'terminal-exec'"></div>
|
||||
<el-card>
|
||||
<div style="height: calc(100vh - 230px)" :id="'terminal-exec'"></div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user