Skip to content

Commit

Permalink
fix: revert 0497ac4e2e961ac141307a3ab7e6790e9bd31705 (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemrys authored Mar 9, 2023
1 parent 9b845e8 commit e77242f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 54 deletions.
13 changes: 0 additions & 13 deletions ui/src/main/webapp/components/ConfigurationTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ function ConfigurationTable({ selectedTab, updateIsPageOpen }) {
setEntity({ ...entity, open: false });
};

// Custom logic to close modal if esc pressed
useEffect(() => {
function handleKeyboardEvent(e) {
if (e && e.keyCode === 27 && entity.open) {
handleModalDialogClose();
}
}
window.addEventListener('keydown', handleKeyboardEvent);
return () => {
window.removeEventListener('keydown', handleKeyboardEvent);
};
});

// generate modal style dialog
const generateModalDialog = () => (
<EntityModal
Expand Down
15 changes: 1 addition & 14 deletions ui/src/main/webapp/components/ErrorModal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import Modal from '@splunk/react-ui/Modal';
import Message from '@splunk/react-ui/Message';
import styled from 'styled-components';
Expand All @@ -18,19 +18,6 @@ function ErrorModal(props) {
setOpen(false);
};

// Custom logic to close modal if esc pressed
useEffect(() => {
function handleKeyboardEvent(e) {
if (e && e.keyCode === 27) {
if (open) handleRequestClose();
}
}
window.addEventListener('keydown', handleKeyboardEvent);
return () => {
window.removeEventListener('keydown', handleKeyboardEvent);
};
});

return (
<ModalWrapper open={open}>
<Modal.Header onRequestClose={handleRequestClose} title={getFormattedMessage(104)} />
Expand Down
14 changes: 0 additions & 14 deletions ui/src/main/webapp/components/table/CustomTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ function CustomTable({
setDeleteModal({ ...deleteModal, open: false });
};

// Custom logic to close modal if esc pressed
useEffect(() => {
function handleKeyboardEvent(e) {
if (e && e.keyCode === 27) {
if (deleteModal) handleDeleteClose();
if (entityModal) handleEntityClose();
}
}
window.addEventListener('keydown', handleKeyboardEvent);
return () => {
window.removeEventListener('keydown', handleKeyboardEvent);
};
});

const handleCloneActionClick = useCallback(
(selectedRow) => {
if (serviceToStyleMap[selectedRow.serviceName] === STYLE_PAGE) {
Expand Down
13 changes: 0 additions & 13 deletions ui/src/main/webapp/pages/Input/InputPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,6 @@ function InputPage() {
setEntity({ ...entity, open: false });
};

// Custom logic to close modal if esc pressed
useEffect(() => {
function handleKeyboardEvent(e) {
if (e && e.keyCode === 27) {
if (entity) handleModalDialogClose();
}
}
window.addEventListener('keydown', handleKeyboardEvent);
return () => {
window.removeEventListener('keydown', handleKeyboardEvent);
};
});

// generate modal style dialog
const generateModalDialog = () => (
<EntityModal
Expand Down

0 comments on commit e77242f

Please sign in to comment.