mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
FE: Lint cleanups part II (#43491)
This commit is contained in:
parent
4e1334c94c
commit
a3b7e29e26
25 changed files with 30 additions and 57 deletions
|
|
@ -47,13 +47,6 @@ describe("PaginatedList", () => {
|
|||
},
|
||||
];
|
||||
|
||||
const fetchTinyPage = (pageNumber: number) => {
|
||||
if (pageNumber <= 2) {
|
||||
return [items[pageNumber]];
|
||||
}
|
||||
throw new Error("Invalid page number");
|
||||
};
|
||||
|
||||
const fetchSmallPage = (pageNumber: number) => {
|
||||
if (pageNumber === 0) {
|
||||
return [items[0], items[1]];
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Select, {
|
|||
OptionProps,
|
||||
StylesConfig,
|
||||
} from "react-select-5";
|
||||
import { upperFirst } from "lodash";
|
||||
|
||||
import { COLORS } from "styles/var/colors";
|
||||
import { PADDING } from "styles/var/padding";
|
||||
|
|
@ -110,7 +109,11 @@ const TeamsDropdown = ({
|
|||
});
|
||||
|
||||
const CustomDropdownIndicator = (
|
||||
props: DropdownIndicatorProps<any, false, any>
|
||||
props: DropdownIndicatorProps<
|
||||
INumberDropdownOption,
|
||||
false,
|
||||
GroupBase<INumberDropdownOption>
|
||||
>
|
||||
) => {
|
||||
const { isFocused, selectProps } = props;
|
||||
const color =
|
||||
|
|
|
|||
|
|
@ -152,7 +152,6 @@ const SelectTargetsMenuWrapper = (
|
|||
valueArray: PropTypes.arrayOf(targetInterface),
|
||||
valueKey: PropTypes.string,
|
||||
onOptionRef: PropTypes.func,
|
||||
isPremiumTier: PropTypes.bool,
|
||||
};
|
||||
|
||||
return SelectTargetsMenu;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ const OSRequirementImage = ({
|
|||
case "ipados":
|
||||
return IPadOSUpdateScreenshot;
|
||||
default:
|
||||
MacOSUpdateScreenshot;
|
||||
return MacOSUpdateScreenshot;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,9 @@ const generateColumnConfigs = (
|
|||
Header: "Script output",
|
||||
disableSortBy: true,
|
||||
accessor: "script_output_preview",
|
||||
Cell: (cellProps: any) => <ScriptOutputCell {...cellProps} />,
|
||||
Cell: (cellProps: CellProps<IScriptBatchHostResult>) => (
|
||||
<ScriptOutputCell {...cellProps} />
|
||||
),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from "react";
|
||||
import { getByText, screen, waitFor } from "@testing-library/react";
|
||||
import { screen, waitFor } from "@testing-library/react";
|
||||
|
||||
import { ISecret } from "interfaces/secrets";
|
||||
import { UserEvent } from "@testing-library/user-event";
|
||||
|
|
@ -147,7 +147,7 @@ describe("Custom variables", () => {
|
|||
|
||||
describe("gitops mode", () => {
|
||||
it("renders the add button disabled in GitOps mode", async () => {
|
||||
const { user } = renderInGOM(<Secrets />);
|
||||
renderInGOM(<Secrets />);
|
||||
|
||||
let addSecretButton;
|
||||
await waitFor(() => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { IApiError } from "interfaces/errors";
|
|||
import { NotificationContext } from "context/notification";
|
||||
import mdmAPI from "services/entities/mdm";
|
||||
|
||||
import CustomLink from "components/CustomLink";
|
||||
import FileUploader from "components/FileUploader";
|
||||
|
||||
import { UPLOAD_ERROR_MESSAGES, getErrorMessage } from "./helpers";
|
||||
|
|
|
|||
|
|
@ -175,10 +175,6 @@ const SoftwarePage = ({ children, router, location }: ISoftwarePageProps) => {
|
|||
const [showSoftwareFiltersModal, setShowSoftwareFiltersModal] = useState(
|
||||
false
|
||||
);
|
||||
const [addedSoftwareToken, setAddedSoftwareToken] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
|
||||
const {
|
||||
currentTeamId,
|
||||
isAllTeamsSelected,
|
||||
|
|
@ -427,7 +423,6 @@ const SoftwarePage = ({ children, router, location }: ISoftwarePageProps) => {
|
|||
showExploitedVulnerabilitiesOnly,
|
||||
softwareFilter,
|
||||
vulnFilters: softwareVulnFilters,
|
||||
addedSoftwareToken,
|
||||
onAddFiltersClick: toggleSoftwareFiltersModal,
|
||||
})}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useContext, useEffect, useState, useCallback } from "react";
|
||||
import { useQuery, useQueryClient } from "react-query";
|
||||
import { Tab, Tabs, TabList, TabPanel } from "react-tabs";
|
||||
import { noop } from "lodash";
|
||||
|
||||
import {
|
||||
IAppStoreApp,
|
||||
|
|
@ -227,7 +226,7 @@ const EditIconModal = ({
|
|||
});
|
||||
|
||||
// Reset state to fallback/default icon when a current or new custom icon is removed
|
||||
const resetIconState = () => {
|
||||
const resetIconState = useCallback(() => {
|
||||
// Default to VPP icon if available, otherwise fall back to default icon
|
||||
const defaultPreviewUrl =
|
||||
previewInfo.currentIconUrl &&
|
||||
|
|
@ -242,7 +241,7 @@ const EditIconModal = ({
|
|||
fileDetails: null,
|
||||
status: "fallback",
|
||||
});
|
||||
};
|
||||
}, [previewInfo.currentIconUrl]);
|
||||
|
||||
const { data: customIconData, isError: isCustomIconError } = useQuery(
|
||||
["softwareIcon", softwareId, teamIdForApi, iconUploadedAt],
|
||||
|
|
@ -389,6 +388,7 @@ const EditIconModal = ({
|
|||
previewInfo.currentIconUrl,
|
||||
originalIsVpp,
|
||||
setCurrentApiCustomIcon,
|
||||
resetIconState,
|
||||
]);
|
||||
|
||||
const fileDetails =
|
||||
|
|
@ -403,7 +403,6 @@ const EditIconModal = ({
|
|||
|
||||
const renderPreviewFleetCard = () => {
|
||||
const {
|
||||
name,
|
||||
type,
|
||||
versions,
|
||||
source,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import React, { useContext, useState, useEffect } from "react";
|
||||
import { InjectedRouter } from "react-router";
|
||||
import { useQuery } from "react-query";
|
||||
import classnames from "classnames";
|
||||
|
||||
|
|
@ -49,11 +48,9 @@ interface IEditSoftwareModalProps {
|
|||
refetchSoftwareTitle: () => void;
|
||||
onExit: () => void;
|
||||
installerType: InstallerType;
|
||||
router: InjectedRouter;
|
||||
openViewYamlModal: () => void;
|
||||
isFleetMaintainedApp?: boolean;
|
||||
isIosOrIpadosApp?: boolean;
|
||||
gitOpsModeEnabled?: boolean;
|
||||
name: string;
|
||||
displayName: string;
|
||||
source?: string;
|
||||
|
|
@ -67,7 +64,6 @@ const EditSoftwareModal = ({
|
|||
onExit,
|
||||
refetchSoftwareTitle,
|
||||
installerType,
|
||||
router,
|
||||
openViewYamlModal,
|
||||
isFleetMaintainedApp = false,
|
||||
isIosOrIpadosApp = false,
|
||||
|
|
|
|||
|
|
@ -209,7 +209,6 @@ const SoftwareSummaryCard = ({
|
|||
)}
|
||||
{showEditSoftwareModal && softwareInstallerOnTeam && (
|
||||
<EditSoftwareModal
|
||||
router={router}
|
||||
softwareId={softwareId}
|
||||
teamId={teamId}
|
||||
softwareInstaller={softwareInstaller}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ interface ISoftwareTitlesProps {
|
|||
vulnFilters: ISoftwareVulnFilters;
|
||||
currentPage: number;
|
||||
teamId?: number;
|
||||
addedSoftwareToken: string | null;
|
||||
onAddFiltersClick: () => void;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +58,6 @@ const SoftwareTitles = ({
|
|||
vulnFilters,
|
||||
currentPage,
|
||||
teamId,
|
||||
addedSoftwareToken,
|
||||
onAddFiltersClick,
|
||||
}: ISoftwareTitlesProps) => {
|
||||
const showVersions = location.pathname === PATHS.SOFTWARE_VERSIONS;
|
||||
|
|
@ -85,7 +83,6 @@ const SoftwareTitles = ({
|
|||
orderDirection,
|
||||
orderKey,
|
||||
teamId,
|
||||
addedSoftwareToken,
|
||||
...vulnFilters,
|
||||
...buildSoftwareFilterQueryParams(softwareFilter),
|
||||
},
|
||||
|
|
@ -121,7 +118,6 @@ const SoftwareTitles = ({
|
|||
orderDirection,
|
||||
orderKey,
|
||||
teamId,
|
||||
addedSoftwareToken,
|
||||
...vulnFilters,
|
||||
...(showVersions ? { without_vulnerability_details: true } : {}),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import Button from "components/buttons/Button";
|
|||
import Icon from "components/Icon";
|
||||
import { IconNames } from "components/icons";
|
||||
import TooltipWrapper from "components/TooltipWrapper";
|
||||
import { set } from "lodash";
|
||||
|
||||
interface IFilterPillProps {
|
||||
label: string;
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ interface IHostsFilterBlockProps {
|
|||
params: {
|
||||
munkiIssueDetails: IMunkiIssuesAggregate | null;
|
||||
policyResponse: PolicyResponse;
|
||||
policyId?: any;
|
||||
policyId?: string | number;
|
||||
policy?: IPolicy;
|
||||
macSettingsStatus?: any;
|
||||
macSettingsStatus?: MacSettingsStatusQueryParam;
|
||||
softwareId?: number;
|
||||
softwareTitleId?: number;
|
||||
softwareVersionId?: number;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import {
|
|||
IHostSoftware,
|
||||
IVPPHostSoftware,
|
||||
ISoftware,
|
||||
NO_VERSION_OR_HOST_DATA_SOURCES,
|
||||
} from "interfaces/software";
|
||||
import { HostPlatform, isIPadOrIPhone, isAndroid } from "interfaces/platform";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
|
||||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
import { screen, waitFor } from "@testing-library/react";
|
||||
import { renderWithSetup } from "test/test-utils";
|
||||
|
||||
import ReportUpdatedCell from "./ReportUpdatedCell";
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ interface IInstallerStatusActionProps {
|
|||
}
|
||||
|
||||
const InstallerStatusAction = ({
|
||||
software: { id, status, software_package, app_store_app, ui_status },
|
||||
software: { status, software_package, app_store_app, ui_status },
|
||||
onInstall,
|
||||
onShowInstallerDetails,
|
||||
}: IInstallerStatusActionProps) => {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { IEmptyTableProps } from "interfaces/empty_table";
|
|||
import Button from "components/buttons/Button";
|
||||
|
||||
import TableContainer from "components/TableContainer";
|
||||
import { ITableQueryData } from "components/TableContainer/TableContainer";
|
||||
import TableCount from "components/TableContainer/TableCount";
|
||||
import EmptyTable from "components/EmptyTable";
|
||||
import { IActionButtonProps } from "components/TableContainer/DataTable/ActionButton/ActionButton";
|
||||
|
|
@ -49,7 +50,7 @@ const PacksTable = ({
|
|||
}, [packs, searchString, setFilteredPacks]);
|
||||
|
||||
const onQueryChange = useCallback(
|
||||
(queryData: any) => {
|
||||
(queryData: ITableQueryData) => {
|
||||
const { searchQuery } = queryData;
|
||||
setSearchString(searchQuery);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ describe("Policies table", () => {
|
|||
|
||||
const policiesList = [...testInheritedPolicies, ...testTeamPolicies];
|
||||
|
||||
const { container, user } = render(
|
||||
const { user } = render(
|
||||
<PoliciesTable
|
||||
policiesList={policiesList}
|
||||
isLoading={false}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ const PolicyResults = ({
|
|||
const { hosts: hostResponses, uiHostCounts, serverHostCounts, errors } =
|
||||
campaign || {};
|
||||
|
||||
const totalRowsCount = get(campaign, ["hosts_count", "successful"], 0);
|
||||
|
||||
const [navTabIndex, setNavTabIndex] = useState(0);
|
||||
const [showQueryModal, setShowQueryModal] = useState(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ const QueriesTable = ({
|
|||
variant="table-filter"
|
||||
/>
|
||||
);
|
||||
}, [curTargetedPlatformFilter, queryParams, router]);
|
||||
}, [curTargetedPlatformFilter, handlePlatformFilterDropdownChange]);
|
||||
|
||||
const columnConfigs = useMemo(
|
||||
() =>
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ const QueryDetailsPage = ({
|
|||
);
|
||||
setCurrentTeam(querysTeam);
|
||||
}
|
||||
}, [storedQuery]);
|
||||
}, [storedQuery, availableTeams, setCurrentTeam]);
|
||||
|
||||
// Updates title that shows up on browser tabs
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,6 @@ import {
|
|||
} from "interfaces/script";
|
||||
import sendRequest from "services";
|
||||
|
||||
import {
|
||||
createMockBatchScriptSummary,
|
||||
createMockScriptBatchHostResults,
|
||||
} from "__mocks__/scriptMock";
|
||||
|
||||
import endpoints from "utilities/endpoints";
|
||||
import { buildQueryStringFromParams } from "utilities/url";
|
||||
import {
|
||||
|
|
@ -107,7 +102,7 @@ export interface IScriptBatchSupportedFilters {
|
|||
query?: string;
|
||||
label_id?: number;
|
||||
team_id?: number;
|
||||
status: any; // TODO - improve upstream typing
|
||||
status?: string; // TODO: More defined typing
|
||||
}
|
||||
interface IRunScriptBatchRequestBase {
|
||||
script_id: number;
|
||||
|
|
|
|||
|
|
@ -84,14 +84,10 @@ export interface ISoftwareVersionResponse {
|
|||
}
|
||||
|
||||
export interface ISoftwareVersionsQueryKey extends ISoftwareApiParams {
|
||||
// used to trigger software refetches from sibling pages
|
||||
addedSoftwareToken: string | null;
|
||||
scope: "software-versions";
|
||||
}
|
||||
|
||||
export interface ISoftwareTitlesQueryKey extends ISoftwareApiParams {
|
||||
// used to trigger software refetches from sibling pages
|
||||
addedSoftwareToken?: string | null;
|
||||
platform?: CommaSeparatedPlatformString;
|
||||
scope: "software-titles";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@ import { buildQueryStringFromParams } from "utilities/url";
|
|||
|
||||
import {
|
||||
ICreateUserFormData,
|
||||
IResetPasswordForm,
|
||||
IUpdateUserFormData,
|
||||
IUser,
|
||||
ICreateUserWithInvitationFormData,
|
||||
} from "interfaces/user";
|
||||
import { ITeamSummary } from "interfaces/team";
|
||||
import type { IRegistrationFormData } from "interfaces/registration_form_data";
|
||||
import { IUserSettings } from "interfaces/config";
|
||||
|
||||
export interface ISortOption {
|
||||
|
|
@ -143,12 +145,14 @@ export default {
|
|||
helpers.addGravatarUrlToResource(response.user)
|
||||
);
|
||||
},
|
||||
resetPassword: (formData: any) => {
|
||||
resetPassword: (
|
||||
formData: IResetPasswordForm & { password_reset_token: string }
|
||||
) => {
|
||||
const { RESET_PASSWORD } = endpoints;
|
||||
|
||||
return sendRequest("POST", RESET_PASSWORD, formData);
|
||||
},
|
||||
setup: (formData: any) => {
|
||||
setup: (formData: IRegistrationFormData) => {
|
||||
const { SETUP } = endpoints;
|
||||
const setupData = helpers.setupData(formData);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue