mirror of
https://github.com/fleetdm/fleet
synced 2026-05-19 06:58:30 +00:00
## For #29721 - Build the new Labels page - Forward to the Labels page after saving a label ### [Demo video](https://drive.google.com/file/d/1iArnSiVn7CSwOpCrKEdO9HByHu9qga3L/view?usp=sharing) <img width="1798" height="1082" alt="Screenshot 2025-09-17 at 4 00 55 PM" src="https://github.com/user-attachments/assets/6a51f48c-07c3-44d9-b2bf-07025ffa61ed" /> - [x] Changes file added for user-visible changes in `changes/` - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { ILabel } from "interfaces/label";
|
|
import React from "react";
|
|
|
|
import { IUser } from "interfaces/user";
|
|
|
|
import TableContainer from "components/TableContainer";
|
|
import TableCount from "components/TableContainer/TableCount";
|
|
import EmptyTable from "components/EmptyTable";
|
|
|
|
import { generateDataSet, generateTableHeaders } from "./LabelsTableConfig";
|
|
|
|
const baseClass = "labels-table";
|
|
|
|
interface ILabelsTable {
|
|
labels: ILabel[];
|
|
onClickAction: (action: string, label: ILabel) => void;
|
|
currentUser: IUser;
|
|
}
|
|
|
|
const LabelsTable = ({ labels, onClickAction, currentUser }: ILabelsTable) => {
|
|
const tableHeaders = generateTableHeaders(currentUser, onClickAction);
|
|
|
|
const tableData = generateDataSet(labels);
|
|
|
|
return (
|
|
<TableContainer
|
|
className={baseClass}
|
|
isLoading={false}
|
|
columnConfigs={tableHeaders}
|
|
data={tableData}
|
|
defaultSortHeader="name"
|
|
defaultSortDirection="asc"
|
|
resultsTitle="labels"
|
|
showMarkAllPages={false}
|
|
isAllPagesSelected={false}
|
|
isClientSidePagination
|
|
renderCount={() =>
|
|
tableData.length ? (
|
|
<TableCount name="labels" count={tableData.length} />
|
|
) : null
|
|
}
|
|
emptyComponent={() =>
|
|
EmptyTable({
|
|
header: "No labels",
|
|
info: "Labels you create will appear here.",
|
|
})
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default LabelsTable;
|