Skip to content

Commit

Permalink
Fixed few ESLint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen5959 committed Dec 6, 2024
1 parent 59161e2 commit 2406e3f
Show file tree
Hide file tree
Showing 51 changed files with 75 additions and 86 deletions.
8 changes: 4 additions & 4 deletions src/@types/parseable/api/dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -137,7 +137,7 @@ export type LineChartProps = {
xUnit: UnitType;
yUnit: UnitType;
orientation: LineChartOrientationType;
}
};

export type AreaChartProps = {
data: TileData;
Expand Down
2 changes: 1 addition & 1 deletion src/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const loginIn = (username: string, password: string) => {

export const logOut = () => {
return Axios().get(LOGOUT_URL);
}
};
1 change: 0 additions & 1 deletion src/api/query.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 2 additions & 0 deletions src/assets/customLoader/ParseableAnimate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ const ParseableAnimated: MantineLoaderComponent = forwardRef(() => (
</svg>
));

ParseableAnimated.displayName = 'ParsableAnimated';

export default ParseableAnimated;
2 changes: 1 addition & 1 deletion src/components/Header/RefreshInterval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeJS.Timer | null>(null);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/RefreshNow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const { syncTimeRange } = appStoreReducers;
const renderRefreshIcon = () => <IconReload size={px('1rem')} stroke={1.5} />;

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));
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/TimeRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 || [];
Expand Down Expand Up @@ -204,7 +204,7 @@ function isDateInRange(startDate: Date, endDate: Date, currentDate: Date) {
}

const CustomTimeRange: FC<CustomTimeRangeProps> = ({ setOpened, resetToRelative }) => {
const [, setLogStore] = useLogsStore((_store) => null);
const [, setLogStore] = useLogsStore(() => null);
const [{ startTime: startTimeFromStore, endTime: endTimeFromStore, type }, setAppStore] = useAppStore(
(store) => store.timeRange,
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ const Navbar: FC = () => {
? toggleUserModal
: navAction.key === 'logout'
? signOutHandler
: () => {};
: () => {
return;
};
return (
<Stack
className={`${styles.navItemContainer} ${isActiveItem && styles.navItemActive}`}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navbar/rolesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const getStreamsSepcificAccess = (rolesWithRoleName: UserRoles | null, stream?:
return null;
}

let access: string[] = [];
const access: string[] = [];
let roles: any[] = [];
for (var prop in rolesWithRoleName) {
for (const prop in rolesWithRoleName) {
roles = [...roles, ...rolesWithRoleName[prop]];
}
roles.forEach((role: any) => {
Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/constants/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
export const LOGS_FOOTER_HEIGHT = 50;
2 changes: 1 addition & 1 deletion src/hooks/useAlertsEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCacheToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useClusterInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDashboards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useGetLogStreamSchema.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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';

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<string | null>(null);

const { isError, isSuccess, isLoading, refetch, isRefetching } = useQuery(
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGetStreamInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useLogStreamStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useLoginForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | null>(null);
const auth = Cookies.get('session');
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useQueryResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRetentionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useSavedFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/CreateDashboardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Dashboards/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DashboardList = (props: { updateTimeRange: (dashboard: Dashboard) => void
const renderShareIcon = () => <IconFileDownload size={px('1rem')} stroke={1.5} />;

const ImportDashboardButton = () => {
const [_store, setDashbaordsStore] = useDashboardsStore((_store) => null);
const [, setDashbaordsStore] = useDashboardsStore(() => null);
const onClick = useCallback(() => {
setDashbaordsStore((store) => toggleImportDashboardModal(store, true));
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const TableViz = (props: { data: TileQueryResponse; tick_config: TickConfig[] })

return (
<Stack ref={containerRef} style={{ flex: 1, width: '100%' }}>
<Stack style={{ height: initialHeight }} className='png-export-table-container'>
<Stack style={{ height: initialHeight }} className="png-export-table-container">
{hasNoData ? (
<NoDataView />
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Dashboards/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const EditLayoutButton = (props: { layoutRef: React.MutableRefObject<ReactGridLa
};

const AddTileButton = () => {
const [, setDashbaordsStore] = useDashboardsStore((_store) => null);
const [, setDashbaordsStore] = useDashboardsStore(() => null);

const onClick = useCallback(() => {
setDashbaordsStore((store) => toggleCreateTileModal(store, true));
Expand All @@ -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));
Expand Down Expand Up @@ -157,7 +157,7 @@ const renderDeleteIcon = () => <IconTrash size={px('1rem')} stroke={1.5} />;
const renderShareIcon = () => <IconShare size={px('1rem')} stroke={1.5} />;

const DeleteDashboardButton = () => {
const [_store, setDashbaordsStore] = useDashboardsStore((_store) => null);
const [, setDashbaordsStore] = useDashboardsStore(() => null);
const onClick = useCallback(() => setDashbaordsStore((store) => toggleDeleteDashboardModal(store, true)), []);
return <IconButton renderIcon={renderDeleteIcon} size={36} onClick={onClick} tooltipLabel="Delete Dashboard" />;
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/VizEditorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}, []);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Dashboards/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboards/hooks/useParamsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';

Expand Down
1 change: 0 additions & 1 deletion src/pages/Dashboards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Dashboards/providers/DashboardsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -288,7 +287,7 @@ const dashboardsStoreReducers: DashboardsStoreReducers = {
toggleImportTileModal,
toggleImportDashboardModal,
handlePaging,
toggleDuplicateTileModal
toggleDuplicateTileModal,
};

export { DashbaordsProvider, useDashboardsStore, dashboardsStoreReducers };
2 changes: 1 addition & 1 deletion src/pages/Home/CreateStreamModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Stream/Views/Explore/LoadingViews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
1 change: 0 additions & 1 deletion src/pages/Stream/Views/Explore/LogsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 2406e3f

Please sign in to comment.