mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
## Issue - First batch of @iansltx 's work of cleaning up lint warnings #43387 ## Description - Quick PR review and grabbed as many confirmed low-risk quick wins as I could `git checkout lint-cleanup <file/path/1> <file/path/2>` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes This release contains internal code improvements with one minor UI tweak: * **Style** * Dropdown menu background color adjusted for clearer contrast in action lists * **Refactor** * Improved type safety across the codebase with stricter TypeScript annotations * Removed unused imports and constants to reduce code clutter * Enhanced React hook dependency arrays for more consistent component behavior <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Rachel Perkins <rachel@Rachels-MacBook-Pro.local> Co-authored-by: Ian Littman <iansltx@gmail.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import React from "react";
|
|
import { CellProps, Column } from "react-table";
|
|
import { InjectedRouter } from "react-router";
|
|
|
|
import { IHeaderProps, IStringCellProps } from "interfaces/datatable_config";
|
|
import { ICombinedFMA } from "interfaces/software";
|
|
|
|
import HeaderCell from "components/TableContainer/DataTable/HeaderCell";
|
|
import SoftwareNameCell from "components/TableContainer/DataTable/SoftwareNameCell";
|
|
import InstallerActionCell from "components/TableContainer/DataTable/InstallerActionCell";
|
|
|
|
type IFleetMaintainedAppsTableConfig = Column<ICombinedFMA>;
|
|
type ITableStringCellProps = IStringCellProps<ICombinedFMA>;
|
|
type ITableHeaderProps = IHeaderProps<ICombinedFMA>;
|
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export const generateTableConfig = (
|
|
router: InjectedRouter,
|
|
teamId: number
|
|
): IFleetMaintainedAppsTableConfig[] => {
|
|
return [
|
|
{
|
|
Header: (cellProps: ITableHeaderProps) => (
|
|
<HeaderCell value="Name" isSortedDesc={cellProps.column.isSortedDesc} />
|
|
),
|
|
accessor: "name",
|
|
Cell: (cellProps: ITableStringCellProps) => {
|
|
const { name } = cellProps.row.original;
|
|
|
|
return <SoftwareNameCell name={name} />;
|
|
},
|
|
sortType: "caseInsensitive",
|
|
},
|
|
{
|
|
Header: "macOS",
|
|
accessor: "macos",
|
|
Cell: (cellProps: CellProps<ICombinedFMA>) => {
|
|
const { macos } = cellProps.row.original;
|
|
|
|
return (
|
|
<InstallerActionCell teamId={teamId} value={macos} router={router} />
|
|
);
|
|
},
|
|
disableSortBy: true,
|
|
},
|
|
{
|
|
Header: "Windows",
|
|
accessor: "windows",
|
|
Cell: (cellProps: CellProps<ICombinedFMA>) => {
|
|
const { windows } = cellProps.row.original;
|
|
|
|
return (
|
|
<InstallerActionCell
|
|
teamId={teamId}
|
|
value={windows}
|
|
router={router}
|
|
/>
|
|
);
|
|
},
|
|
disableSortBy: true,
|
|
},
|
|
];
|
|
};
|