Skip to content
Snippets Groups Projects
Commit 72c28620 authored by Anders Lindh Olsson's avatar Anders Lindh Olsson :8ball:
Browse files

Merge branch 'CE-2425-remove-filter-network' into 'develop'

CE-2425: remove ioc network filtering feature

See merge request !443
parents 5e07b957 31d96804
No related branches found
No related tags found
2 merge requests!497CE-2790: Prepare for 4.0.0,!443CE-2425: remove ioc network filtering feature
Pipeline #174451 passed
......@@ -26,6 +26,7 @@ storybook*
.env.test.local
.env.production.local
.npmrc
.nvmrc
npm-debug.log*
yarn-debug.log*
......
......@@ -2,7 +2,6 @@ import React from "react";
import { Table, InternalLink, EllipsisText } from "@ess-ics/ce-ui-common";
import { IOCDescription } from "./IOCDescription";
import { IOCStatus } from "./IOCStatus";
import { getGridStringOperators } from "@mui/x-data-grid";
const exploreIocsColumns = [
{
......@@ -25,24 +24,18 @@ const exploreIocsColumns = [
headerName: "Host",
width: "10ch",
sortable: false,
filterable: false,
disableColumnMenu: true
filterable: false
},
{
field: "network",
headerName: "Network",
width: "10ch",
disableColumnMenu: false,
filterable: true,
renderCell: (params) => {
return <EllipsisText>{params.value ?? "---"}</EllipsisText>;
},
valueGetter: (params) => {
return params.value;
},
filterOperators: getGridStringOperators().filter(
(operator) => operator.value === "contains"
)
}
}
];
......@@ -134,9 +127,7 @@ export function IOCTable({
rowType = "explore",
loading,
pagination,
onPage,
filterModel = { items: [] },
onFilterModelChange = () => {}
onPage
}) {
const tableTypeSpecifics = {
host: [hostDetailsColumns, createTableRowForHostDetails],
......@@ -154,10 +145,6 @@ export function IOCTable({
onPage={onPage}
loading={loading}
disableHover
filterMode="server"
filterModel={filterModel}
onFilterModelChange={onFilterModelChange}
enableFilterToolbar
/>
);
}
import React, { useCallback, useContext, useState } from "react";
import React, { useContext } from "react";
import { Card, CardHeader } from "@mui/material";
import { useEffect } from "react";
import { initRequestParams } from "../Helper";
......@@ -26,7 +26,6 @@ export function UserIocList({ userName }) {
initLimit: rowsPerPage[0],
initPage: 0
});
const [filterModel, setFilterModel] = useState();
// update pagination whenever search result total pages change
useEffect(() => {
......@@ -38,16 +37,13 @@ export function UserIocList({ userName }) {
let requestParams = initRequestParams(pagination);
requestParams.created_by = userName;
requestParams.network = filterModel?.items?.filter(
(it) => it.field === "network"
)?.[0]?.value;
getIocs(requestParams);
return () => {
abort();
};
}, [getIocs, pagination, userName, abort, filterModel]);
}, [getIocs, pagination, userName, abort]);
// Invoked by Table on change to pagination
const onPage = (params) => {
......@@ -55,13 +51,6 @@ export function UserIocList({ userName }) {
abort();
};
const onFilterModelChange = useCallback(
(model) => {
setFilterModel(model);
},
[setFilterModel]
);
return (
<Card variant="plain">
<CardHeader
......@@ -77,7 +66,6 @@ export function UserIocList({ userName }) {
rowType="explore"
pagination={pagination}
onPage={onPage}
onFilterModelChange={onFilterModelChange}
/>
</Card>
);
......
......@@ -42,12 +42,10 @@ export function IOCListView() {
tab: "0",
rows: "20",
page: "0",
query: "",
network: undefined
query: ""
},
{ navigateMode: "replace" }
);
const [filterModel, setFilterModel] = useState({ items: [] });
const [deploymentStatus, setDeploymentStatus] = useState("ALL");
......@@ -131,7 +129,6 @@ export function IOCListView() {
);
requestParams.deployment_status = deploymentStatus;
requestParams.network = urlState.network;
getIocs(requestParams);
......@@ -143,7 +140,6 @@ export function IOCListView() {
urlPagination,
deploymentStatus,
urlState.query,
urlState.network,
pagination,
abort
]);
......@@ -156,30 +152,6 @@ export function IOCListView() {
[setUrlState]
);
// When the filter model changes, update the model
// and update the url state
const onFilterModelChange = useCallback(
(model) => {
const network = model?.items?.filter((it) => it.field === "network")?.[0]
?.value;
setUrlState({ network: serialize(network) });
setFilterModel(model);
},
[setUrlState, setFilterModel]
);
// When the network url state changes, update the filter model
// so e.g. it sets the filter on first page load
useEffect(() => {
if (urlState.network) {
setFilterModel({
items: [
{ field: "network", operator: "contains", value: urlState.network }
]
});
}
}, [urlState.network]);
let content = (
<SearchBar
search={setSearch}
......@@ -193,8 +165,6 @@ export function IOCListView() {
rowType="explore"
pagination={pagination}
onPage={onPage}
filterModel={filterModel}
onFilterModelChange={onFilterModelChange}
/>
</SearchBar>
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment