11<template >
2- <div v-show =" onSetting" v-loading =" loading" >
3- <LayoutContent :title =" 'MySQL ' + $t('commons.button.set')" :reload =" true" >
4- <template #buttons >
2+ <div v-loading =" loading" >
3+ <LayoutContent >
4+ <template #title >
5+ <back-button name =" MySQL" :header =" 'MySQL ' + $t('commons.button.set')" />
6+ </template >
7+
8+ <template #toolbar >
59 <el-button type =" primary" :plain =" activeName !== 'conf'" @click =" jumpToConf" >
610 {{ $t('database.confChange') }}
711 </el-button >
@@ -115,12 +119,12 @@ import Status from '@/views/database/mysql/setting/status/index.vue';
115119import Variables from ' @/views/database/mysql/setting/variables/index.vue' ;
116120import SlowLog from ' @/views/database/mysql/setting/slow-log/index.vue' ;
117121import ConfirmDialog from ' @/components/confirm-dialog/index.vue' ;
118- import { reactive , ref } from ' vue' ;
122+ import { onMounted , reactive , ref } from ' vue' ;
119123import { Codemirror } from ' vue-codemirror' ;
120124import { javascript } from ' @codemirror/lang-javascript' ;
121125import { oneDark } from ' @codemirror/theme-one-dark' ;
122126import { loadDatabaseFile , loadMysqlBaseInfo , loadMysqlVariables , updateMysqlConfByFile } from ' @/api/modules/database' ;
123- import { ChangePort , GetAppDefaultConfig } from ' @/api/modules/app' ;
127+ import { ChangePort , CheckAppInstalled , GetAppDefaultConfig } from ' @/api/modules/app' ;
124128import { Rules } from ' @/global/form-rules' ;
125129import i18n from ' @/lang' ;
126130import { MsgSuccess } from ' @/utils/message' ;
@@ -146,34 +150,12 @@ const statusRef = ref();
146150const variablesRef = ref ();
147151const slowLogRef = ref ();
148152
149- const onSetting = ref <boolean >(false );
150153const mysqlName = ref ();
151154const mysqlStatus = ref ();
152155const mysqlVersion = ref ();
153156const variables = ref ();
154157
155- interface DialogProps {
156- mysqlName: string ;
157- mysqlVersion: string ;
158- status: string ;
159- }
160-
161158const dialogContainerLogRef = ref ();
162- const acceptParams = (props : DialogProps ): void => {
163- onSetting .value = true ;
164- mysqlStatus .value = props .status ;
165- mysqlVersion .value = props .mysqlVersion ;
166- loadBaseInfo ();
167- if (mysqlStatus .value === ' Running' ) {
168- loadVariables ();
169- loadSlowLogs ();
170- statusRef .value ! .acceptParams ({ mysqlName: props .mysqlName });
171- }
172- };
173- const onClose = (): void => {
174- onSetting .value = false ;
175- };
176-
177159const jumpToConf = async () => {
178160 activeName .value = ' conf' ;
179161 loadMysqlConf ();
@@ -303,8 +285,21 @@ const loadMysqlConf = async () => {
303285 mysqlConf .value = res .data ;
304286};
305287
306- defineExpose ({
307- acceptParams ,
308- onClose ,
288+ const onLoadInfo = async () => {
289+ await CheckAppInstalled (' mysql' ).then ((res ) => {
290+ mysqlName .value = res .data .name ;
291+ mysqlStatus .value = res .data .status ;
292+ mysqlVersion .value = res .data .version ;
293+ loadBaseInfo ();
294+ if (mysqlStatus .value === ' Running' ) {
295+ loadVariables ();
296+ loadSlowLogs ();
297+ statusRef .value ! .acceptParams ({ mysqlName: mysqlName .value });
298+ }
299+ });
300+ };
301+
302+ onMounted (() => {
303+ onLoadInfo ();
309304});
310305 </script >
0 commit comments