Skip to content

Commit

Permalink
Fix some DatePicker issues
Browse files Browse the repository at this point in the history
- Work around bug in DatePicker when validating the date
- Fix position of the DatePicker so that it doesn't jump around
- Make newlines in changelog actual newlines
  • Loading branch information
rsnyman committed May 8, 2023
1 parent e3b5092 commit b7a6877
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@monaco-editor/react": "^4.4.6",
"@patternfly/patternfly": "^4.224.2",
"@patternfly/react-charts": "^6.94.18",
"@patternfly/react-core": "^4.276.6",
"@patternfly/react-core": "^4.276.9",
"@patternfly/react-icons": "^4.93.6",
"@patternfly/react-styles": "^4.92.6",
"@patternfly/react-table": "^4.112.39",
Expand Down
16 changes: 15 additions & 1 deletion frontend/src/components/add-token-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import {
import { ExclamationCircleIcon } from '@patternfly/react-icons';


function getToday() {
const now = new Date();
return now.toISOString().split('T')[0];
}

function dateParse(val) {
return val && val.split('-').length === 3 && new Date(`${val}T00:00:00`);
}

export class AddTokenModal extends React.Component {
static propTypes = {
onSave: PropTypes.func,
Expand All @@ -25,7 +34,7 @@ export class AddTokenModal extends React.Component {
super(props);
this.state = {
name: '',
expiryDate: '',
expiryDate: getToday(),
isNameValid: true,
isExpiryValid: true
};
Expand Down Expand Up @@ -115,12 +124,17 @@ export class AddTokenModal extends React.Component {
>
<DatePicker
appendTo={() => document.getElementById('add-token-modal')}
dateParse={dateParse}
onChange={this.onExpiryDateChange}
value={this.state.expiryDate}
inputProps={{
id: "token-expiry-date",
validated: this.state.isExpiryValid ? ValidatedOptions.default : ValidatedOptions.error
}}
popoverProps={{
enableFlip: false,
position: 'bottom'
}}
/>
</FormGroup>
</Form>
Expand Down
2 changes: 1 addition & 1 deletion scripts/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if [[ "$CAN_COMMIT" = true ]]; then
git add . > /dev/null 2>&1
COMMIT_MSG="Release $NEW_VERSION"
if [[ $GENERATE_CHANGELOG = true ]]; then
COMMIT_MSG="$COMMIT_MSG\n\n$CHANGELOG"
COMMIT_MSG="$COMMIT_MSG"$'\n\n'"$CHANGELOG"
fi
git commit -q -m "$COMMIT_MSG"
echo "done, new branch created: $BRANCH_NAME"
Expand Down

0 comments on commit b7a6877

Please sign in to comment.