From e8335d9c7366a79de9b2f93cd3e63076d059014e Mon Sep 17 00:00:00 2001 From: xinwen Date: Tue, 1 Jun 2021 17:48:36 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E8=AE=A2=E9=98=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelectDialog.vue | 2 +- .../Subscription.vue | 52 +++++++++---------- src/views/settings/index.vue | 7 +++ 3 files changed, 32 insertions(+), 29 deletions(-) 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 From ef841149de9f9d876183a59e6f24535a2df5b897 Mon Sep 17 00:00:00 2001 From: xinwen Date: Thu, 3 Jun 2021 16:35:31 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=AB=99?= =?UTF-8?q?=E5=86=85=E4=BF=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dump.rdb | Bin 0 -> 92 bytes src/i18n/langs/cn.json | 10 ++++- src/i18n/langs/en.json | 10 ++++- src/router/users.js | 23 ++++++++++ src/views/users/SiteMsg/SiteMsgDetail.vue | 52 ++++++++++++++++++++++ src/views/users/SiteMsg/SiteMsgList.vue | 51 +++++++++++++++++++++ 6 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 dump.rdb create mode 100644 src/views/users/SiteMsg/SiteMsgDetail.vue create mode 100644 src/views/users/SiteMsg/SiteMsgList.vue diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..f245254c54f14efedca45ec0886227b8d9264100 GIT binary patch literal 92 zcmWG?b@2=~Ffg$E#aWb^l3A=>vkmk t;wUXnP0`Iw%{_ELh@asXPhx(WZb4CMVs27S>H&uTQr4+LHPc!@0sumcB$5CC literal 0 HcmV?d00001 diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 1a363ca73..2e4a500cc 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -646,7 +646,8 @@ "Users": "用户管理", "WebFTP": "文件管理", "WebTerminal": "Web终端", - "Notifications": "通知" + "Notifications": "通知", + "SiteMessageList": "站内信" }, "sessions": { "StorageConfiguration": "存储配置", @@ -1031,7 +1032,12 @@ "MessageType": "消息类型", "Receivers": "接收人", "Subscription": "消息订阅", - "ChangeReceiver": "修改消息接收人" + "ChangeReceiver": "修改消息接收人", + "Subject": "主题", + "Message": "消息", + "DeliveryTime": "发送时间", + "HasRead": "是否已读", + "Sender": "发送人" }, "xpack": { "Admin": "管理员", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index cd7e931fe..af48c7642 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -644,7 +644,8 @@ "Users": "Users", "WebFTP": "WebFTP", "WebTerminal": "Web Terminal", - "Notifications": "Notifications" + "Notifications": "Notifications", + "SiteMessageList": "Site message" }, "sessions": { "StorageConfiguration": "Storage configuration", @@ -1025,7 +1026,12 @@ "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" }, "xpack": { "Admin": "Admin", diff --git a/src/router/users.js b/src/router/users.js index 1d087c004..464a73d34 100644 --- a/src/router/users.js +++ b/src/router/users.js @@ -91,5 +91,28 @@ export default [ hidden: true } ] + }, + { + path: 'site-msg', + component: empty, + redirect: '', + meta: { title: i18n.t('route.SiteMessage') }, + hidden: true, + children: [ + { + path: '', + name: 'SiteMessageList', + component: () => import('@/views/users/SiteMsg/SiteMsgList'), + meta: { title: i18n.t('route.SiteMessageList'), activeMenu: '/users/users' }, + hidden: true + }, + { + path: ':id', + name: 'SiteMessageDetail', + component: () => import('@/views/users/SiteMsg/SiteMsgDetail'), + meta: { title: i18n.t('route.SiteMessageDetail'), activeMenu: '/users/users' }, + hidden: true + } + ] } ] diff --git a/src/views/users/SiteMsg/SiteMsgDetail.vue b/src/views/users/SiteMsg/SiteMsgDetail.vue new file mode 100644 index 000000000..b1e4861e3 --- /dev/null +++ b/src/views/users/SiteMsg/SiteMsgDetail.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/views/users/SiteMsg/SiteMsgList.vue b/src/views/users/SiteMsg/SiteMsgList.vue new file mode 100644 index 000000000..c6878efd1 --- /dev/null +++ b/src/views/users/SiteMsg/SiteMsgList.vue @@ -0,0 +1,51 @@ + + + + + From 15e253804e79402796442a36e4849ac4902b6262 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 7 Jun 2021 15:47:13 +0800 Subject: [PATCH 3/6] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96msg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/components/Dialog/index.vue | 2 +- src/layout/components/NavHeader/Language.vue | 18 +- .../components/NavHeader/SiteMessages.vue | 212 ++++++++++++++++++ src/layout/components/NavHeader/index.vue | 65 +++--- src/main.js | 9 +- src/router/users.js | 23 -- src/views/users/SiteMsg/SiteMsgDetail.vue | 52 ----- src/views/users/SiteMsg/SiteMsgList.vue | 51 ----- yarn.lock | 5 + 10 files changed, 279 insertions(+), 159 deletions(-) create mode 100644 src/layout/components/NavHeader/SiteMessages.vue delete mode 100644 src/views/users/SiteMsg/SiteMsgDetail.vue delete mode 100644 src/views/users/SiteMsg/SiteMsgList.vue 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/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/router/users.js b/src/router/users.js index 464a73d34..1d087c004 100644 --- a/src/router/users.js +++ b/src/router/users.js @@ -91,28 +91,5 @@ export default [ hidden: true } ] - }, - { - path: 'site-msg', - component: empty, - redirect: '', - meta: { title: i18n.t('route.SiteMessage') }, - hidden: true, - children: [ - { - path: '', - name: 'SiteMessageList', - component: () => import('@/views/users/SiteMsg/SiteMsgList'), - meta: { title: i18n.t('route.SiteMessageList'), activeMenu: '/users/users' }, - hidden: true - }, - { - path: ':id', - name: 'SiteMessageDetail', - component: () => import('@/views/users/SiteMsg/SiteMsgDetail'), - meta: { title: i18n.t('route.SiteMessageDetail'), activeMenu: '/users/users' }, - hidden: true - } - ] } ] diff --git a/src/views/users/SiteMsg/SiteMsgDetail.vue b/src/views/users/SiteMsg/SiteMsgDetail.vue deleted file mode 100644 index b1e4861e3..000000000 --- a/src/views/users/SiteMsg/SiteMsgDetail.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/src/views/users/SiteMsg/SiteMsgList.vue b/src/views/users/SiteMsg/SiteMsgList.vue deleted file mode 100644 index c6878efd1..000000000 --- a/src/views/users/SiteMsg/SiteMsgList.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - - diff --git a/yarn.lock b/yarn.lock index 79c785e4c..638f3db30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7324,6 +7324,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" From 96b002eccbfae385465049a9d69f315f340e9032 Mon Sep 17 00:00:00 2001 From: xinwen Date: Mon, 7 Jun 2021 17:09:10 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E4=B8=8Ewebsockt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/NavHeader/SiteMessages.vue | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/src/layout/components/NavHeader/SiteMessages.vue b/src/layout/components/NavHeader/SiteMessages.vue index 2671bfeab..362311cc8 100644 --- a/src/layout/components/NavHeader/SiteMessages.vue +++ b/src/layout/components/NavHeader/SiteMessages.vue @@ -1,6 +1,6 @@