Skip to content

Commit

Permalink
frontend: fix unused imports/vars/params
Browse files Browse the repository at this point in the history
  • Loading branch information
malinskibeniamin committed Nov 29, 2024
1 parent 9876542 commit d5a9ee6
Show file tree
Hide file tree
Showing 39 changed files with 31 additions and 41 deletions.
1 change: 0 additions & 1 deletion frontend/src/components/debugBundle/DebugBundleLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Flex, IconButton, Link, Text, Tooltip } from '@redpanda-data/ui';
import React from 'react';
import { MdDeleteOutline } from 'react-icons/md';
import { config } from '../../config';
import type {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/ErrorDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { WarningIcon } from '@chakra-ui/icons';
import { Button, List, ListIcon, ListItem, Result, Section } from '@redpanda-data/ui';
import { observer } from 'mobx-react';
import React, { type FC, type ReactElement } from 'react';
import type { FC, ReactElement } from 'react';
import { api } from '../../state/backendApi';

export const ErrorDisplay: FC<{ children: ReactElement }> = observer(({ children }) => {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/misc/HiddenRadioList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* by the Apache License, Version 2.0
*/

import React from 'react';
import styles from './HiddenRadioList.module.scss';

export interface HiddenRadioOption<ValueType> {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/misc/KowlEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import Editor, { type EditorProps, type Monaco, DiffEditor, type DiffEditorProps } from '@monaco-editor/react';
import type { editor } from 'monaco-editor';
import React from 'react';

type IStandaloneCodeEditor = editor.IStandaloneCodeEditor;
type IStandaloneDiffEditor = editor.IStandaloneDiffEditor;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/misc/KowlTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Box, DateTimeInput } from '@redpanda-data/ui';
import { makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import { Component } from 'react';
import React from 'react';

@observer
export class KowlTimePicker extends Component<{
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/NoClipboardPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { Popover } from '@redpanda-data/ui';
import React, { type FunctionComponent, type ReactElement } from 'react';
import type { FunctionComponent, ReactElement } from 'react';
import { isClipboardAvailable } from '../../utils/featureDetection';

const popoverContent = (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/RemovableFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flex, IconButton } from '@redpanda-data/ui';
import React, { type FC, type ReactElement } from 'react';
import type { FC, ReactElement } from 'react';
import { MdClose } from 'react-icons/md';

const RemovableFilter: FC<{ children: ReactElement; onRemove: () => void }> = ({ children, onRemove }) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { type ChakraProps, Section as ChakraSection } from '@redpanda-data/ui';
import React, { type ReactNode } from 'react';
import type { ReactNode } from 'react';

// Note: this component is intended to be temporary until all components are migrated @redpanda-data/ui
function Section(props: { children: ReactNode; id?: string } & ChakraProps) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/ShortNum.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* by the Apache License, Version 2.0
*/

import React, { type CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { numberToThousandsString } from '../../utils/tsxUtils';

export function ShortNum(p: { value: number; tooltip?: boolean; className?: string; style?: CSSProperties }) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/misc/UserPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '@redpanda-data/ui';
import { transaction } from 'mobx';
import { observer, useLocalObservable } from 'mobx-react';
import React, { Component, type FC, useState } from 'react';
import { Component, type FC, useState } from 'react';
import { clearSettings, uiSettings } from '../../state/ui';
import { Label, navigatorClipboardErrorHandler } from '../../utils/tsxUtils';

Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/UrlTestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* by the Apache License, Version 2.0
*/

import React from 'react';
import { PageComponent, type PageInitHelper } from './Page';

import { Checkbox } from '@redpanda-data/ui';
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/pages/acls/Acl.List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ const RolesTab = observer(() => {
return false;
}
});
// @ts-ignore perhaps required for MobX?
const _isLoading = rolesApi.roles == null;

const rolesWithMembers = roles.map((r) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/admin/Admin.Licenses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { observer } from 'mobx-react';
import React, { Component } from 'react';
import { Component } from 'react';
import { Link as ReactRouterLink } from 'react-router-dom';
import { api } from '../../../state/backendApi';
import '../../../utils/arrayExtensions';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/admin/Admin.RoleBindings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* by the Apache License, Version 2.0
*/

import React, { Component } from 'react';
import { Component } from 'react';
import type { RoleBinding, Subject } from '../../../state/restInterfaces';
import '../../../utils/arrayExtensions';
import { Accordion } from '@redpanda-data/ui';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/admin/Admin.Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { observer } from 'mobx-react';
import React, { Component, type ReactNode } from 'react';
import { Component, type ReactNode } from 'react';
import { api } from '../../../state/backendApi';
import type { Permission, Role, RoleBinding } from '../../../state/restInterfaces';
import '../../../utils/arrayExtensions';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/admin/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { Alert, AlertIcon, Tabs } from '@redpanda-data/ui';
import { makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import React, { type ReactElement } from 'react';
import type { ReactElement } from 'react';
import { appGlobal } from '../../../state/appGlobal';
import { api } from '../../../state/backendApi';
import { Features } from '../../../state/supportedFeatures';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/connect/CreateConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from '@redpanda-data/ui';
import { comparer } from 'mobx';
import { observer, useLocalObservable } from 'mobx-react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { appGlobal } from '../../../state/appGlobal';
import { api } from '../../../state/backendApi';
import { ConnectClusterStore, ConnectorValidationError } from '../../../state/connect/state';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/connect/dynamic-ui/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Button, Input, Tooltip } from '@redpanda-data/ui';
import { arrayMoveMutable } from 'array-move';
import { type IReactionDisposer, autorun, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import React, { Component, useState } from 'react';
import { Component, useState } from 'react';
import { DragDropContext, Draggable, type DropResult, Droppable, type ResponderProvided } from 'react-beautiful-dnd';

@observer
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/connect/helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
} from '@redpanda-data/ui';
import { action, runInAction } from 'mobx';
import { observer, useLocalObservable } from 'mobx-react';
import React, { type CSSProperties, useRef, useState } from 'react';
import { type CSSProperties, useRef, useState } from 'react';
import {
MdCheckCircleOutline,
MdErrorOutline,
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/pages/consumers/Group.List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
* by the Apache License, Version 2.0
*/

import { observer } from 'mobx-react';
import React from 'react';

import { DataTable, Flex, Grid, SearchField, Tag, Text } from '@redpanda-data/ui';
import { type IReactionDisposer, autorun } from 'mobx';
import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';
import { appGlobal } from '../../../state/appGlobal';
import { api } from '../../../state/backendApi';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Button, Flex, Grid, Link, List, ListItem, Text } from '@redpanda-data/ui';
import React from 'react';
import { MdError, MdOutlineWarning } from 'react-icons/md';
import { Link as ReactRouterLink } from 'react-router-dom';
import colors from '../../../colors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
import { motion } from 'framer-motion';
import { type IReactionDisposer, autorun, computed, makeObservable, observable, transaction } from 'mobx';
import { observer } from 'mobx-react';
import React from 'react';
import { MdOutlineErrorOutline } from 'react-icons/md';
import { appGlobal } from '../../../state/appGlobal';
import { api, partialTopicConfigs } from '../../../state/backendApi';
Expand Down Expand Up @@ -744,6 +743,7 @@ class ReassignPartitions extends PageComponent {
newThrottledTopics.removeAll((t) => inProgress.includes(t));

// Update observable
// @ts-ignore perhaps this is needed later on?
const _changes = this.topicsWithThrottle.updateWith(newThrottledTopics);
// if (changes.added || changes.removed)
// if (IsDev) console.log('refreshTopicConfigs updated', changes);
Expand Down Expand Up @@ -843,6 +843,7 @@ const steps: WizardStep[] = [
if (selectedRacks.length === 1 && allRacks.length >= 2) {
let selectedRack = selectedRacks[0];
if (!selectedRack || selectedRack.length === 0) selectedRack = '(empty)';
// @ts-ignore perhaps this is needed later on?
const _msgStart =
selectedBrokers.length === 1
? `Your selected Brokers, Your cluster contains ${allBrokers.length} brokers across `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Box, Checkbox, DataTable, Flex, Popover, Text } from '@redpanda-data/ui
import type { Row } from '@tanstack/react-table';
import { type IReactionDisposer, computed, makeObservable, observable, transaction } from 'mobx';
import { observer } from 'mobx-react';
import React, { Component } from 'react';
import { Component } from 'react';
import Highlighter from 'react-highlight-words';
import { MdOutlineWarningAmber } from 'react-icons/md';
import { api } from '../../../state/backendApi';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Checkbox, DataTable } from '@redpanda-data/ui';
import type { Row } from '@tanstack/react-table';
import { transaction } from 'mobx';
import { observer } from 'mobx-react';
import React, { Component } from 'react';
import { Component } from 'react';
import { api } from '../../../state/backendApi';
import type { Broker } from '../../../state/restInterfaces';
import { eqSet, prettyBytesOrNA } from '../../../utils/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* by the Apache License, Version 2.0
*/

import React, { Component } from 'react';
import { Component } from 'react';
import type { uiSettings } from '../../../../state/ui';
import { prettyNumber } from '../../../../utils/utils';
import '../../../../utils/numberExtensions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ function calcRange<T>(
* if not useful simply delete them
* */

// @ts-ignore perhaps this is needed later on?
function _dumpBrokerInfo(title: string, brokers: ExBroker[]) {
console.log(title);
console.table(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
createStandaloneToast,
} from '@redpanda-data/ui';
import { observer } from 'mobx-react';
import React from 'react';
import { Link as ReactRouterLink } from 'react-router-dom';
import EmptyConnectors from '../../../../assets/redpanda/EmptyConnectors.svg';
import { DeleteSecretRequest, type Secret } from '../../../../protogen/redpanda/api/dataplane/v1alpha2/secret_pb';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { observer } from 'mobx-react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { api } from '../../../../state/backendApi';
import type { DeleteRecordsResponseData, Partition, Topic } from '../../../../state/restInterfaces';
import { RadioOptionGroup } from '../../../../utils/tsxUtils';
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/topics/Tab.Acl/AclList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

import { observer } from 'mobx-react';
import React from 'react';
import { toJson } from '../../../../utils/jsonUtils';

import { Alert, AlertIcon, DataTable } from '@redpanda-data/ui';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/topics/Tab.Consumers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { observer } from 'mobx-react';
import React, { type FC } from 'react';
import type { FC } from 'react';
import type { Topic, TopicConsumer } from '../../../state/restInterfaces';

import '../../../utils/arrayExtensions';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/topics/Tab.Docu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* by the Apache License, Version 2.0
*/

import React, { Component } from 'react';
import { Component } from 'react';
import type { Topic } from '../../../state/restInterfaces';
import '../../../utils/arrayExtensions';
import { Button, Empty, VStack } from '@redpanda-data/ui';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
UnorderedList,
} from '@redpanda-data/ui';
import { observer, useLocalObservable } from 'mobx-react';
import React, { type FC } from 'react';
import type { FC } from 'react';
import type { FilterEntry } from '../../../../state/ui';
import FilterEditor from './Editor';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class PreviewSettings extends Component<{
messageSearch: MessageSearch;
}> {
@computed.struct get allCurrentKeys() {
// @ts-ignore perhaps we still need this due to MobX behavior?
const unused = this.props.messageSearch.messages.length;
return getAllMessageKeys(this.props.messageSearch.messages)
.map((p) => p.propertyName)
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/topics/Tab.Partitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import { observer } from 'mobx-react';
import type { FC } from 'react';
import React from 'react';
import { api } from '../../../state/backendApi';
import type { Partition, Topic } from '../../../state/restInterfaces';
import '../../../utils/arrayExtensions';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/state/backendApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@ const apiStore = {
async createConnector(
clusterName: string,
connectorName: string,
pluginClassName: string,
_pluginClassName: string, // needs to be kept to avoid larger refactor despite not being used.
config: object,
): Promise<void> {
// POST "/kafka-connect/clusters/{clusterName}/connectors"
Expand Down Expand Up @@ -2107,7 +2107,7 @@ export const rpcnSecretManagerApi = observable({

await client.createSecret(secret);
},
async update(id: string, updateSecretRequest: UpdateSecretRequest) {
async update(_id: string, updateSecretRequest: UpdateSecretRequest) {
const client = appConfig.rpcnSecretsClient;
if (!client) throw new Error('redpanda connect secret client is not initialized');

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/utils/jsonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function toJson(obj: any, space?: string | number | undefined): string {
try {
return JSON.stringify(
obj,
(key: string, value: any) => {
(_key: string, value: any) => {
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return;
Expand Down Expand Up @@ -45,7 +45,7 @@ export function clone<T>(obj: T): T {
// Accesses all members of an object by serializing it

export function touch(obj: any): void {
JSON.stringify(obj, (k, v) => {
JSON.stringify(obj, (_k, v) => {
if (typeof v === 'object') return v;
return '';
});
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/utils/svg/AzureADLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* by the Apache License, Version 2.0
*/

import React from 'react';

export default (
<svg viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg">
<title>Azure AD</title>
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/utils/svg/OktaLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* by the Apache License, Version 2.0
*/

import React from 'react';

export default (
<svg viewBox="0 0 260 260" focusable={false}>
<title>Okta</title>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ export function scrollTo(targetId: string, anchor: 'start' | 'end' | 'center' =
if (!target) return;

const rect = target.getBoundingClientRect();
// @ts-ignore perhaps it affects the target for some reason?
let top = 0;
switch (anchor) {
case 'start':
Expand Down

0 comments on commit d5a9ee6

Please sign in to comment.