From 2be3ced61340a90c46af3d7cae8e94455b7a99b0 Mon Sep 17 00:00:00 2001 From: Dan Dong Date: Wed, 21 Aug 2024 16:15:32 -0700 Subject: [PATCH] Fixed lint errors Signed-off-by: Dan Dong --- .../custom_panels/custom_panel_table.tsx | 2 +- .../custom_panels/custom_panel_view_so.tsx | 5 ++--- .../visualization_flyout.tsx | 2 +- .../visualization_flyout_so.tsx | 4 ++-- .../custom_modals/custom_input_modal.tsx | 21 +++++++++++++++---- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/public/components/custom_panels/custom_panel_table.tsx b/public/components/custom_panels/custom_panel_table.tsx index fda2e077a6..92b55a6968 100644 --- a/public/components/custom_panels/custom_panel_table.tsx +++ b/public/components/custom_panels/custom_panel_table.tsx @@ -155,7 +155,7 @@ export const CustomPanelTable = ({ sourcePanel = legacyFetchResult.operationalPanel; } - const { id, ...newPanel } = { + const { ...newPanel } = { ...sourcePanel, title: newName, }; diff --git a/public/components/custom_panels/custom_panel_view_so.tsx b/public/components/custom_panels/custom_panel_view_so.tsx index e4d7f28d32..5db2548343 100644 --- a/public/components/custom_panels/custom_panel_view_so.tsx +++ b/public/components/custom_panels/custom_panel_view_so.tsx @@ -29,7 +29,7 @@ import { import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; import last from 'lodash/last'; import moment from 'moment'; -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { CoreStart } from '../../../../../src/core/public'; import { CREATE_PANEL_MESSAGE } from '../../../common/constants/custom_panels'; @@ -119,7 +119,6 @@ export const CustomPanelViewSO = (props: CustomPanelViewProps) => { parentBreadcrumbs, childBreadcrumbs, updateAvailabilityVizId, - cloneCustomPanel, onEditClick, onAddClick, } = props; @@ -131,7 +130,7 @@ export const CustomPanelViewSO = (props: CustomPanelViewProps) => { const [loading, setLoading] = useState(true); const [pplFilterValue, setPPLFilterValue] = useState(''); - const [baseQuery, setBaseQuery] = useState(''); + const [baseQuery, _] = useState(''); const [onRefresh, setOnRefresh] = useState(false); const [inputDisabled, setInputDisabled] = useState(true); diff --git a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout.tsx b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout.tsx index f9ba56d5ba..a017cdb926 100644 --- a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout.tsx +++ b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout.tsx @@ -127,7 +127,7 @@ export const VisaulizationFlyout = ({ const [modalContent, setModalContent] = useState(<>); const closeModal = () => setIsModalVisible(false); - const showModal = (modalType: string) => { + const showModal = (_: string) => { setModalContent( diff --git a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx index 7c7e86441d..b9d8845f34 100644 --- a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx +++ b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx @@ -127,7 +127,7 @@ export const VisaulizationFlyoutSO = ({ const [modalContent, setModalContent] = useState(<>); const closeModal = () => setIsModalVisible(false); - const showModal = (modalType: string) => { + const showModal = (_: string) => { setModalContent( @@ -178,7 +178,7 @@ export const VisaulizationFlyoutSO = ({ replaceVizInPanel(panel, replaceVisualizationId, selectValue, newVisualizationTitle) ); } else { - const visualizationsWithNewPanel = addVisualizationPanel({ + addVisualizationPanel({ savedVisualizationId: selectValue, onSuccess: `Visualization ${newVisualizationTitle} successfully added!`, onFailure: `Error in adding ${newVisualizationTitle} visualization to the panel`, diff --git a/public/components/notebooks/components/helpers/custom_modals/custom_input_modal.tsx b/public/components/notebooks/components/helpers/custom_modals/custom_input_modal.tsx index 10ade574a4..8c2dd39b34 100644 --- a/public/components/notebooks/components/helpers/custom_modals/custom_input_modal.tsx +++ b/public/components/notebooks/components/helpers/custom_modals/custom_input_modal.tsx @@ -30,7 +30,7 @@ import { * btn2txt - string as content to fill "confirm button" * openNoteName - Default input value for the field */ -type CustomInputModalProps = { +interface CustomInputModalProps { runModal: (value: string) => void; closeModal: ( event?: React.KeyboardEvent | React.MouseEvent @@ -41,10 +41,19 @@ type CustomInputModalProps = { btn2txt: string; openNoteName: string; helpText: string; -}; +} export const CustomInputModal = (props: CustomInputModalProps) => { - const { runModal, closeModal, labelTxt, titletxt, btn1txt, btn2txt, openNoteName, helpText } = props; + const { + runModal, + closeModal, + labelTxt, + titletxt, + btn1txt, + btn2txt, + openNoteName, + helpText, + } = props; const [value, setValue] = useState(openNoteName || ''); // sets input value const onChange = (e: React.ChangeEvent) => { @@ -73,7 +82,11 @@ export const CustomInputModal = (props: CustomInputModalProps) => { {btn1txt} - runModal(value)} fill> + runModal(value)} + fill + > {btn2txt}