From 62c1832e538f4853d13e7f00172e7a75010aa2fa Mon Sep 17 00:00:00 2001 From: daskyrk Date: Fri, 2 Jul 2021 15:26:06 +0800 Subject: [PATCH 1/8] docs: update README --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a6cfd6f61..a0462f8c98 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ For a detailed introduction, please check the [official website](https://www.erd Modern browsers | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Edge](http://godban.github.io/browsers-support-badges/)
Edge | -| --- | --- | --- | --- | -| last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## 🚀 Quick Start @@ -112,6 +112,10 @@ architecture of development mode - [User Docs](https://docs.erda.cloud) - [Backend project](https://github.com/erda-project/erda) +<<<<<<< HEAD +======= +To start using Erda, please see the documentation. +>>>>>>> docs: update README ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) From c8537a9c9e198b6fc552fcc4111af6ef36228925 Mon Sep 17 00:00:00 2001 From: daskyrk Date: Fri, 2 Jul 2021 15:30:08 +0800 Subject: [PATCH 2/8] docs: fix format --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index a0462f8c98..b8c9474de4 100644 --- a/README.md +++ b/README.md @@ -112,11 +112,6 @@ architecture of development mode - [User Docs](https://docs.erda.cloud) - [Backend project](https://github.com/erda-project/erda) -<<<<<<< HEAD -======= -To start using Erda, please see the documentation. ->>>>>>> docs: update README - ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/erda-project/erda-ui/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/erda-project/erda-ui/pulls) or as [GitHub issues](https://github.com/erda-project/erda-ui/issues?template=bug-template). If you'd like to improve code, check out the [Development Instructions](https://github.com/erda-project/erda-ui/wiki/Development) and have a good time! :) From 801b1a0e4fbb68e95a27bc4b9be2031b725f2248 Mon Sep 17 00:00:00 2001 From: daskyrk Date: Fri, 2 Jul 2021 15:32:43 +0800 Subject: [PATCH 3/8] fix: auto format content by prettier --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8c9474de4..2a6cfd6f61 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ For a detailed introduction, please check the [official website](https://www.erd Modern browsers | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Edge](http://godban.github.io/browsers-support-badges/)
Edge | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| --- | --- | --- | --- | +| last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## 🚀 Quick Start @@ -112,6 +112,7 @@ architecture of development mode - [User Docs](https://docs.erda.cloud) - [Backend project](https://github.com/erda-project/erda) + ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/erda-project/erda-ui/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/erda-project/erda-ui/pulls) or as [GitHub issues](https://github.com/erda-project/erda-ui/issues?template=bug-template). If you'd like to improve code, check out the [Development Instructions](https://github.com/erda-project/erda-ui/wiki/Development) and have a good time! :) From a18df7fc005a2ae17f123245c3b1f1fa67080fca Mon Sep 17 00:00:00 2001 From: daskyrk Date: Thu, 22 Jul 2021 16:32:28 +0800 Subject: [PATCH 4/8] chore: add changeLog section in pr template --- .github/PULL_REQUEST_TEMPLATE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 67ee73ba4b..1d39394e00 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -20,6 +20,17 @@ Describe the specific changes from the user's perspective, as well as possible B | 🇨🇳 中文 | | +## ChangeLog + + +| Language | Changelog | +| --------- | ------------ | +| 🇺🇸 English | | +| 🇨🇳 中文 | | + + ## Which versions should be patched? From 06010ca8869cf9fb0c14d8ec3c0915e3af5a7b13 Mon Sep 17 00:00:00 2001 From: daskyrk Date: Tue, 27 Jul 2021 10:42:06 +0800 Subject: [PATCH 5/8] chore: remove duplicate pr template section --- .github/PULL_REQUEST_TEMPLATE.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1d39394e00..67ee73ba4b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -20,17 +20,6 @@ Describe the specific changes from the user's perspective, as well as possible B | 🇨🇳 中文 | | -## ChangeLog - - -| Language | Changelog | -| --------- | ------------ | -| 🇺🇸 English | | -| 🇨🇳 中文 | | - - ## Which versions should be patched? From 93ef81f4e05fdac5ede1a03d54e5ed0662df406b Mon Sep 17 00:00:00 2001 From: daskyrk Date: Wed, 28 Jul 2021 21:28:09 +0800 Subject: [PATCH 6/8] feat: support send test message to Dingtalk group when config notification --- shell/app/locales/en.json | 4 +++ shell/app/locales/zh.json | 4 +++ .../app-notify/common-notify-group.tsx | 31 ++++++++++++++++++- .../settings/components/app-notify/index.scss | 10 ++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/shell/app/locales/en.json b/shell/app/locales/en.json index adcb465ea1..49c13541d4 100644 --- a/shell/app/locales/en.json +++ b/shell/app/locales/en.json @@ -810,6 +810,7 @@ "organization": "organization", "other": "other", "please": "please ", + "please complete Dingding address and signature": "please complete Dingding address and signature", "please confirm that the user has joined the application": "please confirm that the user has joined the application", "please confirm that the user has joined the organization": "please confirm that the user has joined the organization", "please confirm that the user has joined the project": "please confirm that the user has joined the project", @@ -834,6 +835,9 @@ "select": "select ", "select log start time": "select log start time", "selected": "selected", + "send test notification": "send test notification", + "sending failed, please check the configuration information": "sending failed, please check the configuration information", + "sent successfully, please check the test information in the group": "sent successfully, please check the test information in the group", "service": "service", "service basic parameters": "service basic parameters", "set the role of member {user}": "set the role of member {user}", diff --git a/shell/app/locales/zh.json b/shell/app/locales/zh.json index ff58b39334..11f3035705 100644 --- a/shell/app/locales/zh.json +++ b/shell/app/locales/zh.json @@ -810,6 +810,7 @@ "organization": "组织名称", "other": "其他", "please": "请", + "please complete Dingding address and signature": "请完整填写钉钉地址和签名", "please confirm that the user has joined the application": "请确认该用户已加入应用", "please confirm that the user has joined the organization": "请确认该用户已加入组织", "please confirm that the user has joined the project": "请确认该用户已加入项目", @@ -834,6 +835,9 @@ "select": "选择", "select log start time": "选择日志开始时间", "selected": "已选择", + "send test notification": "发送测试通知", + "sending failed, please check the configuration information": "发送失败,请检查配置信息", + "sent successfully, please check the test information in the group": "发送成功,请在群组中查看测试信息", "service": "服务", "service basic parameters": "服务基本参数", "set the role of member {user}": "设置成员 {user} 的角色", diff --git a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx index ebc66aeb0c..5bba5ad03e 100644 --- a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx +++ b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx @@ -15,7 +15,7 @@ import React from 'react'; import moment from 'moment'; import i18n from 'i18n'; import { isEmpty, map, take, head } from 'lodash'; -import { Spin, Modal, Tooltip, Select, Table, Button } from 'app/nusi'; +import { Spin, Modal, Tooltip, Select, Table, Button, message, Input } from 'app/nusi'; import { Icon as CustomIcon, Avatar, useSwitch, FormModal, useUpdate, MemberSelector } from 'common'; import { FormInstance, ColumnProps } from 'core/common/interface'; import { useMount, useUnmount } from 'react-use'; @@ -23,6 +23,7 @@ import { useUserMap } from 'core/stores/userMap'; import { useLoading } from 'core/stores/loading'; import notifyGroupStore from 'application/stores/notify-group'; import ExternalUserModal from './external-user-table'; +import agent from 'agent'; import './index.scss'; @@ -163,6 +164,7 @@ export const ListTargets = ({ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { const notifyGroups = notifyGroupStore.useStore((s) => s.notifyGroups); const userMap = useUserMap(); + const formRef = React.useRef(null); const roleMap = memberStore.useStore((s) => s.roleMap); const { getRoleMap } = memberStore.effects; @@ -325,6 +327,27 @@ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { let targetField; const extraFields: any[] = []; + const testDingTalk = () => { + const values = formRef.current?.getFieldsValue(); + const { secret, receiver } = values.targets; + if (!secret || !receiver) { + message.warn(i18n.t('common:please complete Dingding address and signature')); + return; + } + return agent + .post('/api/admin/notify/dingtalk-test') + .send({ + secret: secret, + webhook: receiver, + }) + .then((response: any) => { + if (response.body.data.success) { + message.success(i18n.t('common:sent successfully, please check the test information in the group')); + } else { + message.warn(i18n.t('common:sending failed, please check the configuration information')); + } + }); + }; switch (groupType) { case TargetType.USER: @@ -355,6 +378,11 @@ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { itemProps: { maxLength: 200, }, + suffix: ( + testDingTalk()}> + {i18n.t('common:send test notification')} + + ), }); break; case TargetType.WEBHOOK: @@ -463,6 +491,7 @@ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { Date: Wed, 28 Jul 2021 21:41:00 +0800 Subject: [PATCH 7/8] feat: update style --- .../components/app-notify/common-notify-group.tsx | 12 ++++++------ .../pages/settings/components/app-notify/index.scss | 7 ------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx index 5bba5ad03e..357774acbf 100644 --- a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx +++ b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx @@ -104,7 +104,7 @@ export const ListTargets = ({ <> - {`${i18n.t('application:group address')}: ${firstValue}`} + {`${i18n.t('application:group address')}: ${firstValue}`} ); @@ -116,12 +116,12 @@ export const ListTargets = ({ targetsEle = ( <>
- {map(take(values, 3), (obj: { receiver: string }) => ( + {map(take(values, 6), (obj: { receiver: string }) => ( ))}
- {text} + {text} ); @@ -139,7 +139,7 @@ export const ListTargets = ({ })} - {text} + {text} ); @@ -150,7 +150,7 @@ export const ListTargets = ({ <> - {text} + {text} ); @@ -427,13 +427,13 @@ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { { title: i18n.t('application:notification name'), dataIndex: 'name', + width: 200, }, { title: i18n.t('default:notification target'), dataIndex: 'targets', className: 'notify-info', ellipsis: true, - width: 200, render: (targets) => (
diff --git a/shell/app/modules/application/pages/settings/components/app-notify/index.scss b/shell/app/modules/application/pages/settings/components/app-notify/index.scss index 0f4c0b4752..69f6eca562 100644 --- a/shell/app/modules/application/pages/settings/components/app-notify/index.scss +++ b/shell/app/modules/application/pages/settings/components/app-notify/index.scss @@ -35,13 +35,6 @@ > span { width: 100%; } - - span.color-text-sub { - display: block; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } } } } From d7be6b5eddd43f067e51c19543436d3bb6336e1e Mon Sep 17 00:00:00 2001 From: daskyrk Date: Thu, 29 Jul 2021 10:26:40 +0800 Subject: [PATCH 8/8] style: code dry --- .../settings/components/app-notify/common-notify-group.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx index 357774acbf..4719479d22 100644 --- a/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx +++ b/shell/app/modules/application/pages/settings/components/app-notify/common-notify-group.tsx @@ -15,7 +15,7 @@ import React from 'react'; import moment from 'moment'; import i18n from 'i18n'; import { isEmpty, map, take, head } from 'lodash'; -import { Spin, Modal, Tooltip, Select, Table, Button, message, Input } from 'app/nusi'; +import { Spin, Modal, Tooltip, Select, Table, Button, message } from 'app/nusi'; import { Icon as CustomIcon, Avatar, useSwitch, FormModal, useUpdate, MemberSelector } from 'common'; import { FormInstance, ColumnProps } from 'core/common/interface'; import { useMount, useUnmount } from 'react-use'; @@ -337,7 +337,7 @@ const NotifyGroup = ({ memberStore, commonPayload }: IProps) => { return agent .post('/api/admin/notify/dingtalk-test') .send({ - secret: secret, + secret, webhook: receiver, }) .then((response: any) => {