Skip to content

Commit

Permalink
cluster-ui: delete unused vars
Browse files Browse the repository at this point in the history
Delete unused vars in cluster-ui. A following commit will
turn unused vars to errors via the eslint config.

Release note: None

Epic: none
  • Loading branch information
xinhaoz committed Jul 28, 2023
1 parent 3bbf620 commit c82f5a4
Show file tree
Hide file tree
Showing 33 changed files with 42 additions and 118 deletions.
36 changes: 6 additions & 30 deletions pkg/ui/workspaces/cluster-ui/src/api/databaseDetailsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ const getDatabaseId: DatabaseDetailsQuery<DatabaseIdRow> = {
resp.idResp.error = txn_result.error;
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<DatabaseIdRow>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down Expand Up @@ -135,11 +131,7 @@ const getDatabaseGrantsQuery: DatabaseDetailsQuery<DatabaseGrantsRow> = {
}
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<DatabaseGrantsRow>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down Expand Up @@ -284,11 +276,7 @@ const getDatabaseZoneConfig: DatabaseDetailsQuery<DatabaseZoneConfigRow> = {
resp.idResp.error = txn_result.error;
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<DatabaseZoneConfigRow>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down Expand Up @@ -341,11 +329,7 @@ const getDatabaseSpanStats: DatabaseDetailsQuery<DatabaseSpanStatsRow> = {
);
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<DatabaseSpanStatsRow>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down Expand Up @@ -390,11 +374,7 @@ const getDatabaseReplicasAndRegions: DatabaseDetailsQuery<DatabaseReplicasRegion
resp.stats.replicaData.error = txn_result.error;
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<DatabaseReplicasRegionsRow>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down Expand Up @@ -444,11 +424,7 @@ const getDatabaseIndexUsageStats: DatabaseDetailsQuery<IndexUsageStatistic> = {
resp.stats.indexStats.error = txn_result.error;
}
},
handleMaxSizeError: (
dbName: string,
response: SqlTxnResult<IndexUsageStatistic>,
dbDetail: DatabaseDetailsResponse,
) => {
handleMaxSizeError: () => {
return new Promise<boolean>(() => false);
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ const customStyles = {
position: "relative",
boxShadow: "none",
}),
menuList: (provided: any) => ({
...provided,
maxHeight: "310px",
}),
option: (provided: any, state: any) => ({
option: (provided: any, _state: any) => ({
...provided,
backgroundColor: "white",
color: "#475872",
Expand Down
1 change: 0 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { DatabaseTablePageDataDetails, IndexStat } from "../databaseTablePage";
import { IndexStatsState } from "../store/indexStats";
import { cockroach } from "@cockroachlabs/crdb-protobuf-client";
import { RecommendationType as RecType } from "../indexDetailsPage";
import { TableIndexStatsResponse } from "../api/indexDetailsApi";
type IndexUsageStatistic =
cockroach.server.serverpb.TableIndexStatsResponse.IExtendedCollectedIndexUsageStatistics;
const { RecommendationType } = cockroach.sql.IndexRecommendation;
Expand Down
1 change: 0 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/databases/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

import { assert } from "chai";
import {
getNodesByRegionString,
normalizePrivileges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
TransactionDetailsLink,
} from "../workloadInsights/util";
import { TimeScale } from "../../timeScaleDropdown";
import { Timestamp, Timezone } from "../../timestamp";
import { Timestamp } from "../../timestamp";

interface InsightDetailsTableProps {
data: ContentionEvent[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const StatementInsightDetails: React.FC<
isTenant,
timeScale,
hasAdminRole,
setTimeScale,
refreshUserSQLRoles,
}) => {
const [explainPlanState, setExplainPlanState] = useState<ExplainPlanState>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
StatementDetailsLink,
TransactionDetailsLink,
} from "../workloadInsights/util";
import { TimeScale } from "../../timeScaleDropdown";
import { getStmtInsightRecommendations } from "../utils";
import { ContentionStatementDetailsTable } from "./insightDetailsTables";
import { WaitTimeInsightsLabels } from "../../detailsPanels/waitTimeInsightsPanel";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ import { Tooltip } from "@cockroachlabs/ui-components";
import { Link } from "react-router-dom";
import classNames from "classnames/bind";
import styles from "../util/workloadInsights.module.scss";
import { TimeScale } from "../../../timeScaleDropdown";
import { Badge } from "src/badge";
import { Timestamp, Timezone } from "../../../timestamp";
import { Timestamp } from "../../../timestamp";

const cx = classNames.bind(styles);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export const StatementInsightsView: React.FC<StatementInsightsViewProps> = ({
selectedColumnNames,
dropDownSelect,
maxSizeApiReached,
isTenant,
}: StatementInsightsViewProps) => {
const [pagination, setPagination] = useState<ISortedTablePagination>({
current: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,19 @@ export const insightsTableTitles: InsightsTableTitleType = {
"username",
);
},
schemaName: (execType: InsightExecEnum) => {
schemaName: (_execType: InsightExecEnum) => {
return makeToolTip(<p>The name of the contended schema.</p>, "schemaName");
},
databaseName: (execType: InsightExecEnum) => {
databaseName: (_execType: InsightExecEnum) => {
return makeToolTip(
<p>The name of the contended database.</p>,
"databaseName",
);
},
tableName: (execType: InsightExecEnum) => {
tableName: (_execType: InsightExecEnum) => {
return makeToolTip(<p>The name of the contended table.</p>, "tableName");
},
indexName: (execType: InsightExecEnum) => {
indexName: (_execType: InsightExecEnum) => {
return makeToolTip(<p>The name of the contended index.</p>, "indexName");
},
applicationName: (execType: InsightExecEnum) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ import { cockroach } from "@cockroachlabs/crdb-protobuf-client";
import { JobsPage, JobsPageProps } from "./jobsPage";
import { formatDuration } from "../util/duration";
import { allJobsFixture, earliestRetainedTime } from "./jobsPage.fixture";
import { prettyDOM, prettyFormat, render } from "@testing-library/react";
import { render } from "@testing-library/react";
import React from "react";
import { MemoryRouter } from "react-router-dom";
import * as H from "history";

import Job = cockroach.server.serverpb.IJobResponse;
import { CoordinatedUniversalTime, TimezoneContext } from "src/contexts";

const getMockJobsPageProps = (jobs: Array<Job>): JobsPageProps => {
const history = H.createHashHistory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
import * as protos from "@cockroachlabs/crdb-protobuf-client";
import { createMemoryHistory } from "history";
import Long from "long";
import moment from "moment-timezone";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Helmet } from "react-helmet";
import { RouteComponentProps } from "react-router-dom";
import { Schedules } from "src/api/schedulesApi";
import { Delayed } from "src/delayed";
import { Dropdown, DropdownOption } from "src/dropdown";
import { Dropdown } from "src/dropdown";
import { Loading } from "src/loading";
import { PageConfig, PageConfigItem } from "src/pageConfig";
import { SortSetting } from "src/sortedtable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// licenses/APL.txt.

import { createSelector } from "reselect";
import {
ActiveExecutions,
ActiveTransaction,
ExecutionStatus,
ExecutionType,
} from "src/activeExecutions/types";
import { ActiveExecutions } from "src/activeExecutions/types";
import { AppState } from "src/store";
import { selectActiveExecutionsCombiner } from "src/selectors/activeExecutionsCommon.selectors";
import { selectExecutionID } from "src/selectors/common";
Expand Down
10 changes: 0 additions & 10 deletions pkg/ui/workspaces/cluster-ui/src/selectors/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,7 @@ import {
idAttr,
statementAttr,
txnFingerprintIdAttr,
unset,
ExecutionStatistics,
queryByName,
appAttr,
flattenStatementStats,
FixFingerprintHexValue,
} from "src/util";
import { createSelector } from "@reduxjs/toolkit";
import { SqlStatsResponse } from "../api";
import { AggregateStatistics } from "src/statementsTable";
import { StatementDiagnosticsDictionary } from "src/store/statementDiagnostics";

// The functions in this file are agnostic to the different shape of each
// state in db-console and cluster-ui. This file contains selector functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const sessionDetailsPropsBase: SessionDetailsProps = {
},
setTimeScale: () => {},
refreshSessions: () => {},
cancelSession: (req: CancelSessionRequestMessage) => {},
cancelQuery: (req: CancelQueryRequestMessage) => {},
cancelSession: (_req: CancelSessionRequestMessage) => {},
cancelQuery: (_req: CancelQueryRequestMessage) => {},
refreshNodes: () => {},
refreshNodesLiveness: () => {},
uiConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ export const sessionsPagePropsFixture: SessionsPageProps = {
columns: null,
internalAppNamePrefix: "$ internal",
refreshSessions: () => {},
cancelSession: (req: CancelSessionRequestMessage) => {},
cancelQuery: (req: CancelQueryRequestMessage) => {},
cancelSession: (_req: CancelSessionRequestMessage) => {},
cancelQuery: (_req: CancelQueryRequestMessage) => {},
onSortingChange: () => {},
};

Expand Down Expand Up @@ -239,7 +239,7 @@ export const sessionsPagePropsEmptyFixture: SessionsPageProps = {
columns: null,
internalAppNamePrefix: "$ internal",
refreshSessions: () => {},
cancelSession: (req: CancelSessionRequestMessage) => {},
cancelQuery: (req: CancelQueryRequestMessage) => {},
cancelSession: (_req: CancelSessionRequestMessage) => {},
cancelQuery: (_req: CancelQueryRequestMessage) => {},
onSortingChange: () => {},
};
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const selectFilters = createSelector(

export const SessionsPageConnected = withRouter(
connect(
(state: AppState, props: RouteComponentProps) => ({
(state: AppState, _props: RouteComponentProps) => ({
sessions: selectSessions(state),
internalAppNamePrefix: selectAppName(state),
sessionsError: state.adminUI?.sessions.lastError,
Expand Down
7 changes: 1 addition & 6 deletions pkg/ui/workspaces/cluster-ui/src/sessions/sessionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ import {
DurationToNumber,
TimestampToMoment,
} from "src/util/convert";
import {
BytesWithPrecision,
Count,
DATE_FORMAT,
DATE_FORMAT_24_TZ,
} from "src/util/format";
import { BytesWithPrecision, Count, DATE_FORMAT } from "src/util/format";
import { Link } from "react-router-dom";
import React from "react";

Expand Down
3 changes: 1 addition & 2 deletions pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ export class SortedTable<T> extends React.Component<
SortedTableState
> {
static defaultProps: Partial<SortedTableProps<any>> = {
rowClass: (_obj: any) => "",
columns: [],
sortSetting: {
ascending: false,
Expand Down Expand Up @@ -221,7 +220,7 @@ export class SortedTable<T> extends React.Component<
data: T[],
sortSetting: SortSetting,
columns: ColumnDescriptor<T>[],
pagination?: ISortedTablePagination,
_pagination?: ISortedTablePagination,
): T[] => {
if (!sortSetting) {
return this.paginatedData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import React from "react";
import classNames from "classnames/bind";
import styles from "./sqlActivity.module.scss";
import moment, { Moment } from "moment-timezone";
import moment from "moment-timezone";

const cx = classNames.bind(styles);

Expand Down Expand Up @@ -50,7 +50,7 @@ export function mergeErrors(errs: Error | Error[]): Error {
};

errors.forEach(
(x, i, arr) => (
(x, i) => (
(mergedError.name += ` ${i}: ${x.name};`),
(mergedError.message += ` ${i}: ${x.message};`)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
limitText,
Count,
intersperse,
EncodeUriName,
EncodeDatabaseTableIndexUri,
EncodeDatabaseTableUri,
} from "../../util";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import React from "react";
import { Anchor } from "src/anchor";
import moment from "moment-timezone";

import { Tooltip } from "@cockroachlabs/ui-components";
import {
Expand All @@ -25,8 +24,6 @@ import {
} from "src/util";
import { Timezone } from "src/timestamp";

export type NodeNames = { [nodeId: string]: string };

// Single place for column names. Used in table columns and in columns selector.
export const statisticsColumnLabels = {
actions: "Actions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import {
} from "./databaseDetails.saga";
import {
actions,
DatabaseDetailsState,
KeyedDatabaseDetailsState,
reducer,
} from "./databaseDetails.reducer";
import { DatabasesListState, refreshDatabasesListSaga } from "../databasesList";

describe("DatabaseDetails sagas", () => {
const database = "test_db";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { DatabasesListResponse } from "src/api";
import { DOMAIN_NAME, noopReducer } from "../utils";

import { SqlExecutionRequest } from "../../api/sqlApi";

export type DatabasesListState = {
data: DatabasesListResponse;
// Captures thrown errors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import { createSelector } from "reselect";
import { localStorageSelector } from "../utils/selectors";
import { adminUISelector } from "../utils/selectors";

export const selectSortSetting = createSelector(
localStorageSelector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ const sqlStatsSlice = createSlice({
state.inFlight = false;
state.valid = false;
},
refresh: (state, action: PayloadAction<StatementsRequest>) => {
refresh: (state, _action: PayloadAction<StatementsRequest>) => {
state.inFlight = true;
},
request: (state, action: PayloadAction<StatementsRequest>) => {
request: (state, _action: PayloadAction<StatementsRequest>) => {
state.inFlight = true;
},
updateTimeScale: (_, _action: PayloadAction<UpdateTimeScalePayload>) => {},
Expand Down
Loading

0 comments on commit c82f5a4

Please sign in to comment.