This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new 54186d8  Fixed when pressing enter in Create new Integration dialog 
cancels - Issue #192 (#199)
54186d8 is described below

commit 54186d80598f253ede40df1e9d4b945b63837b65
Author: Rafael Marques <[email protected]>
AuthorDate: Tue Feb 22 13:00:51 2022 -0300

    Fixed when pressing enter in Create new Integration dialog cancels - Issue 
#192 (#199)
---
 karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx 
b/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx
index abc6998..83d72b7 100644
--- a/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx
+++ b/karavan-app/src/main/webapp/src/integrations/IntegrationPage.tsx
@@ -77,6 +77,13 @@ export class IntegrationPage extends React.Component<Props, 
State> {
         this.setState({isModalOpen:false, newName:""});
     }
 
+    onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
+        if (event.key === 'Enter' && this.state.newName !== undefined) {
+          this.saveAndCloseModal();
+        }
+    }    
+
+
     render() {
         return (
             <PageSection padding={{default: 'noPadding'}}>
@@ -97,6 +104,7 @@ export class IntegrationPage extends React.Component<Props, 
State> {
                     variant={ModalVariant.small}
                     isOpen={this.state.isModalOpen}
                     onClose={this.closeModal}
+                    onKeyDown={this.onKeyDown}
                     actions={[
                         <Button key="confirm" variant="primary" 
onClick={this.saveAndCloseModal}>Save</Button>,
                         <Button key="cancel" variant="secondary" 
onClick={this.closeModal}>Cancel</Button>

Reply via email to