Browse Source

fix: 切换菜单设置接口 (#4429)

pull/4431/head
ssongliu 8 months ago committed by GitHub
parent
commit
7ab005540b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      backend/app/api/v1/monitor.go
  2. 6
      frontend/src/views/setting/panel/hidemenu/index.vue

6
backend/app/api/v1/monitor.go

@ -95,15 +95,15 @@ func (b *BaseApi) LoadMonitor(c *gin.Context) {
// @Router /hosts/monitor/clean [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清空监控数据","formatEN":"clean monitor datas"}
func (b *BaseApi) CleanMonitor(c *gin.Context) {
if err := global.DB.Exec("DELETE FROM monitor_bases").Error; err != nil {
if err := global.MonitorDB.Exec("DELETE FROM monitor_bases").Error; err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
if err := global.DB.Exec("DELETE FROM monitor_ios").Error; err != nil {
if err := global.MonitorDB.Exec("DELETE FROM monitor_ios").Error; err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
if err := global.DB.Exec("DELETE FROM monitor_networks").Error; err != nil {
if err := global.MonitorDB.Exec("DELETE FROM monitor_networks").Error; err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}

6
frontend/src/views/setting/panel/hidemenu/index.vue

@ -39,9 +39,9 @@
<script setup lang="ts">
import { reactive, ref } from 'vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { DialogProps, ElMessageBox } from 'element-plus';
import { ElMessageBox } from 'element-plus';
import i18n from '@/lang';
import { updateSetting } from '@/api/modules/setting';
import { updateMenu } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message';
const drawerVisible = ref();
@ -131,7 +131,7 @@ const saveHideMenus = async () => {
type: 'info',
}).then(async () => {
const updateJson = JSON.stringify(treeData.hideMenu[0]);
await updateSetting({ key: 'XpackHideMenu', value: updateJson })
await updateMenu({ key: 'XpackHideMenu', value: updateJson })
.then(async () => {
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
loading.value = false;

Loading…
Cancel
Save