Skip to content

Commit

Permalink
Merge pull request finos#1965 from NguyenTranHoangSym/SDA-4322
Browse files Browse the repository at this point in the history
SDA-4322: About Symphony - Unable to dismiss the pod URL editor by pressing ESC key
  • Loading branch information
NguyenTranHoangSym authored Oct 5, 2023
2 parents d32b8fc + 6616349 commit 244468a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/renderer/components/about-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ interface IState {

const ABOUT_SYMPHONY_NAMESPACE = 'AboutSymphony';
const SFE_CLIENT_TYPE_NAME = 'SFE-Lite';
const KEY_CODE = {
ENTER: 13,
ESCAPE: 27,
};

/**
* Window that display app version and copyright info
Expand All @@ -58,6 +62,7 @@ export default class AboutApp extends React.Component<{}, IState> {
onPodInputBlur: (event) => this.handlePodInputBlur(event),
};
private closeButtonRef: React.RefObject<HTMLButtonElement>;
private previousUrl: string = '';

constructor(props) {
super(props);
Expand Down Expand Up @@ -272,10 +277,19 @@ export default class AboutApp extends React.Component<{}, IState> {
* @param e
*/
public onKeyDown = (e) => {
if (e.keyCode === 13) {
if (e.keyCode === KEY_CODE.ENTER) {
const { value } = e.target;
this.setState({ updatedHostname: value });
this.handlePodInputBlur(e);
this.previousUrl = value;
}
if (e.keyCode === KEY_CODE.ESCAPE) {
this.setState({
updatedHostname: this.previousUrl,
isPodEditing: false,
isValidHostname: true,
hostname: this.previousUrl,
});
}
};

Expand Down Expand Up @@ -306,6 +320,7 @@ export default class AboutApp extends React.Component<{}, IState> {
*/
private updateState(_event, data): void {
const updatedData = { ...data, updatedHostname: data.hostname };
this.previousUrl = data.hostname;
this.setState(updatedData as IState);
}

Expand Down

0 comments on commit 244468a

Please sign in to comment.