From d1d0c29e584a9b9cef9bcf4d4bd067d583939bad Mon Sep 17 00:00:00 2001 From: Miracle575 Date: Sat, 14 Sep 2024 07:36:32 +0000 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mis-server/src/models/messageType.ts | 2 +- apps/mis-server/src/services/account.ts | 4 ++-- apps/mis-server/src/tasks/fetch.ts | 6 +++++- apps/mis-server/src/utils/sendMessage.ts | 10 +++++++--- apps/notification/src/models/i18n.ts | 10 +++++----- apps/notification/src/models/message-type.ts | 12 ++++++------ apps/notification/src/pages/api/mis/navbarLinks.ts | 1 - .../src/pages/api/mis/rewriteNavigations.ts | 2 +- .../notification/src/pages/api/portal/navbarLinks.ts | 1 - .../src/pages/api/portal/rewriteNavigations.ts | 2 +- dev/vagrant/config/notification/config.yaml | 2 +- 11 files changed, 29 insertions(+), 23 deletions(-) diff --git a/apps/mis-server/src/models/messageType.ts b/apps/mis-server/src/models/messageType.ts index 713c40179f..15ea82a355 100644 --- a/apps/mis-server/src/models/messageType.ts +++ b/apps/mis-server/src/models/messageType.ts @@ -16,7 +16,7 @@ export enum InternalMessageType { AccountLowBalance = "AccountLowBalance", AccountBalance = "AccountBalance", AccountLocked = "AccountLocked", - AccountRestored = "AccountRestored", + AccountUnblocking = "AccountUnblocking", JobStarted = "JobStarted", JobFinished = "JobFinished", JobAbnormalTermination = "JobAbnormalTermination", diff --git a/apps/mis-server/src/services/account.ts b/apps/mis-server/src/services/account.ts index 4955ce6434..b7aa82d183 100644 --- a/apps/mis-server/src/services/account.ts +++ b/apps/mis-server/src/services/account.ts @@ -179,7 +179,7 @@ export const accountServiceServer = plugin((server) => { // 发送消息 const ownerAndAdmin = await getAccountOwnerAndAdmin(accountName, logger, em); await sendMessage({ - messageType: InternalMessageType.AccountRestored, + messageType: InternalMessageType.AccountUnblocking, targetType: TargetType.USER, targetIds: ownerAndAdmin.map((x) => x.userId), metadata: { time: (new Date()).toISOString(), @@ -424,7 +424,7 @@ export const accountServiceServer = plugin((server) => { // 发送账户解封消息 const ownerAndAdmin = await getAccountOwnerAndAdmin(accountName, logger, em); await sendMessage({ - messageType: InternalMessageType.AccountRestored, + messageType: InternalMessageType.AccountUnblocking, targetType: TargetType.USER, targetIds: ownerAndAdmin.map((x) => x.userId), metadata: { time: (new Date()).toISOString(), diff --git a/apps/mis-server/src/tasks/fetch.ts b/apps/mis-server/src/tasks/fetch.ts index 553e7b0efd..ad89946fcc 100644 --- a/apps/mis-server/src/tasks/fetch.ts +++ b/apps/mis-server/src/tasks/fetch.ts @@ -121,13 +121,17 @@ export async function fetchJobs( // Determine whether the job can be inserted into the database. If not, skip the job await em.flush(); - + await sendMessage({ messageType: InternalMessageType.JobFinished, targetType: TargetType.USER, targetIds: [job.user], metadata: { time: job.endTime!, jobId: job.jobId.toString(), + jobName: job.name, + cluster: job.cluster, + account: job.account, + price: price.account?.price.toString() ?? "0", }, }, logger); } catch (error) { diff --git a/apps/mis-server/src/utils/sendMessage.ts b/apps/mis-server/src/utils/sendMessage.ts index 1c0f36fe62..42e2872cbe 100644 --- a/apps/mis-server/src/utils/sendMessage.ts +++ b/apps/mis-server/src/utils/sendMessage.ts @@ -70,8 +70,8 @@ interface AccountLocked extends BaseMessage { }; } -interface AccountRestored extends BaseMessage { - messageType: InternalMessageType.AccountRestored; +interface AccountUnblocking extends BaseMessage { + messageType: InternalMessageType.AccountUnblocking; targetType: TargetType.USER, metadata: { time: string; @@ -85,11 +85,15 @@ interface JobFinished extends BaseMessage { metadata: { time: string; jobId: string; + jobName: string; + cluster: string; + account: string; + price: string; }; } type Message = AccountLocked | AccountOverdue | AccountRechargeSuccess - | AccountLowBalance | AccountBalance | AccountRestored + | AccountLowBalance | AccountBalance | AccountUnblocking | JobFinished; export const sendMessage = async (message: Message, logger: Logger) => { diff --git a/apps/notification/src/models/i18n.ts b/apps/notification/src/models/i18n.ts index ac38922232..893b68babc 100644 --- a/apps/notification/src/models/i18n.ts +++ b/apps/notification/src/models/i18n.ts @@ -82,8 +82,8 @@ export const languageDic = { }, messageConfigModal: { modifySuccess: "修改成功", - authorization: "授权方式", - dontAllowCancel: "不允许用户取消以下授权方式", + authorization: "订阅设置", + dontAllowCancel: "不允许用户取消订阅以下类型的通知", inputTitle: "请输入标题", }, }, @@ -105,7 +105,7 @@ export const languageDic = { }, }, notification: { - pageTitle: "消息通知", + pageTitle: "我的消息", markAllReadErrorInfo: "标记全部已读失败", markAllReadSuccessInfo: "标记全部已读成功", deleteReadMsgErrorInfo: "删除已读消息失败", @@ -205,8 +205,8 @@ export const languageDic = { messageConfigModal: { inputTitle: "Please enter a title", modifySuccess: "Modification successful", - authorization: "Authorization", - dontAllowCancel: "Do not allow users to cancel the following authorization methods", + authorization: "Subscription Settings", + dontAllowCancel: "Do not allow users to unsubscribe from the following types of notifications.", }, }, sendMessage: { diff --git a/apps/notification/src/models/message-type.ts b/apps/notification/src/models/message-type.ts index 19d9095a6a..b11b0ad8f6 100644 --- a/apps/notification/src/models/message-type.ts +++ b/apps/notification/src/models/message-type.ts @@ -30,7 +30,7 @@ export enum InternalMessageType { AccountLowBalance = "AccountLowBalance", AccountBalance = "AccountBalance", AccountLocked = "AccountLocked", - AccountRestored = "AccountRestored", + AccountUnblocking = "AccountUnblocking", JobStarted = "JobStarted", JobFinished = "JobFinished", JobAbnormalTermination = "JobAbnormalTermination", @@ -160,12 +160,12 @@ export const internalMessageTypesMap = new Map Date: Sat, 14 Sep 2024 07:38:21 +0000 Subject: [PATCH 2/6] chore: changeset --- .changeset/silver-yaks-scream.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/silver-yaks-scream.md diff --git a/.changeset/silver-yaks-scream.md b/.changeset/silver-yaks-scream.md new file mode 100644 index 0000000000..369e30e64b --- /dev/null +++ b/.changeset/silver-yaks-scream.md @@ -0,0 +1,6 @@ +--- +"@scow/notification": patch +"@scow/mis-server": patch +--- + +修改消息系统 ui From 9a31875affea68e190d37518017aadddb992045e Mon Sep 17 00:00:00 2001 From: Miracle575 Date: Wed, 18 Sep 2024 03:22:23 +0000 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E5=8F=98=E9=87=8F=E6=9B=B4=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mis-server/src/models/messageType.ts | 2 +- apps/mis-server/src/services/account.ts | 4 ++-- apps/mis-server/src/utils/sendMessage.ts | 6 +++--- apps/notification/src/models/i18n.ts | 16 ++++++++++++++++ apps/notification/src/models/message-type.ts | 6 +++--- .../src/pages/api/mis/navbarLinks.ts | 5 ----- .../src/pages/api/mis/rewriteNavigations.ts | 19 ++++++++++--------- .../src/pages/api/portal/navbarLinks.ts | 5 ----- .../pages/api/portal/rewriteNavigations.ts | 19 ++++++++++--------- 9 files changed, 45 insertions(+), 37 deletions(-) diff --git a/apps/mis-server/src/models/messageType.ts b/apps/mis-server/src/models/messageType.ts index 15ea82a355..e7486ce30f 100644 --- a/apps/mis-server/src/models/messageType.ts +++ b/apps/mis-server/src/models/messageType.ts @@ -16,7 +16,7 @@ export enum InternalMessageType { AccountLowBalance = "AccountLowBalance", AccountBalance = "AccountBalance", AccountLocked = "AccountLocked", - AccountUnblocking = "AccountUnblocking", + AccountUnblocked = "AccountUnblocked", JobStarted = "JobStarted", JobFinished = "JobFinished", JobAbnormalTermination = "JobAbnormalTermination", diff --git a/apps/mis-server/src/services/account.ts b/apps/mis-server/src/services/account.ts index b7aa82d183..4070009adf 100644 --- a/apps/mis-server/src/services/account.ts +++ b/apps/mis-server/src/services/account.ts @@ -179,7 +179,7 @@ export const accountServiceServer = plugin((server) => { // 发送消息 const ownerAndAdmin = await getAccountOwnerAndAdmin(accountName, logger, em); await sendMessage({ - messageType: InternalMessageType.AccountUnblocking, + messageType: InternalMessageType.AccountUnblocked, targetType: TargetType.USER, targetIds: ownerAndAdmin.map((x) => x.userId), metadata: { time: (new Date()).toISOString(), @@ -424,7 +424,7 @@ export const accountServiceServer = plugin((server) => { // 发送账户解封消息 const ownerAndAdmin = await getAccountOwnerAndAdmin(accountName, logger, em); await sendMessage({ - messageType: InternalMessageType.AccountUnblocking, + messageType: InternalMessageType.AccountUnblocked, targetType: TargetType.USER, targetIds: ownerAndAdmin.map((x) => x.userId), metadata: { time: (new Date()).toISOString(), diff --git a/apps/mis-server/src/utils/sendMessage.ts b/apps/mis-server/src/utils/sendMessage.ts index 42e2872cbe..a0fa1d1977 100644 --- a/apps/mis-server/src/utils/sendMessage.ts +++ b/apps/mis-server/src/utils/sendMessage.ts @@ -70,8 +70,8 @@ interface AccountLocked extends BaseMessage { }; } -interface AccountUnblocking extends BaseMessage { - messageType: InternalMessageType.AccountUnblocking; +interface AccountUnblocked extends BaseMessage { + messageType: InternalMessageType.AccountUnblocked; targetType: TargetType.USER, metadata: { time: string; @@ -93,7 +93,7 @@ interface JobFinished extends BaseMessage { } type Message = AccountLocked | AccountOverdue | AccountRechargeSuccess - | AccountLowBalance | AccountBalance | AccountUnblocking + | AccountLowBalance | AccountBalance | AccountUnblocked | JobFinished; export const sendMessage = async (message: Message, logger: Logger) => { diff --git a/apps/notification/src/models/i18n.ts b/apps/notification/src/models/i18n.ts index 893b68babc..8190b7af29 100644 --- a/apps/notification/src/models/i18n.ts +++ b/apps/notification/src/models/i18n.ts @@ -21,6 +21,14 @@ export type I18nStringType = string | { // languageDic for partitionsManagement export const languageDic = { zh_cn: { + api: { + notification: "通知", + myMsgs: "我的消息", + msgSub: "消息订阅", + msgConfig: "消息设置", + sendMsg: "发送消息", + createType: "创建自定义消息类型", + }, common: { default: "默认", zhCn: "简体中文", @@ -140,6 +148,14 @@ export const languageDic = { }, }, en: { + api: { + notification: "Notification", + myMsgs: "My Messages", + msgSub: "Message Subscription", + msgConfig: "Message Config", + sendMsg: "Send Message", + createType: "Create Custom Message Type", + }, common: { default: "Default", zhCn: "Simplified Chinese", diff --git a/apps/notification/src/models/message-type.ts b/apps/notification/src/models/message-type.ts index b11b0ad8f6..c74087a686 100644 --- a/apps/notification/src/models/message-type.ts +++ b/apps/notification/src/models/message-type.ts @@ -30,7 +30,7 @@ export enum InternalMessageType { AccountLowBalance = "AccountLowBalance", AccountBalance = "AccountBalance", AccountLocked = "AccountLocked", - AccountUnblocking = "AccountUnblocking", + AccountUnblocked = "AccountUnblocked", JobStarted = "JobStarted", JobFinished = "JobFinished", JobAbnormalTermination = "JobAbnormalTermination", @@ -160,8 +160,8 @@ export const internalMessageTypesMap = new Map Date: Wed, 18 Sep 2024 06:07:49 +0000 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20navlink=20?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E5=9B=BE=E6=A0=87=E6=B2=A1=E6=9C=89=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=98=AF=E4=B8=8D=E5=9E=82=E7=9B=B4=E5=B1=85=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/lazy-garlics-impress.md | 5 +++++ libs/web/src/layouts/base/header/index.tsx | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/lazy-garlics-impress.md diff --git a/.changeset/lazy-garlics-impress.md b/.changeset/lazy-garlics-impress.md new file mode 100644 index 0000000000..623b7cb0d9 --- /dev/null +++ b/.changeset/lazy-garlics-impress.md @@ -0,0 +1,5 @@ +--- +"@scow/lib-web": patch +--- + +修复 navlink 只有图标没有文字是不垂直居中的问题 diff --git a/libs/web/src/layouts/base/header/index.tsx b/libs/web/src/layouts/base/header/index.tsx index 625e884201..a5ad1acab2 100644 --- a/libs/web/src/layouts/base/header/index.tsx +++ b/libs/web/src/layouts/base/header/index.tsx @@ -60,6 +60,7 @@ const MenuPartPlaceholder = styled.div` const LinksPart = styled.div` display: flex; flex-direction: row; + align-items: center; `; const RightContentPart = styled.div` From f8d90e2f1ee1f6b8ca2cf4ffc3ab5a1dd0d5b80a Mon Sep 17 00:00:00 2001 From: Miracle575 Date: Wed, 18 Sep 2024 06:12:30 +0000 Subject: [PATCH 5/6] fix: changeset comment error --- .changeset/lazy-garlics-impress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/lazy-garlics-impress.md b/.changeset/lazy-garlics-impress.md index 623b7cb0d9..1d264e0a8b 100644 --- a/.changeset/lazy-garlics-impress.md +++ b/.changeset/lazy-garlics-impress.md @@ -2,4 +2,4 @@ "@scow/lib-web": patch --- -修复 navlink 只有图标没有文字是不垂直居中的问题 +修复 navlink 只有图标没有文字是不水平居中的问题 From 74312de597f0cee44f58dd4a886090959e1e4f2a Mon Sep 17 00:00:00 2001 From: Miracle575 Date: Thu, 19 Sep 2024 02:10:00 +0000 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20navlink=20text=20=E5=BF=85=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/notification/src/pages/api/mis/navbarLinks.ts | 1 + apps/notification/src/pages/api/portal/navbarLinks.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/notification/src/pages/api/mis/navbarLinks.ts b/apps/notification/src/pages/api/mis/navbarLinks.ts index af3b67ef60..fd5e87da54 100644 --- a/apps/notification/src/pages/api/mis/navbarLinks.ts +++ b/apps/notification/src/pages/api/mis/navbarLinks.ts @@ -42,6 +42,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const navbarLinks = [ { path: "/notification", + text: "", icon: { src: svgFilePath }, }, ]; diff --git a/apps/notification/src/pages/api/portal/navbarLinks.ts b/apps/notification/src/pages/api/portal/navbarLinks.ts index af3b67ef60..fd5e87da54 100644 --- a/apps/notification/src/pages/api/portal/navbarLinks.ts +++ b/apps/notification/src/pages/api/portal/navbarLinks.ts @@ -42,6 +42,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const navbarLinks = [ { path: "/notification", + text: "", icon: { src: svgFilePath }, }, ];