diff --git a/backend/app/repo/website_ssl.go b/backend/app/repo/website_ssl.go index bac38543b..29867d46f 100644 --- a/backend/app/repo/website_ssl.go +++ b/backend/app/repo/website_ssl.go @@ -50,7 +50,6 @@ func (w WebsiteSSLRepo) WithByCAID(caID uint) DBOption { return db.Where("ca_id = ?", caID) } } - func (w WebsiteSSLRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteSSL, error) { var sslList []model.WebsiteSSL db := getDb(opts...).Model(&model.WebsiteSSL{}) diff --git a/backend/constant/alert.go b/backend/constant/alert.go new file mode 100644 index 000000000..ca720b219 --- /dev/null +++ b/backend/constant/alert.go @@ -0,0 +1,11 @@ +package constant + +const ( + AlertEnable = "Enable" + AlertDisable = "Disable" + AlertSuccess = "Success" + AlertError = "Error" + AlertSyncError = "SyncError" + AlertPushError = "PushError" + AlertPushSuccess = "PushSuccess" +) diff --git a/backend/constant/errs.go b/backend/constant/errs.go index 411387d3d..0f6c35fba 100644 --- a/backend/constant/errs.go +++ b/backend/constant/errs.go @@ -95,7 +95,7 @@ var ( ErrPathNotFound = "ErrPathNotFound" ErrMovePathFailed = "ErrMovePathFailed" ErrLinkPathNotFound = "ErrLinkPathNotFound" - ErrFileIsExist = "ErrFileIsExist" + ErrFileIsExist = "ErrFileIsExist" ErrFileUpload = "ErrFileUpload" ErrFileDownloadDir = "ErrFileDownloadDir" ErrCmdNotFound = "ErrCmdNotFound" @@ -162,3 +162,12 @@ var ( ErrLicenseSave = "ErrLicenseSave" ErrLicenseSync = "ErrLicenseSync" ) + +// alert +var ( + ErrAlert = "ErrAlert" + ErrAlertPush = "ErrAlertPush" + ErrAlertSave = "ErrAlertSave" + ErrAlertSync = "ErrAlertSync" + ErrAlertRemote = "ErrAlertRemote" +) diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index a3582c69f..b0d436d41 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -196,3 +196,11 @@ ErrLicenseSync: "Failed to sync license information, no license information dete ErrXpackNotFound: "This section is a professional edition feature, please import the license first in Panel Settings-License interface" ErrXpackNotActive: "This section is a professional edition feature, please synchronize the license status first in Panel Settings-License interface" ErrXpackOutOfDate: "The current license has expired, please re-import the license in Panel Settings-License interface" + + +#license +ErrAlert: "Alert information format error, please check and try again!" +ErrAlertPush: "Alert push error, please check and try again!" +ErrAlertSave: "Alert save error, please check and try again!" +ErrAlertSync: "Alert sync error, please check and try again!" +ErrAlertRemote: "Remote alert error, please check and try again!" \ No newline at end of file diff --git a/backend/i18n/lang/zh-Hant.yaml b/backend/i18n/lang/zh-Hant.yaml index 56a8e2227..dbbdd5694 100644 --- a/backend/i18n/lang/zh-Hant.yaml +++ b/backend/i18n/lang/zh-Hant.yaml @@ -198,3 +198,10 @@ ErrLicenseSync: "許可證信息同步失敗,資料庫中未檢測到許可證 ErrXpackNotFound: "該部分為專業版功能,請先在 面板設置-許可證 界面導入許可證" ErrXpackNotActive: "該部分為專業版功能,請先在 面板設置-許可證 界面同步許可證狀態" ErrXpackOutOfDate: "當前許可證已過期,請重新在 面板設置-許可證 界面導入許可證" + +#license +ErrAlert: "告警資訊格式錯誤,請檢查後重試!" +ErrAlertPush: "告警資訊推送錯誤,請檢查後重試!" +ErrAlertSave: "告警資訊保存錯誤,請檢查後重試!" +ErrAlertSync: "告警資訊同步錯誤,請檢查後重試!" +ErrAlertRemote: "告警資訊遠端錯誤,請檢查後重試!" diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index eca156380..dbeca4ee4 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -200,3 +200,10 @@ ErrXpackNotFound: "该部分为专业版功能,请先在 面板设置-许可 ErrXpackNotActive: "该部分为专业版功能,请先在 面板设置-许可证 界面同步许可证状态" ErrXpackOutOfDate: "当前许可证已过期,请重新在 面板设置-许可证 界面导入许可证" +#license +ErrAlert: "告警信息格式错误,请检查后重试!" +ErrAlertPush: "告警信息推送错误,请检查后重试!" +ErrAlertSave: "告警信息保存错误,请检查后重试!" +ErrAlertSync: "告警信息同步错误,请检查后重试!" +ErrAlertRemote: "告警信息远端错误,请检查后重试!" + diff --git a/backend/init/migration/migrate.go b/backend/init/migration/migrate.go index 8711fb0fe..a3df39427 100644 --- a/backend/init/migration/migrate.go +++ b/backend/init/migration/migrate.go @@ -93,6 +93,7 @@ func Init() { migrations.AddShellColumn, migrations.AddClam, migrations.AddClamStatus, + migrations.AddAlertMenu, }) if err := m.Migrate(); err != nil { global.LOG.Error(err) diff --git a/backend/init/migration/migrations/v_1_10.go b/backend/init/migration/migrations/v_1_10.go index c87545da6..f2b5f1d34 100644 --- a/backend/init/migration/migrations/v_1_10.go +++ b/backend/init/migration/migrations/v_1_10.go @@ -288,3 +288,29 @@ var AddClamStatus = &gormigrate.Migration{ return nil }, } + +var AddAlertMenu = &gormigrate.Migration{ + ID: "20240706-update-xpack-hide-menu", + Migrate: func(tx *gorm.DB) error { + var ( + setting model.Setting + menu dto.XpackHideMenu + ) + tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").First(&setting) + if err := json.Unmarshal([]byte(setting.Value), &menu); err != nil { + return err + } + menu.Children = append(menu.Children, dto.XpackHideMenu{ + ID: "7", + Title: "xpack.alert.alert", + Path: "/xpack/alert/dashboard", + Label: "XAlertDashboard", + IsCheck: true, + }) + data, err := json.Marshal(menu) + if err != nil { + return err + } + return tx.Model(&model.Setting{}).Where("key", "XpackHideMenu").Updates(map[string]interface{}{"value": string(data)}).Error + }, +} diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index ad0df6139..dc81102b1 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1681,6 +1681,7 @@ const message = { 'Upgrading to the professional version allows customization of panel logo, welcome message, and other information.', monitor: 'Upgrade to the professional version to view the real-time status of the website, visitor trends, visitor sources, request logs and other information. ', + alert: 'Upgrading to the professional version allows you to receive alarm information via SMS.', }, clean: { scan: 'Start Scanning', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index eb9ca89da..ee89792aa 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1562,6 +1562,7 @@ const message = { gpu: '升級專業版可以幫助用戶實時直觀查看到 GPU 的工作負載、溫度、顯存等重要參數。', setting: '升級專業版可以自定義面板 Logo、歡迎簡介等信息。', monitor: '升級專業版可以查看網站的即時狀態、訪客趨勢、訪客來源、請求日誌等資訊。 ', + alert: '升級專業版可以簡訊接收告警資訊等。', }, clean: { scan: '開始掃描', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 1525227bf..1312a60f0 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1564,6 +1564,7 @@ const message = { gpu: '升级专业版可以帮助用户实时直观查看到 GPU 的工作负载、温度、显存等重要参数。', setting: '升级专业版可以自定义面板 Logo、欢迎简介等信息。', monitor: '升级专业版可以查看网站的实时状态、访客趋势、访客来源、请求日志等信息。', + alert: '升级专业版可以短信接收告警信息等。', }, clean: { scan: '开始扫描',