From dd28d16651a90e42723df90f6209bb23859e063d Mon Sep 17 00:00:00 2001 From: Nicolas Agustin Guevara Pihen Date: Fri, 13 Dec 2024 14:55:34 -0300 Subject: [PATCH] Fix formatting --- .../tables/components/export-table-csv.tsx | 73 +++++++++++-------- .../components/common/tables/table-wz-api.tsx | 1 - 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/plugins/main/public/components/common/tables/components/export-table-csv.tsx b/plugins/main/public/components/common/tables/components/export-table-csv.tsx index b31253c295..1ec3e500f5 100644 --- a/plugins/main/public/components/common/tables/components/export-table-csv.tsx +++ b/plugins/main/public/components/common/tables/components/export-table-csv.tsx @@ -11,19 +11,20 @@ */ import React from 'react'; -import { - EuiFlexItem, - EuiButtonEmpty, - EuiIconTip -} from '@elastic/eui'; +import { EuiFlexItem, EuiButtonEmpty, EuiIconTip } from '@elastic/eui'; import exportCsv from '../../../../react-services/wz-csv'; -import { getToasts } from '../../../../kibana-services'; +import { getToasts } from '../../../../kibana-services'; import { UI_ERROR_SEVERITIES } from '../../../../react-services/error-orchestrator/types'; import { UI_LOGGER_LEVELS } from '../../../../../common/constants'; import { getErrorOrchestrator } from '../../../../react-services/common-services'; -export function ExportTableCsv({ endpoint, totalItems, filters, title, maxRows }) { - +export function ExportTableCsv({ + endpoint, + totalItems, + filters, + title, + maxRows, +}) { const showToast = (color, title, time) => { getToasts().add({ color: color, @@ -34,15 +35,12 @@ export function ExportTableCsv({ endpoint, totalItems, filters, title, maxRows } const downloadCsv = async () => { try { - const formatedFilters = Object.entries(filters).map(([name, value]) => ({name, value})); + const formatedFilters = Object.entries(filters).map(([name, value]) => ({ + name, + value, + })); showToast('success', 'Your download should begin automatically...', 3000); - await exportCsv( - endpoint, - [ - ...formatedFilters - ], - `${(title).toLowerCase()}` - ); + await exportCsv(endpoint, [...formatedFilters], `${title.toLowerCase()}`); } catch (error) { const options = { context: `${ExportTableCsv.name}.downloadCsv`, @@ -56,25 +54,36 @@ export function ExportTableCsv({ endpoint, totalItems, filters, title, maxRows } }; getErrorOrchestrator().handleError(options); } - } + }; - return - downloadCsv()}> - Export formatted - {totalItems > maxRows&&<> App Settings`} - size='m' - color='primary' - type='iInCircle' - />} - + return ( + + downloadCsv()} + > + Export formatted + {totalItems > maxRows && ( + <> + {' '} + App Settings`} + size='m' + color='primary' + type='iInCircle' + /> + + )} + + ); } // Set default props ExportTableCsv.defaultProps = { - endpoint:'/', - totalItems:0, - filters: [], - title:"" - }; + endpoint: '/', + totalItems: 0, + filters: [], + title: '', +}; diff --git a/plugins/main/public/components/common/tables/table-wz-api.tsx b/plugins/main/public/components/common/tables/table-wz-api.tsx index 6746b0bc3b..f40e81b955 100644 --- a/plugins/main/public/components/common/tables/table-wz-api.tsx +++ b/plugins/main/public/components/common/tables/table-wz-api.tsx @@ -253,7 +253,6 @@ export function TableWzAPI({ } maxRows={maxRows} /> - )} {/* Render optional post custom action button */}