Skip to content
Snippets Groups Projects
Commit 999e2c20 authored by cjenkscybercom's avatar cjenkscybercom
Browse files

CE-2213: remove job type from job list view

parent 46c6f553
No related branches found
No related tags found
2 merge requests!407CE-2141: 3.0.0,!405Qa release tasks
import React, { useContext, useCallback, useMemo } from "react"; import React, { useContext, useCallback, useMemo } from "react";
import { Grid, TextField, Autocomplete } from "@mui/material"; import { Box } from "@mui/material";
import { RootPaper, useAPIMethod } from "@ess-ics/ce-ui-common"; import { RootPaper, useAPIMethod } from "@ess-ics/ce-ui-common";
import { initRequestParams } from "../../components/common/Helper"; import { initRequestParams } from "../../components/common/Helper";
import { useEffect } from "react"; import { useEffect } from "react";
...@@ -13,13 +13,6 @@ import { usePagination } from "../../hooks/pagination"; ...@@ -13,13 +13,6 @@ import { usePagination } from "../../hooks/pagination";
import { JobTable } from "../../components/Job/JobTable"; import { JobTable } from "../../components/Job/JobTable";
import { apiContext } from "../../api/DeployApi"; import { apiContext } from "../../api/DeployApi";
const jobTypeOptions = [
{ label: "Show all" },
{ label: "Only deployments", filter: "DEPLOYMENT" },
{ label: "Only commands", filter: "COMMAND" }
];
const defaultJobTypeOption = jobTypeOptions[0];
export function JobListView() { export function JobListView() {
const client = useContext(apiContext); const client = useContext(apiContext);
...@@ -38,8 +31,7 @@ export function JobListView() { ...@@ -38,8 +31,7 @@ export function JobListView() {
{ {
rows: "20", rows: "20",
page: "0", page: "0",
query: "", query: ""
job_type: null
}, },
{ navigateMode: "replace" } { navigateMode: "replace" }
); );
...@@ -92,16 +84,12 @@ export function JobListView() { ...@@ -92,16 +84,12 @@ export function JobListView() {
deserialize(urlState.query) deserialize(urlState.query)
); );
if (urlState.job_type) {
requestParams.type = deserialize(urlState.job_type);
}
getOperations(requestParams); getOperations(requestParams);
return () => { return () => {
abort(); abort();
}; };
}, [getOperations, urlPagination, urlState.query, urlState.job_type, abort]); }, [getOperations, urlPagination, urlState.query, abort]);
const setSearch = useCallback( const setSearch = useCallback(
(query) => { (query) => {
...@@ -134,57 +122,7 @@ export function JobListView() { ...@@ -134,57 +122,7 @@ export function JobListView() {
return ( return (
<RootPaper> <RootPaper>
<Grid <Box paddingY={2}>{content}</Box>
container
spacing={1}
>
<Grid
container
spacing={1}
justifyContent="flex-end"
alignItems="center"
style={{ display: "flex" }}
>
<Grid
item
xs={3}
>
<Autocomplete
id="combo-box-demo"
options={jobTypeOptions}
defaultValue={
urlState.job_type
? jobTypeOptions.find(
(o) => o.filter === urlState.job_type
) || defaultJobTypeOption
: defaultJobTypeOption
}
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) =>
option.label === value.label
}
renderInput={(params) => (
<TextField
{...params}
label="Job type"
variant="outlined"
/>
)}
onChange={(event, value, reason) =>
setUrlState({ job_type: value?.filter })
}
autoSelect
/>
</Grid>
</Grid>
<Grid
item
xs={12}
md={12}
>
{content}
</Grid>
</Grid>
</RootPaper> </RootPaper>
); );
} }
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