generated from Luis/nextjs-python-web-template
fix linting
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import { NoDataOverlay } from "@/components/noDataOverlay";
|
import { NoDataOverlay } from "@/components/noDataOverlay";
|
||||||
import SummaryDetails from "@/components/summary_card";
|
import SummaryDetails from "@/components/summary_card";
|
||||||
import CustomTable from "@/components/table";
|
import CustomTable from "@/components/table";
|
||||||
import {HomeDummyData, HomeTableConfig} from "@/mock/home";
|
import { HomeDummyData, HomeTableConfig } from "@/mock/home";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import TableHead from "@mui/material/TableHead";
|
|||||||
import TableRow from "@mui/material/TableRow";
|
import TableRow from "@mui/material/TableRow";
|
||||||
import Paper from "@mui/material/Paper";
|
import Paper from "@mui/material/Paper";
|
||||||
|
|
||||||
import {NoDataOverlay} from "@/components/noDataOverlay";
|
import { NoDataOverlay } from "@/components/noDataOverlay";
|
||||||
import {StyledTableCell, StyledTableRow} from "./style";
|
import { StyledTableCell, StyledTableRow } from "./style";
|
||||||
import {ICustomTable, CustomTableConfiguration} from "@/types";
|
import { ICustomTable, CustomTableConfiguration } from "@/types";
|
||||||
import {Checkbox} from "@mui/material";
|
import { Checkbox } from "@mui/material";
|
||||||
|
|
||||||
const CustomTable = ({configuration, data}: ICustomTable) => {
|
const CustomTable = ({ configuration, data }: ICustomTable) => {
|
||||||
// display empty icon in case there is no data
|
// display empty icon in case there is no data
|
||||||
if (!data || data.length === 0)
|
if (!data || data.length === 0)
|
||||||
return <NoDataOverlay label="No Activity yet"/>;
|
return <NoDataOverlay label="No Activity yet" />;
|
||||||
|
|
||||||
const renderTableCell = (
|
const renderTableCell = (
|
||||||
value: any,
|
value: any,
|
||||||
@@ -27,7 +27,8 @@ const CustomTable = ({configuration, data}: ICustomTable) => {
|
|||||||
if (Array.isArray(value)) renderedValue = value.join(", ");
|
if (Array.isArray(value)) renderedValue = value.join(", ");
|
||||||
|
|
||||||
// cover use case if the data is an boolean
|
// cover use case if the data is an boolean
|
||||||
if (typeof value === "boolean") renderedValue = <Checkbox disabled checked={value}/>;
|
if (typeof value === "boolean")
|
||||||
|
renderedValue = <Checkbox disabled checked={value} />;
|
||||||
|
|
||||||
// cover use case if we want to render a component
|
// cover use case if we want to render a component
|
||||||
if (render) renderedValue = render(value);
|
if (render) renderedValue = render(value);
|
||||||
@@ -41,7 +42,7 @@ const CustomTable = ({configuration, data}: ICustomTable) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TableContainer component={Paper}>
|
<TableContainer component={Paper}>
|
||||||
<Table sx={{minWidth: 700}} aria-label="customized table">
|
<Table sx={{ minWidth: 700 }} aria-label="customized table">
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
{configuration.map((header: CustomTableConfiguration) => (
|
{configuration.map((header: CustomTableConfiguration) => (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const HomeDummyData = [
|
|||||||
network: "Carlo's Home Network",
|
network: "Carlo's Home Network",
|
||||||
ip_address: "127.0.0.1",
|
ip_address: "127.0.0.1",
|
||||||
roles: "service repository, service consumer, DLG",
|
roles: "service repository, service consumer, DLG",
|
||||||
visible: true
|
visible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
entity_name: "C2",
|
entity_name: "C2",
|
||||||
@@ -15,8 +15,8 @@ export const HomeDummyData = [
|
|||||||
network: "Steve's Home Network",
|
network: "Steve's Home Network",
|
||||||
ip_address: "127.0.0.1",
|
ip_address: "127.0.0.1",
|
||||||
roles: "service repository, service consumer, DLG",
|
roles: "service repository, service consumer, DLG",
|
||||||
visible: false
|
visible: false,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const HomeTableConfig = [
|
export const HomeTableConfig = [
|
||||||
|
|||||||
Reference in New Issue
Block a user