2023-02-22 16:13:12 +00:00
|
|
|
import TextCell from "components/TableContainer/DataTable/TextCell";
|
|
|
|
|
import React from "react";
|
2023-02-23 00:35:26 +00:00
|
|
|
import { IHostMacMdmProfile } from "interfaces/mdm";
|
2023-02-22 16:13:12 +00:00
|
|
|
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants";
|
|
|
|
|
import TruncatedTextCell from "components/TableContainer/DataTable/TruncatedTextCell";
|
2023-02-23 00:35:26 +00:00
|
|
|
import MacSettingStatusCell from "./MacSettingStatusCell";
|
2023-02-22 16:13:12 +00:00
|
|
|
|
|
|
|
|
interface IHeaderProps {
|
|
|
|
|
column: {
|
|
|
|
|
title: string;
|
|
|
|
|
isSortedDesc: boolean;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface ICellProps {
|
|
|
|
|
cell: {
|
|
|
|
|
value: string;
|
|
|
|
|
};
|
|
|
|
|
row: {
|
|
|
|
|
original: IHostMacMdmProfile;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface IDataColumn {
|
|
|
|
|
Header: ((props: IHeaderProps) => JSX.Element) | string;
|
|
|
|
|
Cell: (props: ICellProps) => JSX.Element;
|
|
|
|
|
id?: string;
|
|
|
|
|
title?: string;
|
|
|
|
|
accessor?: string;
|
|
|
|
|
disableHidden?: boolean;
|
|
|
|
|
disableSortBy?: boolean;
|
|
|
|
|
sortType?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const tableHeaders: IDataColumn[] = [
|
|
|
|
|
{
|
|
|
|
|
title: "Name",
|
|
|
|
|
Header: "Name",
|
|
|
|
|
disableSortBy: true,
|
|
|
|
|
accessor: "name",
|
|
|
|
|
Cell: (cellProps: ICellProps): JSX.Element => (
|
|
|
|
|
<TextCell value={cellProps.cell.value} />
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Status",
|
|
|
|
|
Header: "Status",
|
|
|
|
|
disableSortBy: true,
|
|
|
|
|
accessor: "statusText",
|
|
|
|
|
Cell: (cellProps: ICellProps) => {
|
2023-02-23 00:35:26 +00:00
|
|
|
return (
|
|
|
|
|
<MacSettingStatusCell
|
|
|
|
|
status={cellProps.row.original.status}
|
|
|
|
|
operationType={cellProps.row.original.operation_type}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2023-02-22 16:13:12 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Error",
|
|
|
|
|
Header: "Error",
|
|
|
|
|
disableSortBy: true,
|
|
|
|
|
accessor: "detail",
|
|
|
|
|
Cell: (cellProps: ICellProps): JSX.Element => {
|
|
|
|
|
const profile = cellProps.row.original;
|
|
|
|
|
return (
|
|
|
|
|
<TruncatedTextCell
|
|
|
|
|
value={
|
|
|
|
|
(profile.status === "failed" && profile.detail) ||
|
|
|
|
|
DEFAULT_EMPTY_CELL_VALUE
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export default tableHeaders;
|