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* ...@@ -26,6 +26,7 @@ storybook*
.env.test.local .env.test.local
.env.production.local .env.production.local
.npmrc .npmrc
.nvmrc
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
......
...@@ -2,7 +2,6 @@ import React from "react"; ...@@ -2,7 +2,6 @@ import React from "react";
import { Table, InternalLink, EllipsisText } from "@ess-ics/ce-ui-common"; import { Table, InternalLink, EllipsisText } from "@ess-ics/ce-ui-common";
import { IOCDescription } from "./IOCDescription"; import { IOCDescription } from "./IOCDescription";
import { IOCStatus } from "./IOCStatus"; import { IOCStatus } from "./IOCStatus";
import { getGridStringOperators } from "@mui/x-data-grid";
const exploreIocsColumns = [ const exploreIocsColumns = [
{ {
...@@ -25,24 +24,18 @@ const exploreIocsColumns = [ ...@@ -25,24 +24,18 @@ const exploreIocsColumns = [
headerName: "Host", headerName: "Host",
width: "10ch", width: "10ch",
sortable: false, sortable: false,
filterable: false, filterable: false
disableColumnMenu: true
}, },
{ {
field: "network", field: "network",
headerName: "Network", headerName: "Network",
width: "10ch", width: "10ch",
disableColumnMenu: false,
filterable: true,
renderCell: (params) => { renderCell: (params) => {
return <EllipsisText>{params.value ?? "---"}</EllipsisText>; return <EllipsisText>{params.value ?? "---"}</EllipsisText>;
}, },
valueGetter: (params) => { valueGetter: (params) => {
return params.value; return params.value;
}, }
filterOperators: getGridStringOperators().filter(
(operator) => operator.value === "contains"
)
} }
]; ];
...@@ -134,9 +127,7 @@ export function IOCTable({ ...@@ -134,9 +127,7 @@ export function IOCTable({
rowType = "explore", rowType = "explore",
loading, loading,
pagination, pagination,
onPage, onPage
filterModel = { items: [] },
onFilterModelChange = () => {}
}) { }) {
const tableTypeSpecifics = { const tableTypeSpecifics = {
host: [hostDetailsColumns, createTableRowForHostDetails], host: [hostDetailsColumns, createTableRowForHostDetails],
...@@ -154,10 +145,6 @@ export function IOCTable({ ...@@ -154,10 +145,6 @@ export function IOCTable({
onPage={onPage} onPage={onPage}
loading={loading} loading={loading}
disableHover 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 { Card, CardHeader } from "@mui/material";
import { useEffect } from "react"; import { useEffect } from "react";
import { initRequestParams } from "../Helper"; import { initRequestParams } from "../Helper";
...@@ -26,7 +26,6 @@ export function UserIocList({ userName }) { ...@@ -26,7 +26,6 @@ export function UserIocList({ userName }) {
initLimit: rowsPerPage[0], initLimit: rowsPerPage[0],
initPage: 0 initPage: 0
}); });
const [filterModel, setFilterModel] = useState();
// update pagination whenever search result total pages change // update pagination whenever search result total pages change
useEffect(() => { useEffect(() => {
...@@ -38,16 +37,13 @@ export function UserIocList({ userName }) { ...@@ -38,16 +37,13 @@ export function UserIocList({ userName }) {
let requestParams = initRequestParams(pagination); let requestParams = initRequestParams(pagination);
requestParams.created_by = userName; requestParams.created_by = userName;
requestParams.network = filterModel?.items?.filter(
(it) => it.field === "network"
)?.[0]?.value;
getIocs(requestParams); getIocs(requestParams);
return () => { return () => {
abort(); abort();
}; };
}, [getIocs, pagination, userName, abort, filterModel]); }, [getIocs, pagination, userName, abort]);
// Invoked by Table on change to pagination // Invoked by Table on change to pagination
const onPage = (params) => { const onPage = (params) => {
...@@ -55,13 +51,6 @@ export function UserIocList({ userName }) { ...@@ -55,13 +51,6 @@ export function UserIocList({ userName }) {
abort(); abort();
}; };
const onFilterModelChange = useCallback(
(model) => {
setFilterModel(model);
},
[setFilterModel]
);
return ( return (
<Card variant="plain"> <Card variant="plain">
<CardHeader <CardHeader
...@@ -77,7 +66,6 @@ export function UserIocList({ userName }) { ...@@ -77,7 +66,6 @@ export function UserIocList({ userName }) {
rowType="explore" rowType="explore"
pagination={pagination} pagination={pagination}
onPage={onPage} onPage={onPage}
onFilterModelChange={onFilterModelChange}
/> />
</Card> </Card>
); );
......
...@@ -42,12 +42,10 @@ export function IOCListView() { ...@@ -42,12 +42,10 @@ export function IOCListView() {
tab: "0", tab: "0",
rows: "20", rows: "20",
page: "0", page: "0",
query: "", query: ""
network: undefined
}, },
{ navigateMode: "replace" } { navigateMode: "replace" }
); );
const [filterModel, setFilterModel] = useState({ items: [] });
const [deploymentStatus, setDeploymentStatus] = useState("ALL"); const [deploymentStatus, setDeploymentStatus] = useState("ALL");
...@@ -131,7 +129,6 @@ export function IOCListView() { ...@@ -131,7 +129,6 @@ export function IOCListView() {
); );
requestParams.deployment_status = deploymentStatus; requestParams.deployment_status = deploymentStatus;
requestParams.network = urlState.network;
getIocs(requestParams); getIocs(requestParams);
...@@ -143,7 +140,6 @@ export function IOCListView() { ...@@ -143,7 +140,6 @@ export function IOCListView() {
urlPagination, urlPagination,
deploymentStatus, deploymentStatus,
urlState.query, urlState.query,
urlState.network,
pagination, pagination,
abort abort
]); ]);
...@@ -156,30 +152,6 @@ export function IOCListView() { ...@@ -156,30 +152,6 @@ export function IOCListView() {
[setUrlState] [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 = ( let content = (
<SearchBar <SearchBar
search={setSearch} search={setSearch}
...@@ -193,8 +165,6 @@ export function IOCListView() { ...@@ -193,8 +165,6 @@ export function IOCListView() {
rowType="explore" rowType="explore"
pagination={pagination} pagination={pagination}
onPage={onPage} onPage={onPage}
filterModel={filterModel}
onFilterModelChange={onFilterModelChange}
/> />
</SearchBar> </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