From 0816fc3229e3f35389c17d5690925bfc5c58634d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 2 Aug 2018 11:46:51 +0200 Subject: [PATCH 1/2] do not show seperator if there are no other pages between button before and after seperator --- scm-ui/src/components/Paginator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scm-ui/src/components/Paginator.js b/scm-ui/src/components/Paginator.js index 5b306b8240..8ec05adec9 100644 --- a/scm-ui/src/components/Paginator.js +++ b/scm-ui/src/components/Paginator.js @@ -93,8 +93,9 @@ class Paginator extends React.Component { if (page + 1 < pageTotal) { links.push(this.renderPageButton(page + 1, "next")); - links.push(this.seperator()); } + if(page+2 < pageTotal) //if there exists pages between next and last + links.push(this.seperator()); if (page < pageTotal) { links.push(this.renderLastButton()); } From 8b4ee7a489ed40c1187d3b0712dbdc6a2b80e926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 2 Aug 2018 12:06:30 +0200 Subject: [PATCH 2/2] disable submit button of adding a group if name and description are invalid --- scm-ui/public/locales/en/groups.json | 4 +++- scm-ui/src/groups/components/GroupForm.js | 26 ++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/scm-ui/public/locales/en/groups.json b/scm-ui/public/locales/en/groups.json index 3484134901..4f2cdbac92 100644 --- a/scm-ui/public/locales/en/groups.json +++ b/scm-ui/public/locales/en/groups.json @@ -30,7 +30,9 @@ "label": "Edit" }, "group-form": { - "submit": "Submit" + "submit": "Submit", + "name-error": "Group name is invalid", + "description-error": "Description is invalid" }, "delete-group-button": { "label": "Delete", diff --git a/scm-ui/src/groups/components/GroupForm.js b/scm-ui/src/groups/components/GroupForm.js index 0477837604..7a9df2b4c5 100644 --- a/scm-ui/src/groups/components/GroupForm.js +++ b/scm-ui/src/groups/components/GroupForm.js @@ -44,19 +44,25 @@ class GroupForm extends React.Component { } } - onSubmit = (event: Event) => { - event.preventDefault(); - this.props.submitForm(this.state.group); - }; + isFalsy(value) { + if (!value) { + return true; + } + return false; + } isValid = () => { const group = this.state.group; - return !(this.state.nameValidationError || group.name); + return !( + this.state.nameValidationError || + this.isFalsy(group.name) || + this.isFalsy(group.description) + ); }; submit = (event: Event) => { event.preventDefault(); - if (this.isValid) { + if (this.isValid()) { this.props.submitForm(this.state.group); } }; @@ -69,7 +75,7 @@ class GroupForm extends React.Component { nameField = ( { ); } return ( -
+ {nameField} - + ); }