diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 000000000..f245254c5 Binary files /dev/null and b/dump.rdb differ diff --git a/package.json b/package.json index aa56d6b7d..f9a85af28 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "lodash.set": "^4.3.2", "lodash.topairs": "^4.3.0", "lodash.values": "^4.3.0", + "moment": "^2.29.1", "moment-parseformat": "^3.0.0", "normalize.css": "7.0.0", "npm": "^7.8.0", diff --git a/src/components/Dialog/index.vue b/src/components/Dialog/index.vue index 1c569f19c..99f6f8a67 100644 --- a/src/components/Dialog/index.vue +++ b/src/components/Dialog/index.vue @@ -74,7 +74,7 @@ export default { } .dialog-footer { - padding-right: 50px; + padding-right: 20px; } diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index db60f92d0..85a51cf6a 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -649,7 +649,8 @@ "Users": "用户管理", "WebFTP": "文件管理", "WebTerminal": "Web终端", - "Notifications": "通知" + "Notifications": "通知", + "SiteMessageList": "站内信" }, "sessions": { "StorageConfiguration": "存储配置", @@ -1034,7 +1035,15 @@ "MessageType": "消息类型", "Receivers": "接收人", "Subscription": "消息订阅", - "ChangeReceiver": "修改消息接收人" + "ChangeReceiver": "修改消息接收人", + "Subject": "主题", + "Message": "消息", + "DeliveryTime": "发送时间", + "HasRead": "是否已读", + "Sender": "发送人", + "MarkAsRead": "标记已读", + "NoUnreadMsg": "暂无未读消息", + "SiteMessage": "站内信" }, "xpack": { "Admin": "管理员", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index d3e39975b..c859a35c4 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -647,7 +647,8 @@ "Users": "Users", "WebFTP": "WebFTP", "WebTerminal": "Web Terminal", - "Notifications": "Notifications" + "Notifications": "Notifications", + "SiteMessageList": "Site message" }, "sessions": { "StorageConfiguration": "Storage configuration", @@ -1028,7 +1029,15 @@ "MessageType": "Message Type", "Receivers": "Receivers", "Subscription": "Subscription", - "ChangeReceiver": "Change Receivers" + "ChangeReceiver": "Change Receivers", + "Subject": "Subject", + "Message": "Message", + "DeliveryTime": "Delivery time", + "HasRead": "Has read", + "Sender": "Sender", + "MarkAsRead": "Mark as read", + "NoUnreadMsg": "No unread messages", + "SiteMessage": "Site messages" }, "xpack": { "Admin": "Admin", diff --git a/src/layout/components/NavHeader/Language.vue b/src/layout/components/NavHeader/Language.vue index 945ab13af..909babeae 100644 --- a/src/layout/components/NavHeader/Language.vue +++ b/src/layout/components/NavHeader/Language.vue @@ -10,7 +10,6 @@ + + diff --git a/src/layout/components/NavHeader/index.vue b/src/layout/components/NavHeader/index.vue index 8a490108c..04182ca2c 100644 --- a/src/layout/components/NavHeader/index.vue +++ b/src/layout/components/NavHeader/index.vue @@ -3,30 +3,26 @@
- + + @@ -34,6 +30,7 @@ import { mapGetters } from 'vuex' import Hamburger from '@/components/Hamburger' import AccountDropdown from './AccountDropdown' +import SiteMessages from './SiteMessages' import Help from './Help' import Language from './Language' import WebTerminal from './WebTerminal' @@ -48,7 +45,8 @@ export default { Language, Help, Tickets, - WebTerminal + WebTerminal, + SiteMessages }, data() { return { @@ -60,13 +58,17 @@ export default { ]), isOrgAuditor() { return rolc.getRolesDisplay(this.currentOrgRoles).includes('OrgAuditor') || rolc.getRolesDisplay(this.currentOrgRoles).includes('Auditor') + }, + showTickets() { + return this.publicSettings.TICKETS_ENABLED && + this.publicSettings.XPACK_LICENSE_IS_VALID && + !this.isOrgAuditor } }, methods: { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') } - } } @@ -91,12 +93,19 @@ export default { .navbar-right { float: right; margin-right: 10px; - } - .header-item { - line-height: 50px; - display: inline-block; - padding-right: 20px; + .header-item { + line-height: 50px; + display: inline-block; + padding-right: 10px; + padding-left: 10px; + } + + .header-icon { + &:hover { + background-color: #e6e6e6; + } + } } .breadcrumb-container { @@ -108,5 +117,9 @@ export default { .el-header { background-color: #ffffff; } + + ul { + margin: 0; + } diff --git a/src/main.js b/src/main.js index b77c4340e..9919009ca 100644 --- a/src/main.js +++ b/src/main.js @@ -40,8 +40,13 @@ Vue.config.productionTip = false import VueCookie from 'vue-cookie' Vue.use(VueCookie) window.$cookie = VueCookie -import VueMoment from 'vue-moment' -Vue.use(VueMoment) + +const moment = require('moment') +require('moment/locale/zh-cn') +Vue.use(require('vue-moment'), { + moment +}) + // logger import VueLogger from 'vuejs-logger' import loggerOptions from './utils/logger' diff --git a/src/views/settings/SystemMessageSubscription/SelectDialog.vue b/src/views/settings/SystemMessageSubscription/SelectDialog.vue index 49f4f8c86..fa3ab34f9 100644 --- a/src/views/settings/SystemMessageSubscription/SelectDialog.vue +++ b/src/views/settings/SystemMessageSubscription/SelectDialog.vue @@ -64,7 +64,7 @@ export default { const selectedUsers = this.selectedUsers.map(item => { return { id: item.id, - label: `${item.name}(${item.username})` + label: item.name } }) setTimeout(() => { diff --git a/src/views/settings/SystemMessageSubscription/Subscription.vue b/src/views/settings/SystemMessageSubscription/Subscription.vue index c096276be..230669393 100644 --- a/src/views/settings/SystemMessageSubscription/Subscription.vue +++ b/src/views/settings/SystemMessageSubscription/Subscription.vue @@ -67,7 +67,7 @@ export default { } this.$axios.patch( - `/api/v1/notifications/system/subscriptions/${sub.id}/`, + `/api/v1/notifications/system-msg-subscription/${sub.id}/`, { receive_backends: backends } ).catch(err => { this.$log.error(err) @@ -78,11 +78,10 @@ export default { onDialogSelectSubmit(userIds) { this.dialogVisible = false this.$axios.patch( - `/api/v1/notifications/system/subscriptions/${this.currentEditSub.id}/`, + `/api/v1/notifications/system-msg-subscription/${this.currentEditSub.id}/`, { users: userIds } ).then(newSub => { - const msgType = this.idMessageTypeMapper[newSub.id] - msgType.users = newSub.users + const msgType = this.idMessageTypeMapper[newSub.message_type] msgType.receivers = newSub.receivers }).catch(err => { console.log(err) @@ -97,40 +96,37 @@ export default { this.receiveBackends = await this.$axios.get('/api/v1/notifications/backends/') }, async initSubscriptions() { - const subscriptions = await this.$axios.get('/api/v1/notifications/system/subscriptions/') + const subscriptions = await this.$axios.get('/api/v1/notifications/system-msg-subscription/') - // 根据 app 分组 - const appMessageTypesMapper = {} - subscriptions.forEach(sub => { - if (!(sub.message_category in appMessageTypesMapper)) { - appMessageTypesMapper[sub.message_category] = { - id: sub.message_category, - value: sub.message_category_label, - children: [sub] - } - } else { - appMessageTypesMapper[sub.message_category].children.push(sub) - } - }) + const trans_subscriptions = [] - // sub 改成需要的数据结构 - for (const app of Object.values(appMessageTypesMapper)) { - app.children = app.children.map(sub => { + for (const category of subscriptions) { + const children = [] + trans_subscriptions.push({ + id: category.category, + value: category.category_label, + children: children + }) + + for (const sub of category.children) { const backendsChecked = {} this.receiveBackends.forEach(backend => { backendsChecked[backend.name] = sub.receive_backends.indexOf(backend.name) > -1 }) - const subObj = { - id: sub.id, - value: sub.message_label, + + const trans_sub = { + id: sub.message_type, + value: sub.message_type_label, receivers: sub.receivers, receive_backends: backendsChecked } - this.idMessageTypeMapper[sub.id] = subObj - return subObj - }) + children.push(trans_sub) + + this.idMessageTypeMapper[trans_sub.id] = trans_sub + } } - this.tableData = Object.values(appMessageTypesMapper) + + this.tableData = trans_subscriptions } } } diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index c03ae1ad5..73db1939b 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -69,6 +69,10 @@ export default { title: this.$t('setting.DingTalk'), name: 'DingTalk' }, + { + title: this.$t('setting.SystemMessageSubscription'), + name: 'SystemMessageSubscription' + }, { title: this.$t('setting.Terminal'), name: 'Terminal' @@ -119,6 +123,9 @@ export default { case 'License': this.activeMenu = 'License' break + case 'SystemMessageSubscription': + this.activeMenu = 'SystemMessageSubscription' + break default: this.activeMenu = 'Basic' break diff --git a/yarn.lock b/yarn.lock index da0600384..dce5f44e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7339,6 +7339,11 @@ moment@^2.19.2: resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a" integrity sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw== +moment@^2.29.1: + version "2.29.1" + resolved "https://registry.npm.taobao.org/moment/download/moment-2.29.1.tgz?cache=0&sync_timestamp=1601983320283&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmoment%2Fdownload%2Fmoment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" + integrity sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M= + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"