From 51afe114a58c38b9617f52120ae2cb68e15dc3fd Mon Sep 17 00:00:00 2001 From: Abhijeet Khangarot Date: Tue, 11 Apr 2023 15:18:49 +0530 Subject: [PATCH] frontend: fix react-bootstrap modal with radix modal PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8706 Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com> Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com> GitOrigin-RevId: 7b6db44363bd797d1af00517d6a7b2ef6471fff7 --- frontend/libs/console/legacy-ce/src/index.ts | 1 + .../Services/Data/TableBrowseRows/ViewRows.js | 2 +- .../InvokeManualTrigger.js | 27 +- .../src/lib/new-components/Dialog/Dialog.tsx | 122 +++++---- .../Services/Metrics/Common/CustomCopy.js | 4 +- .../Metrics/Common/DatePickerModal.js | 34 +-- .../Services/Metrics/Common/Modal.js | 253 +++++++++--------- .../Metrics/Common/UsageInspectModal.js | 88 +++--- .../Services/Metrics/Metrics.module.scss | 3 +- .../Metrics/RegressionTests/EditRow.js | 32 +-- .../Metrics/RegressionTests/RunTests.js | 60 ++--- .../Metrics/RegressionTests/TestRunDetails.js | 121 +++++---- .../Metrics/SubscriptionWorkers/ErrorModal.js | 50 ++-- .../Metrics/SubscriptionWorkers/Modal.js | 149 +++++------ 14 files changed, 477 insertions(+), 469 deletions(-) diff --git a/frontend/libs/console/legacy-ce/src/index.ts b/frontend/libs/console/legacy-ce/src/index.ts index ee1796704e3..f02aa55f20a 100644 --- a/frontend/libs/console/legacy-ce/src/index.ts +++ b/frontend/libs/console/legacy-ce/src/index.ts @@ -84,6 +84,7 @@ export { default as PageNotFound } from './lib/components/Error/PageNotFound'; export * from './lib/new-components/Button/'; export * from './lib/new-components/Tooltip/'; export * from './lib/new-components/Badge/'; +export * from './lib/new-components/Dialog'; export { default as dataHeaders } from './lib/components/Services/Data/Common/Headers'; export { handleMigrationErrors } from './lib/components/Services/Data/TableModify/ModifyActions'; export { loadMigrationStatus } from './lib/components/Main/Actions'; diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/TableBrowseRows/ViewRows.js b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/TableBrowseRows/ViewRows.js index 8f35e925fac..aa3fc2ab1bd 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/TableBrowseRows/ViewRows.js +++ b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/TableBrowseRows/ViewRows.js @@ -164,7 +164,7 @@ const ViewRows = props => { Header: '', accessor: 'tableRowActionButtons', id: 'tableRowActionButtons', - width: 182, + width: 'auto', }); _gridHeadings.push({ diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Services/Events/EventTriggers/InvokeManualTrigger/InvokeManualTrigger.js b/frontend/libs/console/legacy-ce/src/lib/components/Services/Events/EventTriggers/InvokeManualTrigger/InvokeManualTrigger.js index 055511d4f66..2b908b70e74 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Services/Events/EventTriggers/InvokeManualTrigger/InvokeManualTrigger.js +++ b/frontend/libs/console/legacy-ce/src/lib/components/Services/Events/EventTriggers/InvokeManualTrigger/InvokeManualTrigger.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Modal from 'react-bootstrap/lib/Modal'; +import { Dialog } from '../../../../../new-components/Dialog'; import AceEditor from 'react-ace'; import { connect } from 'react-redux'; //TODO: check @@ -99,7 +99,7 @@ class InvokeManualTrigger extends React.PureComponent { } return (
-
+
Request
); + + if (!isModalOpen) return null; + return (
- - - Invoking {name} - - {getEventData()} - +
{getEventData()}
+
); } diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/Dialog/Dialog.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/Dialog/Dialog.tsx index 8fea00ba549..411e4b78eb3 100644 --- a/frontend/libs/console/legacy-ce/src/lib/new-components/Dialog/Dialog.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/new-components/Dialog/Dialog.tsx @@ -107,65 +107,85 @@ export type DialogProps = { onClose?: () => void; footer?: FooterProps | React.ReactElement; size?: DialogSize; + portal?: boolean; // provides a way to add styles to the div wrapping the contentContainer?: { className?: string; }; }; -export const Dialog = ({ - children, - hasBackdrop, - title, - titleTooltip, - description, - onClose, - footer, - size = 'md', - contentContainer, -}: DialogProps) => ( - - {hasBackdrop && } - - {onClose && ( - - - - )} - {!!title && ( - - {title} - {!!titleTooltip && ( - - )} - - )} - {!!description && ( - - {description} - - )} -
{ + const { + children, + hasBackdrop, + title, + titleTooltip, + description, + onClose, + footer, + size = 'md', + contentContainer, + } = props; + + return ( + <> + {hasBackdrop && } + - {children} -
- {React.isValidElement(footer) && footer} - {footer && !React.isValidElement(footer) &&