Skip to content

Commit 0cda420

Browse files
authored
make enter key submit form in the add server dialog for GH Enterprise and BitBucket Server (#1466)
1 parent 320d9c3 commit 0cda420

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

blueocean-dashboard/src/main/js/creation/bitbucket/server/BbAddServerDialog.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ class BBAddServerDialog extends React.Component {
2727
t = props.flowManager.translate;
2828
}
2929

30+
componentDidMount() {
31+
document.addEventListener('keydown', this.handleKeyDownEvent);
32+
}
33+
34+
componentWillUnmount() {
35+
document.removeEventListener('keydown', this.handleKeyDownEvent);
36+
}
37+
38+
handleKeyDownEvent = (event) => {
39+
if (event.key === 'Enter') {
40+
this._onCreateClick();
41+
}
42+
}
43+
3044
_nameChange(value) {
3145
this.setState({
3246
nameValue: value,

blueocean-dashboard/src/main/js/creation/github-enterprise/GHEAddServerDialog.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ class GHEAddServerDialog extends React.Component {
2727
t = props.flowManager.translate;
2828
}
2929

30+
componentDidMount() {
31+
document.addEventListener('keydown', this.handleKeyDownEvent);
32+
}
33+
34+
componentWillUnmount() {
35+
document.removeEventListener('keydown', this.handleKeyDownEvent);
36+
}
37+
38+
handleKeyDownEvent = (event) => {
39+
if (event.key === 'Enter') {
40+
this._onCreateClick();
41+
}
42+
}
43+
3044
_nameChange(value) {
3145
this.setState({
3246
nameValue: value,

0 commit comments

Comments
 (0)