From fb5f41ecd606e5a878df3348e9b1bd8a440910b0 Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Tue, 2 Jan 2024 13:39:51 -0800 Subject: [PATCH] Adjust copy url warnings and CSV modal layout --- .../share_context_menu/csv_export_modal.tsx | 49 ++++---- .../share_context_menu/image_export_modal.tsx | 106 +++++++++--------- .../components/error_unsaved_work_panel.tsx | 27 ++--- .../reporting_panel_content.tsx | 57 +++++----- 4 files changed, 116 insertions(+), 123 deletions(-) diff --git a/x-pack/plugins/reporting/public/share_context_menu/csv_export_modal.tsx b/x-pack/plugins/reporting/public/share_context_menu/csv_export_modal.tsx index 154222bbdc7e6..7a7363a0b8780 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/csv_export_modal.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/csv_export_modal.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiButton, EuiForm, EuiFormRow, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; +import { EuiButton, EuiCallOut, EuiForm, EuiModalBody, EuiModalFooter, EuiModalHeader, EuiModalHeaderTitle, EuiSpacer, } from '@elastic/eui'; import { ToastsSetup } from '@kbn/core-notifications-browser'; import { ThemeServiceSetup } from '@kbn/core-theme-browser'; import { IUiSettingsClient } from '@kbn/core/public'; @@ -102,28 +102,31 @@ export const CsvModalContentUI: FC = (props: Props) => { }; return ( - - - - Share as a CSV - - - - {renderDescription(objectType)} - - - generateReportingJob()} - data-test-subj="generateReportButton" - size="s" - isLoading={Boolean(createReportingJob)} - > - - - - + <> + + Generate a CSV + + + + + + + + generateReportingJob()} + data-test-subj="generateReportButton" + isLoading={Boolean(createReportingJob)} + > + + + + ); }; diff --git a/x-pack/plugins/reporting/public/share_context_menu/image_export_modal.tsx b/x-pack/plugins/reporting/public/share_context_menu/image_export_modal.tsx index 11ad5c1a36232..0205ad8c5fcb6 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/image_export_modal.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/image_export_modal.tsx @@ -14,7 +14,6 @@ import { EuiFlexItem, EuiForm, EuiFormRow, - EuiIconTip, EuiModalBody, EuiModalFooter, EuiModalHeader, @@ -293,51 +292,47 @@ export const ReportingModalContentUI: FC = (props: Props) => { isUnsaved: boolean; exceedsMaxLength: boolean; }) => { - if (isUnsaved) { - if (exceedsMaxLength) { - return ; - } - return ; - } else if (exceedsMaxLength) { - return ; - } + // if (isUnsaved) { + // if (exceedsMaxLength) { + // return ; + // } + // return ; + // } else if (exceedsMaxLength) { + // return ; + // } return ( - - {(copy) => ( - - - - )} - + + + + {(copy) => ( + + + + )} + + + {isUnsaved ? (exceedsMaxLength ? () : ()) : (exceedsMaxLength ? () : null)} + ); }; const saveWarningMessageWithButton = objectId === undefined || objectId === '' ? ( - - } + generateReportingJob()} + data-test-subj="generateReportButton" + isLoading={Boolean(createReportingJob)} > - generateReportingJob()} - data-test-subj="generateReportButton" - isLoading={Boolean(createReportingJob)} - > - - - + + ) : ( = (props: Props) => { Export + + } + iconType="save" + /> + = (props: Props) => { {renderOptions()} + {renderCopyURLButton({ isUnsaved: !isSaved, exceedsMaxLength })} - - - {renderCopyURLButton({ isUnsaved: !isSaved, exceedsMaxLength })} - - - - - - - - - - {saveWarningMessageWithButton} - - - - + + + + {saveWarningMessageWithButton} ); diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/components/error_unsaved_work_panel.tsx b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/components/error_unsaved_work_panel.tsx index 75a6a8ba35626..f210d33976f15 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/components/error_unsaved_work_panel.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/components/error_unsaved_work_panel.tsx @@ -7,33 +7,22 @@ import { i18n } from '@kbn/i18n'; import type { FunctionComponent } from 'react'; import React from 'react'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { EuiCallOut, EuiText, EuiSpacer } from '@elastic/eui'; +import { EuiIconTip } from '@elastic/eui'; const i18nTexts = { title: i18n.translate('xpack.reporting.panelContent.unsavedStateErrorTitle', { - defaultMessage: 'Unsaved work', + defaultMessage: 'Save your work before copying this URL.', }), }; export const ErrorUnsavedWorkPanel: FunctionComponent = () => { return ( - - -

- -

-
- -
+ /> ); }; diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.tsx b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.tsx index 920f74a4f2bba..e683db9a5734e 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.tsx @@ -16,6 +16,8 @@ import { EuiAccordion, EuiButton, EuiCopy, + EuiFlexGroup, + EuiFlexItem, EuiForm, EuiFormRow, EuiHorizontalRule, @@ -125,31 +127,36 @@ class ReportingPanelContentUi extends Component { isUnsaved: boolean; exceedsMaxLength: boolean; }) { - if (isUnsaved) { - if (exceedsMaxLength) { - return ; - } - return ; - } else if (exceedsMaxLength) { - return ; - } + // if (isUnsaved) { + // if (exceedsMaxLength) { + // return ; + // } + // return ; + // } else if (exceedsMaxLength) { + // return ; + // } return ( - - {(copy) => ( - - - - )} - + + + + {(copy) => ( + + + + )} + + + {isUnsaved ? (exceedsMaxLength ? () : ()) : (exceedsMaxLength ? () : null)} + ); } @@ -163,7 +170,7 @@ class ReportingPanelContentUi extends Component { helpText={ } >