From 2406e3f2e9e033df5ca9705e49a75b3928037f35 Mon Sep 17 00:00:00 2001 From: Praveen K B Date: Fri, 6 Dec 2024 21:41:53 +0530 Subject: [PATCH] Fixed few ESLint issues --- src/@types/parseable/api/dashboards.ts | 8 ++++---- src/api/auth.ts | 2 +- src/api/query.ts | 1 - src/assets/customLoader/ParseableAnimate.tsx | 2 ++ src/components/Header/RefreshInterval.tsx | 2 +- src/components/Header/RefreshNow.tsx | 4 ++-- src/components/Header/TimeRange.tsx | 4 ++-- src/components/Navbar/index.tsx | 4 +++- src/components/Navbar/rolesHandler.ts | 6 +++--- src/constants/theme.ts | 2 +- src/hooks/useAlertsEditor.tsx | 2 +- src/hooks/useCacheToggle.tsx | 2 +- src/hooks/useClusterInfo.ts | 2 +- src/hooks/useDashboards.tsx | 2 +- src/hooks/useGetLogStreamSchema.ts | 3 +-- src/hooks/useGetStreamInfo.tsx | 2 +- src/hooks/useLogStreamStats.tsx | 2 +- src/hooks/useLoginForm.ts | 4 ++-- src/hooks/useQueryResult.tsx | 2 +- src/hooks/useRetentionEditor.tsx | 2 +- src/hooks/useSavedFilters.tsx | 4 ++-- src/pages/Dashboards/CreateDashboardModal.tsx | 2 +- src/pages/Dashboards/Dashboard.tsx | 4 ++-- src/pages/Dashboards/SideBar.tsx | 2 +- src/pages/Dashboards/Table.tsx | 2 +- src/pages/Dashboards/Tile.tsx | 2 +- src/pages/Dashboards/Toolbar.tsx | 6 +++--- src/pages/Dashboards/VizEditorModal.tsx | 2 +- src/pages/Dashboards/hooks.ts | 4 ++-- src/pages/Dashboards/hooks/useParamsController.ts | 2 +- src/pages/Dashboards/index.tsx | 1 - src/pages/Dashboards/providers/DashboardsProvider.ts | 5 ++--- src/pages/Home/CreateStreamModal.tsx | 2 +- src/pages/Stream/Views/Explore/LoadingViews.tsx | 4 ++-- src/pages/Stream/Views/Explore/LogsView.tsx | 1 - src/pages/Stream/Views/LiveTail/LiveLogTable.tsx | 9 +++------ src/pages/Stream/Views/Manage/Alerts.tsx | 1 - src/pages/Stream/components/ErrorMarker.tsx | 6 +++--- src/pages/Stream/components/EventTimeLineGraph.tsx | 2 +- src/pages/Stream/components/PrimaryToolbar.tsx | 6 +++--- .../Stream/components/Querier/FilterQueryBuilder.tsx | 4 ++-- .../Stream/components/Querier/SavedFiltersModal.tsx | 2 +- src/pages/Stream/hooks/useParamsController.ts | 2 +- src/pages/Systems/Cluster.tsx | 1 - src/pages/Systems/StandaloneServer.tsx | 2 +- src/routes/AccessSpecificRoute.tsx | 1 - src/utils/exportHelpers.ts | 4 ++-- src/utils/formatBytes.ts | 8 ++++---- src/utils/index.ts | 2 +- src/utils/sanitiseSqlString.ts | 6 +----- src/utils/timeRangeUtils.ts | 4 ++-- 51 files changed, 75 insertions(+), 86 deletions(-) diff --git a/src/@types/parseable/api/dashboards.ts b/src/@types/parseable/api/dashboards.ts index 58b2b249..3a21a6f6 100644 --- a/src/@types/parseable/api/dashboards.ts +++ b/src/@types/parseable/api/dashboards.ts @@ -116,9 +116,9 @@ export type BarChartBasicTypes = 'default' | 'stacked' | 'percent'; export type AreaChartBasicTypes = 'default' | 'stacked' | 'percent'; // orientation -export type BarChartOrientationType = 'horizontal' | 'vertical' -export type AreaChartOrientationType = 'horizontal' | 'vertical' -export type LineChartOrientationType = 'horizontal' | 'vertical' +export type BarChartOrientationType = 'horizontal' | 'vertical'; +export type AreaChartOrientationType = 'horizontal' | 'vertical'; +export type LineChartOrientationType = 'horizontal' | 'vertical'; export type BarChartProps = { data: TileData; @@ -137,7 +137,7 @@ export type LineChartProps = { xUnit: UnitType; yUnit: UnitType; orientation: LineChartOrientationType; -} +}; export type AreaChartProps = { data: TileData; diff --git a/src/api/auth.ts b/src/api/auth.ts index 1031eb31..03513218 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -13,4 +13,4 @@ export const loginIn = (username: string, password: string) => { export const logOut = () => { return Axios().get(LOGOUT_URL); -} +}; diff --git a/src/api/query.ts b/src/api/query.ts index 6dee5efc..85e4db23 100644 --- a/src/api/query.ts +++ b/src/api/query.ts @@ -1,4 +1,3 @@ -import _ from 'lodash'; import { Axios } from './axios'; import { LOG_QUERY_URL } from './constants'; import { Log, LogsQuery, LogsResponseWithHeaders } from '@/@types/parseable/api/query'; diff --git a/src/assets/customLoader/ParseableAnimate.tsx b/src/assets/customLoader/ParseableAnimate.tsx index 658e97a2..c4dc3d03 100644 --- a/src/assets/customLoader/ParseableAnimate.tsx +++ b/src/assets/customLoader/ParseableAnimate.tsx @@ -57,4 +57,6 @@ const ParseableAnimated: MantineLoaderComponent = forwardRef(() => ( )); +ParseableAnimated.displayName = 'ParsableAnimated'; + export default ParseableAnimated; diff --git a/src/components/Header/RefreshInterval.tsx b/src/components/Header/RefreshInterval.tsx index fbc05103..dd714e59 100644 --- a/src/components/Header/RefreshInterval.tsx +++ b/src/components/Header/RefreshInterval.tsx @@ -12,7 +12,7 @@ import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/Ap const { setRefreshInterval, getCleanStoreForRefetch } = logsStoreReducers; const { syncTimeRange } = appStoreReducers; const RefreshInterval: FC = () => { - const [, setAppStore] = useAppStore((_store) => null); + const [, setAppStore] = useAppStore(() => null); const [refreshInterval, setLogsStore] = useLogsStore((store) => store.refreshInterval); const Icon = useMemo(() => (refreshInterval ? IconRefresh : IconRefreshOff), [refreshInterval]); const timerRef = useRef(null); diff --git a/src/components/Header/RefreshNow.tsx b/src/components/Header/RefreshNow.tsx index 0744be61..2ca234d9 100644 --- a/src/components/Header/RefreshNow.tsx +++ b/src/components/Header/RefreshNow.tsx @@ -11,8 +11,8 @@ const { syncTimeRange } = appStoreReducers; const renderRefreshIcon = () => ; const RefreshNow: FC = () => { - const [, setLogsStore] = useLogsStore((_store) => null); - const [, setAppStore] = useAppStore((_store) => null); + const [, setLogsStore] = useLogsStore(() => null); + const [, setAppStore] = useAppStore(() => null); const onRefresh = useCallback(() => { setAppStore((store) => syncTimeRange(store)); diff --git a/src/components/Header/TimeRange.tsx b/src/components/Header/TimeRange.tsx index b92eb34c..41f86886 100644 --- a/src/components/Header/TimeRange.tsx +++ b/src/components/Header/TimeRange.tsx @@ -43,7 +43,7 @@ const RelativeTimeIntervals = (props: { const TimeRange: FC = () => { const [timeRange, setAppStore] = useAppStore((store) => store.timeRange); - const [, setLogStore] = useLogsStore((_store) => null); + const [, setLogStore] = useLogsStore(() => null); const { label, shiftInterval, interval, startTime, endTime, type } = timeRange; const handleOuterClick = useCallback((event: any) => { const targetClassNames: string[] = event.target?.classList || []; @@ -204,7 +204,7 @@ function isDateInRange(startDate: Date, endDate: Date, currentDate: Date) { } const CustomTimeRange: FC = ({ setOpened, resetToRelative }) => { - const [, setLogStore] = useLogsStore((_store) => null); + const [, setLogStore] = useLogsStore(() => null); const [{ startTime: startTimeFromStore, endTime: endTimeFromStore, type }, setAppStore] = useAppStore( (store) => store.timeRange, ); diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index 64fbe52c..61186096 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -202,7 +202,9 @@ const Navbar: FC = () => { ? toggleUserModal : navAction.key === 'logout' ? signOutHandler - : () => {}; + : () => { + return; + }; return ( { @@ -121,7 +121,7 @@ const getStreamsSepcificAccess = (rolesWithRoleName: UserRoles | null, stream?: const getUserSepcificStreams = (rolesWithRoleName: object[], streams: any[]) => { let userStreams: any[] = []; let roles: any[] = []; - for (var prop in rolesWithRoleName) { + for (const prop in rolesWithRoleName) { roles = [...roles, ...(rolesWithRoleName[prop] as any)]; } roles.forEach((role: any) => { diff --git a/src/constants/theme.ts b/src/constants/theme.ts index 3a092f42..4b6b0cab 100644 --- a/src/constants/theme.ts +++ b/src/constants/theme.ts @@ -12,4 +12,4 @@ export const DASHBOARDS_SIDEBAR_WIDTH = 200; export const DASHBOARD_TOOLBAR_HEIGHT = 50; export const JSON_VIEW_TOOLBAR_HEIGHT = 50; export const LOGS_CONFIG_SIDEBAR_WIDTH = 200; -export const LOGS_FOOTER_HEIGHT = 50; \ No newline at end of file +export const LOGS_FOOTER_HEIGHT = 50; diff --git a/src/hooks/useAlertsEditor.tsx b/src/hooks/useAlertsEditor.tsx index c2adf9a3..256b7e72 100644 --- a/src/hooks/useAlertsEditor.tsx +++ b/src/hooks/useAlertsEditor.tsx @@ -6,7 +6,7 @@ import { useStreamStore, streamStoreReducers } from '@/pages/Stream/providers/St const { setAlertsConfig } = streamStoreReducers; const useAlertsQuery = (streamName: string, hasAlertsAccess: boolean, isStandAloneMode: boolean | null) => { - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const { data, isError, isSuccess, isLoading, refetch } = useQuery( ['fetch-log-stream-alert', streamName, hasAlertsAccess], () => getLogStreamAlerts(streamName), diff --git a/src/hooks/useCacheToggle.tsx b/src/hooks/useCacheToggle.tsx index f23ae792..c7e62707 100644 --- a/src/hooks/useCacheToggle.tsx +++ b/src/hooks/useCacheToggle.tsx @@ -6,7 +6,7 @@ import { useStreamStore, streamStoreReducers } from '@/pages/Stream/providers/St const { setCacheEnabled } = streamStoreReducers; export const useCacheToggle = (streamName: string) => { - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const { data: checkCacheData, refetch: getCacheStatusRefetch, diff --git a/src/hooks/useClusterInfo.ts b/src/hooks/useClusterInfo.ts index d33b4f0e..094072c3 100644 --- a/src/hooks/useClusterInfo.ts +++ b/src/hooks/useClusterInfo.ts @@ -8,7 +8,7 @@ import { useClusterStore, clusterStoreReducers } from '@/pages/Systems/providers const { setIngestorMachines, setCurrentMachineData } = clusterStoreReducers; export const useClusterInfo = () => { - const [, setClusterStore] = useClusterStore((_store) => null); + const [, setClusterStore] = useClusterStore(() => null); const { data: clusterInfoData, isError: getClusterInfoError, diff --git a/src/hooks/useDashboards.tsx b/src/hooks/useDashboards.tsx index b5877bd5..c958a6d6 100644 --- a/src/hooks/useDashboards.tsx +++ b/src/hooks/useDashboards.tsx @@ -154,7 +154,7 @@ export const useTileQuery = (opts: { onSuccess?: (data: TileQueryResponse) => void; enabled?: boolean; }) => { - const [, setDashboardsStore] = useDashboardsStore((_store) => null); + const [, setDashboardsStore] = useDashboardsStore(() => null); const { query, startTime, endTime, tileId, enabled = true } = opts; const { isLoading, isFetching, isError, refetch } = useQuery( [tileId, startTime, endTime], diff --git a/src/hooks/useGetLogStreamSchema.ts b/src/hooks/useGetLogStreamSchema.ts index ea921dd9..ad72865a 100644 --- a/src/hooks/useGetLogStreamSchema.ts +++ b/src/hooks/useGetLogStreamSchema.ts @@ -1,7 +1,6 @@ import { getLogStreamSchema } from '@/api/logStream'; import { useStreamStore, streamStoreReducers } from '@/pages/Stream/providers/StreamProvider'; import { AxiosError, isAxiosError } from 'axios'; -import _ from 'lodash'; import { useQuery } from 'react-query'; import { useState } from 'react'; @@ -9,7 +8,7 @@ const { setStreamSchema } = streamStoreReducers; export const useGetStreamSchema = (opts: { streamName: string }) => { const { streamName } = opts; - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const [errorMessage, setErrorMesssage] = useState(null); const { isError, isSuccess, isLoading, refetch, isRefetching } = useQuery( diff --git a/src/hooks/useGetStreamInfo.tsx b/src/hooks/useGetStreamInfo.tsx index 628ce0ad..2ebdf72f 100644 --- a/src/hooks/useGetStreamInfo.tsx +++ b/src/hooks/useGetStreamInfo.tsx @@ -7,7 +7,7 @@ import { useQuery } from 'react-query'; const { setStreamInfo } = streamStoreReducers; export const useGetStreamInfo = (currentStream: string, initialFetch: boolean) => { - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const { data: getStreamInfoData, isError: getStreamInfoError, diff --git a/src/hooks/useLogStreamStats.tsx b/src/hooks/useLogStreamStats.tsx index c1bc3d11..d08135fd 100644 --- a/src/hooks/useLogStreamStats.tsx +++ b/src/hooks/useLogStreamStats.tsx @@ -8,7 +8,7 @@ import { AxiosError, isAxiosError } from 'axios'; const { setStats } = streamStoreReducers; export const useLogStreamStats = (streamName: string, fetchStartTime?: Dayjs) => { - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const { data: getLogStreamStatsData, isSuccess: getLogStreamStatsDataIsSuccess, diff --git a/src/hooks/useLoginForm.ts b/src/hooks/useLoginForm.ts index a7c38b8b..0cc3b5b2 100644 --- a/src/hooks/useLoginForm.ts +++ b/src/hooks/useLoginForm.ts @@ -9,13 +9,13 @@ import { HOME_ROUTE } from '@/constants/routes'; import { useId } from '@mantine/hooks'; import { useEffect } from 'react'; import Cookies from 'js-cookie'; -import { getQueryParam } from '@/utils'; +import { useGetQueryParam } from '@/utils'; import { isAxiosError } from 'axios'; import _ from 'lodash'; export const useLoginForm = () => { const notificationId = useId(); - const queryParams = getQueryParam(); + const queryParams = useGetQueryParam(); const [loading, setLoading] = useMountedState(false); const [error, setError] = useMountedState(null); const auth = Cookies.get('session'); diff --git a/src/hooks/useQueryResult.tsx b/src/hooks/useQueryResult.tsx index c288305f..4818bec1 100644 --- a/src/hooks/useQueryResult.tsx +++ b/src/hooks/useQueryResult.tsx @@ -60,7 +60,7 @@ export const useFetchCount = () => { const { setTotalCount } = logsStoreReducers; const [custQuerySearchState] = useLogsStore((store) => store.custQuerySearchState); const [timeRange] = useAppStore((store) => store.timeRange); - const [, setLogsStore] = useLogsStore((_store) => null); + const [, setLogsStore] = useLogsStore(() => null); const { isQuerySearchActive, custSearchQuery, activeMode } = custQuerySearchState; const [appliedQuery] = useFilterStore((store) => store.appliedQuery); diff --git a/src/hooks/useRetentionEditor.tsx b/src/hooks/useRetentionEditor.tsx index 18ee3451..c34ca1ba 100644 --- a/src/hooks/useRetentionEditor.tsx +++ b/src/hooks/useRetentionEditor.tsx @@ -8,7 +8,7 @@ import _ from 'lodash'; const { setRetention } = streamStoreReducers; export const useRetentionQuery = (streamName: string, hasSettingsAccess: boolean) => { - const [, setStreamStore] = useStreamStore((_store) => null); + const [, setStreamStore] = useStreamStore(() => null); const { data: getLogRetentionData, isError: getLogRetentionIsError, diff --git a/src/hooks/useSavedFilters.tsx b/src/hooks/useSavedFilters.tsx index 45623870..d9071095 100644 --- a/src/hooks/useSavedFilters.tsx +++ b/src/hooks/useSavedFilters.tsx @@ -10,8 +10,8 @@ const { setSavedFilters } = appStoreReducers; const { updateSavedFilterId } = logsStoreReducers; const useSavedFiltersQuery = () => { - const [, setAppStore] = useAppStore((_store) => null); - const [, setLogsStore] = useLogsStore((_store) => null); + const [, setAppStore] = useAppStore(() => null); + const [, setLogsStore] = useLogsStore(() => null); const { isError, isSuccess, isLoading, refetch, isRefetching } = useQuery( ['saved-filters'], () => getSavedFilters(), diff --git a/src/pages/Dashboards/CreateDashboardModal.tsx b/src/pages/Dashboards/CreateDashboardModal.tsx index 2283ee4c..07b571de 100644 --- a/src/pages/Dashboards/CreateDashboardModal.tsx +++ b/src/pages/Dashboards/CreateDashboardModal.tsx @@ -29,7 +29,7 @@ const useDashboardForm = (opts: FormOpts) => { initialValues: opts, validate: { name: (val) => (_.isEmpty(val) ? 'Name cannot be empty' : null), - description: (_val) => null, + description: () => null, }, validateInputOnChange: true, validateInputOnBlur: true, diff --git a/src/pages/Dashboards/Dashboard.tsx b/src/pages/Dashboards/Dashboard.tsx index ec614ce6..a15352ab 100644 --- a/src/pages/Dashboards/Dashboard.tsx +++ b/src/pages/Dashboards/Dashboard.tsx @@ -254,7 +254,7 @@ const ImportDashboardModal = () => { }; const NoDashboardsView = () => { - const [, setDashboardsStore] = useDashboardsStore((_store) => null); + const [, setDashboardsStore] = useDashboardsStore(() => null); const openCreateDashboardModal = useCallback(() => { setDashboardsStore((store) => toggleCreateDashboardModal(store, true)); @@ -289,7 +289,7 @@ const NoDashboardsView = () => { }; const NoTilesView = () => { - const [, setDashbaordsStore] = useDashboardsStore((_store) => null); + const [, setDashbaordsStore] = useDashboardsStore(() => null); const openCreateTileModal = useCallback(() => { setDashbaordsStore((store) => toggleCreateTileModal(store, true)); diff --git a/src/pages/Dashboards/SideBar.tsx b/src/pages/Dashboards/SideBar.tsx index f2eb192f..dc435177 100644 --- a/src/pages/Dashboards/SideBar.tsx +++ b/src/pages/Dashboards/SideBar.tsx @@ -68,7 +68,7 @@ const DashboardList = (props: { updateTimeRange: (dashboard: Dashboard) => void const renderShareIcon = () => ; const ImportDashboardButton = () => { - const [_store, setDashbaordsStore] = useDashboardsStore((_store) => null); + const [, setDashbaordsStore] = useDashboardsStore(() => null); const onClick = useCallback(() => { setDashbaordsStore((store) => toggleImportDashboardModal(store, true)); }, []); diff --git a/src/pages/Dashboards/Table.tsx b/src/pages/Dashboards/Table.tsx index 543c9419..3b98857f 100644 --- a/src/pages/Dashboards/Table.tsx +++ b/src/pages/Dashboards/Table.tsx @@ -59,7 +59,7 @@ const TableViz = (props: { data: TileQueryResponse; tick_config: TickConfig[] }) return ( - + {hasNoData ? ( ) : ( diff --git a/src/pages/Dashboards/Tile.tsx b/src/pages/Dashboards/Tile.tsx index dfb5e898..8047ed6b 100644 --- a/src/pages/Dashboards/Tile.tsx +++ b/src/pages/Dashboards/Tile.tsx @@ -165,7 +165,7 @@ function TileControls(props: { tile: TileType; data: TileQueryResponse }) { } = props; const { records = [], fields = [] } = data; const [allowDrag] = useDashboardsStore((store) => store.allowDrag); - const [, setDashboardsStore] = useDashboardsStore((_store) => null); + const [, setDashboardsStore] = useDashboardsStore(() => null); const exportPng = useCallback(() => { handleCapture({ className: makeExportClassName(tile_id), fileName: name }); diff --git a/src/pages/Dashboards/Toolbar.tsx b/src/pages/Dashboards/Toolbar.tsx index f8bffb00..22b9c644 100644 --- a/src/pages/Dashboards/Toolbar.tsx +++ b/src/pages/Dashboards/Toolbar.tsx @@ -77,7 +77,7 @@ const EditLayoutButton = (props: { layoutRef: React.MutableRefObject { - const [, setDashbaordsStore] = useDashboardsStore((_store) => null); + const [, setDashbaordsStore] = useDashboardsStore(() => null); const onClick = useCallback(() => { setDashbaordsStore((store) => toggleCreateTileModal(store, true)); @@ -97,7 +97,7 @@ const AddTileButton = () => { }; const ImportTileButton = () => { - const [, setDashbaordsStore] = useDashboardsStore((_store) => null); + const [, setDashbaordsStore] = useDashboardsStore(() => null); const onClick = useCallback(() => { setDashbaordsStore((store) => toggleImportTileModal(store, true)); @@ -157,7 +157,7 @@ const renderDeleteIcon = () => ; const renderShareIcon = () => ; const DeleteDashboardButton = () => { - const [_store, setDashbaordsStore] = useDashboardsStore((_store) => null); + const [, setDashbaordsStore] = useDashboardsStore(() => null); const onClick = useCallback(() => setDashbaordsStore((store) => toggleDeleteDashboardModal(store, true)), []); return ; }; diff --git a/src/pages/Dashboards/VizEditorModal.tsx b/src/pages/Dashboards/VizEditorModal.tsx index ce9dd94b..c7918242 100644 --- a/src/pages/Dashboards/VizEditorModal.tsx +++ b/src/pages/Dashboards/VizEditorModal.tsx @@ -604,7 +604,7 @@ const Config = (props: { form: TileFormType }) => { const VizEditorModal = (props: { form: TileFormType }) => { const { form } = props; const [vizEditorModalOpen] = useDashboardsStore((store) => store.vizEditorModalOpen); - const [, setDashboardStore] = useDashboardsStore((_store) => null); + const [, setDashboardStore] = useDashboardsStore(() => null); const closeVizModal = useCallback(() => { setDashboardStore((store) => toggleVizEditorModal(store, false)); }, []); diff --git a/src/pages/Dashboards/hooks.ts b/src/pages/Dashboards/hooks.ts index a3848d13..0b986d13 100644 --- a/src/pages/Dashboards/hooks.ts +++ b/src/pages/Dashboards/hooks.ts @@ -11,8 +11,8 @@ const { getCleanStoreForRefetch } = logsStoreReducers; export const useSyncTimeRange = () => { const [dashboards] = useDashboardsStore((store) => store.dashboards); - const [, setLogStore] = useLogsStore((_store) => null); - const [, setAppStore] = useAppStore((_store) => null); + const [, setLogStore] = useLogsStore(() => null); + const [, setAppStore] = useAppStore(() => null); const updateTimeRange = useCallback( (dashboard: Dashboard) => { diff --git a/src/pages/Dashboards/hooks/useParamsController.ts b/src/pages/Dashboards/hooks/useParamsController.ts index 0b68a25c..6a6a2d4b 100644 --- a/src/pages/Dashboards/hooks/useParamsController.ts +++ b/src/pages/Dashboards/hooks/useParamsController.ts @@ -74,7 +74,7 @@ const useParamsController = () => { const [isStoreSynced, setStoreSynced] = useState(false); const [activeDashboard, setDashboardsStore] = useDashboardsStore((store) => store.activeDashboard); const [timeRange, setAppStore] = useAppStore((store) => store.timeRange); - const [, setLogStore] = useLogsStore((_store) => null); + const [, setLogStore] = useLogsStore(() => null); const [searchParams, setSearchParams] = useSearchParams(); const dashboardId = activeDashboard?.dashboard_id || ''; diff --git a/src/pages/Dashboards/index.tsx b/src/pages/Dashboards/index.tsx index 07c497d6..af5f457a 100644 --- a/src/pages/Dashboards/index.tsx +++ b/src/pages/Dashboards/index.tsx @@ -9,7 +9,6 @@ import { useEffect } from 'react'; import { useDashboardsQuery } from '@/hooks/useDashboards'; import CreateTileForm from './CreateTileForm'; import { useSyncTimeRange } from './hooks'; -import _ from 'lodash'; import useParamsController from './hooks/useParamsController'; import { useDocumentTitle } from '@mantine/hooks'; import SavedFiltersModal from '../Stream/components/Querier/SavedFiltersModal'; diff --git a/src/pages/Dashboards/providers/DashboardsProvider.ts b/src/pages/Dashboards/providers/DashboardsProvider.ts index f3a9ea18..072082a3 100644 --- a/src/pages/Dashboards/providers/DashboardsProvider.ts +++ b/src/pages/Dashboards/providers/DashboardsProvider.ts @@ -194,8 +194,7 @@ const setDashboards = (store: DashboardsStore, dashboards: Dashboard[], dashboar const activeDashboard = (() => { if (_.isString(dashboardId) && !_.isEmpty(dashboardId)) { return _.find(dashboards, (dashboard) => dashboard.dashboard_id === dashboardId); - } - else if (activeDashboardFromStore) { + } else if (activeDashboardFromStore) { const id = activeDashboardFromStore.dashboard_id; const dashboard = _.find(dashboards, (dashboard) => dashboard.dashboard_id === id); return dashboard || defaultActiveDashboard; @@ -288,7 +287,7 @@ const dashboardsStoreReducers: DashboardsStoreReducers = { toggleImportTileModal, toggleImportDashboardModal, handlePaging, - toggleDuplicateTileModal + toggleDuplicateTileModal, }; export { DashbaordsProvider, useDashboardsStore, dashboardsStoreReducers }; diff --git a/src/pages/Home/CreateStreamModal.tsx b/src/pages/Home/CreateStreamModal.tsx index f95060ba..fa93e039 100644 --- a/src/pages/Home/CreateStreamModal.tsx +++ b/src/pages/Home/CreateStreamModal.tsx @@ -344,7 +344,7 @@ const useCreateStreamForm = () => { if (allValues.schemaType === dynamicType) return null; const { fields } = allValues; - const existingNames = _.map(fields, (v, _k) => v.name); + const existingNames = _.map(fields, (v) => v.name); return isValidFieldName(val, existingNames); }, data_type: (val, allValues) => { diff --git a/src/pages/Stream/Views/Explore/LoadingViews.tsx b/src/pages/Stream/Views/Explore/LoadingViews.tsx index 4505af4c..26c2961e 100644 --- a/src/pages/Stream/Views/Explore/LoadingViews.tsx +++ b/src/pages/Stream/Views/Explore/LoadingViews.tsx @@ -9,8 +9,8 @@ const { getCleanStoreForRefetch } = logsStoreReducers; const { syncTimeRange } = appStoreReducers; export const ErrorView = (props: { message: string }) => { - const [, setLogsStore] = useLogsStore((_store) => null); - const [, setAppStore] = useAppStore((_store) => null); + const [, setLogsStore] = useLogsStore(() => null); + const [, setAppStore] = useAppStore(() => null); const { message } = props; const onRetry = useCallback(() => { diff --git a/src/pages/Stream/Views/Explore/LogsView.tsx b/src/pages/Stream/Views/Explore/LogsView.tsx index dd765123..4dbf0d11 100644 --- a/src/pages/Stream/Views/Explore/LogsView.tsx +++ b/src/pages/Stream/Views/Explore/LogsView.tsx @@ -4,7 +4,6 @@ import JsonView from './JSONView'; import LogTable from './StaticLogTable'; import useLogsFetcher from './useLogsFetcher'; import LogsViewConfig from './LogsViewConfig'; -import _ from 'lodash'; const LogsView = (props: { schemaLoading: boolean; infoLoading: boolean }) => { const { schemaLoading, infoLoading } = props; diff --git a/src/pages/Stream/Views/LiveTail/LiveLogTable.tsx b/src/pages/Stream/Views/LiveTail/LiveLogTable.tsx index e251243e..6d8e4c5d 100644 --- a/src/pages/Stream/Views/LiveTail/LiveLogTable.tsx +++ b/src/pages/Stream/Views/LiveTail/LiveLogTable.tsx @@ -1,8 +1,6 @@ import { FC, useEffect, useState } from 'react'; import { ScrollArea, Table, Box } from '@mantine/core'; -import { Tbody, - Thead - } from '@/components/Table'; +import { Tbody, Thead } from '@/components/Table'; import LogRow from './LiveLogRow'; import { useDoGetLiveTail } from '@/hooks/useDoGetLiveTail'; import EmptyBox from '@/components/Empty'; @@ -57,6 +55,7 @@ const LiveLogTable: FC = () => { const headerRows = schema?.map((element) => ( { const classes = styles; - const { container, tableStyle, - liveTheadStyle, - tableContainer, innerContainer } = classes; + const { container, tableStyle, liveTheadStyle, tableContainer, innerContainer } = classes; return ( diff --git a/src/pages/Stream/Views/Manage/Alerts.tsx b/src/pages/Stream/Views/Manage/Alerts.tsx index 503ea51d..2bd7ccbb 100644 --- a/src/pages/Stream/Views/Manage/Alerts.tsx +++ b/src/pages/Stream/Views/Manage/Alerts.tsx @@ -556,7 +556,6 @@ const AlertsModal = (props: { classNames={{ title: classes.modalTitle }}> - {/* @ts-ignore */} diff --git a/src/pages/Stream/components/ErrorMarker.tsx b/src/pages/Stream/components/ErrorMarker.tsx index fa204774..474a90a5 100644 --- a/src/pages/Stream/components/ErrorMarker.tsx +++ b/src/pages/Stream/components/ErrorMarker.tsx @@ -1,4 +1,4 @@ -export var ErrorMarker: any[] = []; +export let ErrorMarker: any[] = []; // example format to generate error // let err = { @@ -20,10 +20,10 @@ export var ErrorMarker: any[] = []; // }); // } export function errChecker(code: string, streamName: string) { - let arr = code.split('\r\n'); + const arr = code.split('\r\n'); ErrorMarker = []; arr.map((wordsString: string, j: any) => { - let wordsArray = wordsString.split(' '); + const wordsArray = wordsString.split(' '); wordsArray.map((word: string, i: any) => { if (word.toLowerCase() === 'from' && wordsArray[i + 1]) { if (wordsArray[i + 1] !== streamName && wordsArray[i + 1] !== `${streamName};`) { diff --git a/src/pages/Stream/components/EventTimeLineGraph.tsx b/src/pages/Stream/components/EventTimeLineGraph.tsx index 030c6837..34ef0d3f 100644 --- a/src/pages/Stream/components/EventTimeLineGraph.tsx +++ b/src/pages/Stream/components/EventTimeLineGraph.tsx @@ -92,7 +92,7 @@ const getEndOfTs = (time: Date, compactType: CompactInterval): Date => { }; const incrementDateByCompactType = (date: Date, type: CompactInterval): Date => { - let tempDate = new Date(date); + const tempDate = new Date(date); if (type === 'minute') { tempDate.setMinutes(tempDate.getMinutes() + 1); } else if (type === 'hour') { diff --git a/src/pages/Stream/components/PrimaryToolbar.tsx b/src/pages/Stream/components/PrimaryToolbar.tsx index 16e41568..23a51364 100644 --- a/src/pages/Stream/components/PrimaryToolbar.tsx +++ b/src/pages/Stream/components/PrimaryToolbar.tsx @@ -24,13 +24,13 @@ const renderMaximizeIcon = () => const renderDeleteIcon = () => ; const MaximizeButton = () => { - const [_appStore, setAppStore] = useAppStore((_store) => null); + const [, setAppStore] = useAppStore(() => null); const onClick = useCallback(() => setAppStore(appStoreReducers.toggleMaximize), []); return ; }; const SavedFiltersButton = () => { - const [_store, setLogsStore] = useFilterStore((_store) => null); + const [, setLogsStore] = useFilterStore(() => null); const onClick = useCallback(() => setLogsStore((store) => toggleSavedFiltersModal(store, true)), []); return (