diff --git a/.changeset/lazy-garlics-impress.md b/.changeset/lazy-garlics-impress.md new file mode 100644 index 0000000000..1d264e0a8b --- /dev/null +++ b/.changeset/lazy-garlics-impress.md @@ -0,0 +1,5 @@ +--- +"@scow/lib-web": patch +--- + +修复 navlink 只有图标没有文字是不水平居中的问题 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 diff --git a/apps/mis-server/src/models/messageType.ts b/apps/mis-server/src/models/messageType.ts index 713c40179f..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", - AccountRestored = "AccountRestored", + 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 4955ce6434..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.AccountRestored, + 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.AccountRestored, + messageType: InternalMessageType.AccountUnblocked, 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..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 AccountRestored extends BaseMessage { - messageType: InternalMessageType.AccountRestored; +interface AccountUnblocked extends BaseMessage { + messageType: InternalMessageType.AccountUnblocked; 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 | 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 ac38922232..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: "简体中文", @@ -82,8 +90,8 @@ export const languageDic = { }, messageConfigModal: { modifySuccess: "修改成功", - authorization: "授权方式", - dontAllowCancel: "不允许用户取消以下授权方式", + authorization: "订阅设置", + dontAllowCancel: "不允许用户取消订阅以下类型的通知", inputTitle: "请输入标题", }, }, @@ -105,7 +113,7 @@ export const languageDic = { }, }, notification: { - pageTitle: "消息通知", + pageTitle: "我的消息", markAllReadErrorInfo: "标记全部已读失败", markAllReadSuccessInfo: "标记全部已读成功", deleteReadMsgErrorInfo: "删除已读消息失败", @@ -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", @@ -205,8 +221,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..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", - AccountRestored = "AccountRestored", + AccountUnblocked = "AccountUnblocked", JobStarted = "JobStarted", JobFinished = "JobFinished", JobAbnormalTermination = "JobAbnormalTermination", @@ -160,12 +160,12 @@ export const internalMessageTypesMap = new Map