fix: Fix some issues with the alert (#9605)

This commit is contained in:
2025-07-22 15:10:06 +08:00 committed by GitHub
parent 8a76171dbe
commit 6e650d977e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 20 deletions

View file

@ -205,11 +205,9 @@ func stopResourceJob() {
func loadSSLInfo(alert dto.AlertDTO) {
var opts []repo.DBOption
if !strings.Contains(alert.Project, "all") {
var ids []uint
if alert.Project != "all" {
itemID, _ := strconv.Atoi(alert.Project)
ids = append(ids, uint(itemID))
opts = append(opts, repo.WithByIDs(ids))
opts = append(opts, repo.WithByID(uint(itemID)))
}
sslList, _ := repo.NewISSLRepo().List(opts...)
@ -267,11 +265,9 @@ func loadSSLInfo(alert dto.AlertDTO) {
func loadWebsiteInfo(alert dto.AlertDTO) {
var opts []repo.DBOption
if !strings.Contains(alert.Project, "all") {
var ids []uint
if alert.Project != "all" {
itemID, _ := strconv.Atoi(alert.Project)
ids = append(ids, uint(itemID))
opts = append(opts, repo.WithByIDs(ids))
opts = append(opts, repo.WithByID(uint(itemID)))
}
websiteList, _ := websiteRepo.List(opts...)
@ -282,6 +278,7 @@ func loadWebsiteInfo(alert dto.AlertDTO) {
daysDifference := int(website.ExpireDate.Sub(currentDate).Hours() / 24)
if daysDifference > 0 && int(alert.Cycle) >= daysDifference {
daysDifferenceMap[daysDifference] = append(daysDifferenceMap[daysDifference], website.PrimaryDomain)
projectMap[website.ID] = append(projectMap[website.ID], website.ExpireDate)
}
}
projectJSON := serializeAndSortProjects(projectMap)

View file

@ -11,13 +11,6 @@ router.beforeEach((to, from, next) => {
NProgress.start();
axiosCanceler.removeAllPending();
const globalStore = GlobalStore();
if (globalStore.isIntl && to.path.includes('/xpack/alert')) {
next({ name: '404' });
NProgress.done();
return;
}
if (to.name !== 'entrance' && !globalStore.isLogin) {
next({
name: 'entrance',

View file

@ -287,7 +287,12 @@
<el-form-item :label="$t('xpack.alert.alertMethod')" prop="sendMethod">
<el-select class="selectClass" v-model="dialogData.rowData!.sendMethod" multiple cleanable>
<el-option value="mail" :label="$t('xpack.alert.mail')" />
<el-option value="sms" :label="$t('xpack.alert.sms')" />
<el-option
value="sms"
v-if="!globalStore.isIntl"
:disabled="!globalStore.isProductPro"
:label="$t('xpack.alert.sms')"
/>
</el-select>
</el-form-item>
<span class="input-help">

View file

@ -4,7 +4,7 @@
<template #toolbar>
<div class="flex justify-between gap-2 flex-wrap sm:flex-row">
<div class="flex flex-wrap gap-3">
<el-button type="primary" @click="syncAll" v-if="isProductPro">
<el-button type="primary" @click="syncAll" v-if="isProductPro && !globalStore.isIntl">
{{ $t('commons.button.sync') }}
</el-button>
<el-button type="primary" plain @click="onClean">{{ $t('xpack.alert.cleanLog') }}</el-button>
@ -61,7 +61,7 @@
</template>
</el-table-column>
<fu-table-operations
v-if="isProductPro"
v-if="isProductPro && !globalStore.isIntl"
:ellipsis="2"
width="130px"
:buttons="buttons"
@ -280,7 +280,7 @@ const searchAlertInfo = async () => {
onMounted(async () => {
await searchAlertInfo();
isProductPro.value = globalStore.isProductPro;
if (globalStore.isProductPro) {
if (globalStore.isProductPro && !globalStore.isIntl) {
await syncAllAlert();
}
});

View file

@ -106,7 +106,10 @@
</el-button>
</el-alert>
</el-card>
<el-card class="rounded-2xl shadow hover:shadow-md transition-all" v-if="globalStore.isProductPro">
<el-card
class="rounded-2xl shadow hover:shadow-md transition-all"
v-if="globalStore.isProductPro && !globalStore.isIntl"
>
<div class="flex items-center justify-between mb-2">
<div class="text-lg font-semibold">{{ $t('xpack.alert.smsConfig') }}</div>
<div>