Skip to content

Commit

Permalink
refactor: refactor op group column file purely for sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalcengio authored and shon-button committed Jan 8, 2025
1 parent 2820ad0 commit 223286d
Showing 1 changed file with 18 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,29 @@ import {
import EmptyGroupCell from "@bciers/components/datagrid/cells/EmptyGroupCell";
import { OPERATOR_COLUMN_INDEX } from "./operationColumns";

const createColumnGroup = (
groupId: string,
headerName: string,
renderHeaderGroup: any,
) => ({
groupId,
headerName,
renderHeaderGroup,
children: [{ field: groupId }],
});

const operationGroupColumns = (
isOperatorColumn: boolean,
SearchCell: (params: GridColumnGroupHeaderParams) => JSX.Element,
) => {
const columnGroupModel = [
{
groupId: "bcghg_id",
headerName: "BC GHG ID",
renderHeaderGroup: SearchCell,
children: [{ field: "bcghg_id" }],
},
{
groupId: "name",
headerName: "Operation",
renderHeaderGroup: SearchCell,
children: [{ field: "name" }],
},
{
groupId: "submission_date",
headerName: "Submission Date",
renderHeaderGroup: EmptyGroupCell,
children: [{ field: "submission_date" }],
},
{
groupId: "bc_obps_regulated_operation",
headerName: "BORO ID",
renderHeaderGroup: SearchCell,
children: [{ field: "bc_obps_regulated_operation" }],
},
{
groupId: "status",
headerName: "Application Status",
renderHeaderGroup: SearchCell,
children: [{ field: "status" }],
},
{
groupId: "report_status",
headerName: "Status",
renderHeaderGroup: SearchCell,
children: [{ field: "report_status" }],
},
{
groupId: "action",
headerName: "Action",
renderHeaderGroup: EmptyGroupCell,
children: [{ field: "action" }],
},
createColumnGroup("bcghg_id", "BC GHG ID", SearchCell),
createColumnGroup("name", "Operation", SearchCell),
createColumnGroup("submission_date", "Submission Date", EmptyGroupCell),
createColumnGroup("bc_obps_regulated_operation", "BORO ID", SearchCell),
createColumnGroup("status", "Application Status", SearchCell),
createColumnGroup("report_status", "Status", SearchCell),
createColumnGroup("action", "Action", EmptyGroupCell),
] as GridColumnGroupingModel;

if (isOperatorColumn) {
Expand Down

0 comments on commit 223286d

Please sign in to comment.