This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 4dcfb221 [Fix] fix alert add/update modal tag delete problem (#377)
4dcfb221 is described below
commit 4dcfb2211bdb05c1649524a75ab07da5ff208dcd
Author: VampireAchao <[email protected]>
AuthorDate: Tue Dec 5 09:55:03 2023 +0800
[Fix] fix alert add/update modal tag delete problem (#377)
* [Fix] fix alert add/update modal tag delete problem
* [Fix] fix alert add/update modal tag delete problem
---
src/routes/System/Alert/AddModal.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/routes/System/Alert/AddModal.js
b/src/routes/System/Alert/AddModal.js
index ac571100..574510ba 100644
--- a/src/routes/System/Alert/AddModal.js
+++ b/src/routes/System/Alert/AddModal.js
@@ -41,7 +41,7 @@ class AddModal extends Component {
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- handleOk({ ...values, id, labels:
Object.fromEntries(this.state.labelList.map(({ name, value }) => [name,
value])) });
+ handleOk({ ...values, id, labels:
Object.fromEntries(this.state.labelList.filter(({ name, value }) => name &&
value).map(({ name, value }) => [name, value])) });
}
});
}
@@ -178,7 +178,7 @@ class AddModal extends Component {
)}
</FormItem>
{
- form.getFieldValue('matchAll') ||
+ form.getFieldValue('matchAll') ||
(
<>
<FormItem
@@ -228,7 +228,12 @@ class AddModal extends Component {
style={{ marginLeft: 10 }}
onClick={() => {
const index = labelList.findIndex(l => l.key ===
label.key)
- labelList.splice(index, 1)
+ if (labelList.length > 1) {
+ labelList.splice(index, 1)
+ } else {
+ labelList[0].name = ''
+ labelList[0].value = ''
+ }
this.setState({ labelList })
}}
>