feat: update task list and sidebar behavior (#12839)

This commit is contained in:
ssongliu
2026-05-26 09:33:52 +08:00
committed by GitHub
parent 979c1588e1
commit 1a0de94489
5 changed files with 18 additions and 38 deletions

View File

@@ -46,11 +46,6 @@ type SettingInfo struct {
ProxyUser string `json:"proxyUser"`
ProxyPasswd string `json:"proxyPasswd"`
ProxyPasswdKeep string `json:"proxyPasswdKeep"`
OpsReportExportFormat string `json:"opsReportExportFormat"`
OpsReportSchedule string `json:"opsReportSchedule"`
OpsReportSavePath string `json:"opsReportSavePath"`
OpsReportThreshold string `json:"opsReportThreshold"`
}
type SettingBaseInfo struct {

View File

@@ -108,32 +108,11 @@ func (u *SettingService) GetSettingInfo() (*dto.SettingInfo, error) {
}
if !global.CONF.Base.IsEnterprise {
info.IsOffline = constant.StatusDisable
} else {
u.ensureOpsReportSettingDefaults(&info)
}
return &info, err
}
func (u *SettingService) ensureOpsReportSettingDefaults(info *dto.SettingInfo) {
if _, ok := constant.OpsReportExportFormats[info.OpsReportExportFormat]; !ok {
info.OpsReportExportFormat = constant.OpsReportExportFormatPDF
_ = settingRepo.UpdateOrCreate("OpsReportExportFormat", info.OpsReportExportFormat)
}
if _, ok := constant.OpsReportSchedules[info.OpsReportSchedule]; !ok {
info.OpsReportSchedule = constant.OpsReportScheduleWeekly
_ = settingRepo.UpdateOrCreate("OpsReportSchedule", info.OpsReportSchedule)
}
if strings.TrimSpace(info.OpsReportSavePath) == "" {
info.OpsReportSavePath = defaultOpsReportSavePath()
_ = settingRepo.UpdateOrCreate("OpsReportSavePath", info.OpsReportSavePath)
}
if !isValidOpsReportThreshold(info.OpsReportThreshold) {
info.OpsReportThreshold = constant.OpsReportDefaultThreshold
_ = settingRepo.UpdateOrCreate("OpsReportThreshold", info.OpsReportThreshold)
}
}
func defaultOpsReportSavePath() string {
return path.Join(global.CONF.Base.InstallDir, constant.OpsReportDefaultSaveSubDir)
}

View File

@@ -19,12 +19,12 @@
<template #main>
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search" :heightDiff="320">
<el-table-column :label="$t('logs.taskName')" prop="name" min-width="180px"></el-table-column>
<el-table-column :label="$t('commons.table.status')" prop="status" max-width="100px">
<el-table-column :label="$t('commons.table.status')" prop="status" max-width="80px">
<template #default="{ row }">
<Status :status="row.status" :msg="row.errorMsg" />
</template>
</el-table-column>
<el-table-column :label="$t('commons.button.log')" prop="log" max-width="100px">
<el-table-column :label="$t('commons.button.log')" prop="log" max-width="80px">
<template #default="{ row }">
<el-button @click="openTaskLog(row)" link type="primary">
{{ $t('website.check') }}
@@ -32,6 +32,7 @@
</template>
</el-table-column>
<el-table-column
width="180px"
prop="createdAt"
:label="$t('commons.table.date')"
:formatter="dateFormat"

View File

@@ -98,7 +98,7 @@ const search = async () => {
}
if (!settingInfo?.hideMenu) {
setFallbackMenuListIfEmpty();
setDefaultMenuList();
return;
}
@@ -108,7 +108,7 @@ const search = async () => {
menuStore.setMenuList(rstMenuList);
}
} catch (error) {
setFallbackMenuListIfEmpty();
setDefaultMenuList();
}
};
@@ -116,16 +116,14 @@ function isSameMenuList(source: RouteRecordRaw[], target: RouteRecordRaw[]) {
return JSON.stringify(source) === JSON.stringify(target);
}
function setFallbackMenuListIfEmpty() {
if (!menuStore.menuList || menuStore.menuList.length === 0) {
menuStore.setMenuList(buildAuthVisibleMenuList(menuList));
function setDefaultMenuList() {
const rstMenuList = buildAuthVisibleMenuList(menuList);
if (!isSameMenuList(menuStore.menuList as RouteRecordRaw[], rstMenuList)) {
menuStore.setMenuList(rstMenuList);
}
}
function allowMenuItem(item: RouteRecordRaw) {
if (isAdmin.value) {
return true;
}
if (!hasRouteRoleAccess(item.meta)) {
return false;
}
@@ -273,13 +271,13 @@ function adjustAndCleanMenu(menuItem, list) {
onMounted(() => {
if (!menuStore.menuList || menuStore.menuList.length === 0) {
menuStore.setMenuList(isAdmin.value ? menuList : buildAuthVisibleMenuList(menuList));
menuStore.setMenuList(buildAuthVisibleMenuList(menuList));
}
search();
});
watch(
() => [currentNode.value, permissions.value.join('|')],
() => [currentNode.value, isAdmin.value, permissions.value.join('|')],
() => {
search();
},

View File

@@ -94,10 +94,13 @@ export async function loadProductProFromDB() {
const res = await getLicenseStatus();
if (!res || !res.data) {
globalStore.isProductPro = false;
globalStore.productProExpires = 0;
} else {
globalStore.isProductPro = res.data.status === 'Bound';
if (globalStore.isProductPro) {
globalStore.productProExpires = Number(res.data.productPro);
} else {
globalStore.productProExpires = 0;
}
}
return;
@@ -107,9 +110,11 @@ export async function loadProductProFromDB() {
if (!res || !res.data) {
globalStore.isEnterpriseLicensed = false;
globalStore.isProductPro = false;
globalStore.productProExpires = 0;
} else {
globalStore.isEnterpriseLicensed = res.data.status === 'Bound';
globalStore.isProductPro = globalStore.isEnterpriseLicensed;
globalStore.productProExpires = globalStore.isProductPro ? Number(res.data.productPro) : 0;
}
}
@@ -130,10 +135,12 @@ export async function loadMasterProductProFromDB() {
globalStore.isEnterpriseLicensed = false;
globalStore.isMasterProductPro = false;
globalStore.isProductPro = false;
globalStore.productProExpires = 0;
} else {
globalStore.isEnterpriseLicensed = res.data.status === 'Bound';
globalStore.isMasterProductPro = res.data.status === 'Bound';
globalStore.isProductPro = res.data.status === 'Bound';
globalStore.productProExpires = globalStore.isProductPro ? Number(res.data.productPro) : 0;
}
}
switchTheme();