Skip to content

Commit

Permalink
Date filter
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Dec 12, 2024
1 parent e0fbbd2 commit 93b5d0d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
1 change: 0 additions & 1 deletion backend/app/api/v1/endpoints/cpt/maps/ocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ async def ocmMapper(start_datetime: date, end_datetime: date, size: int, offset:
df["testName"] = df["attack"]
df["startDate"] = df["metrics.earliest"]
df["endDate"] = df["metrics.end"]

return {"data": df, "total": response["total"]}
return {"data": pd.DataFrame(), "total": 0}
16 changes: 8 additions & 8 deletions frontend/src/actions/filterActions.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import {
applyCPTDateFilter,
removeCPTAppliedFilters,
setCPTAppliedFilters,
setCPTCatFilters,
setCPTDateFilter,
setCPTOtherSummaryFilter,
} from "./homeActions";
import {
applyOCPDateFilter,
removeOCPAppliedFilters,
setOCPAppliedFilters,
setOCPCatFilters,
setOCPDateFilter,
setOCPOtherSummaryFilter,
} from "./ocpActions";
import {
applyQuayDateFilter,
removeQuayAppliedFilters,
setQuayAppliedFilters,
setQuayCatFilters,
setQuayDateFilter,
setQuayOtherSummaryFilter,
} from "./quayActions";
import {
applyTelcoDateFilter,
removeTelcoAppliedFilters,
setTelcoAppliedFilters,
setTelcoCatFilters,
setTelcoDateFilter,
setTelcoOtherSummaryFilter,
} from "./telcoActions";

Expand Down Expand Up @@ -69,13 +69,13 @@ export const removeAppliedFilters = (key, value, navigation, currType) => {

export const setDateFilter = (date, key, navigation, currType) => {
if (currType === "cpt") {
dispatch(setCPTDateFilter(date, key, navigation));
dispatch(applyCPTDateFilter(date, key, navigation));
} else if (currType === "ocp") {
dispatch(setOCPDateFilter(date, key, navigation));
dispatch(applyOCPDateFilter(date, key, navigation));
} else if (currType === "quay") {
dispatch(setQuayDateFilter(date, key, navigation));
dispatch(applyQuayDateFilter(date, key, navigation));
} else if (currType === "telco") {
dispatch(setTelcoDateFilter(date, key, navigation));
dispatch(applyTelcoDateFilter(date, key, navigation));
}
};

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/actions/homeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ export const setCPTDateFilter =
});

appendQueryString({ ...appliedFilters, start_date, end_date }, navigate);
};

// dispatch(fetchOCPJobsData());
export const applyCPTDateFilter =
(start_date, end_date, navigate) => (dispatch) => {
dispatch(setCPTDateFilter(start_date, end_date, navigate));
dispatch(fetchOCPJobsData());
};

export const setCPTPage = (pageNo) => ({
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/actions/ocpActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,13 @@ export const setOCPDateFilter =
});

appendQueryString({ ...appliedFilters, start_date, end_date }, navigate);
};

export const applyOCPDateFilter =
(start_date, end_date, navigate) => (dispatch) => {
dispatch(setOCPDateFilter(start_date, end_date, navigate));
dispatch(fetchOCPJobs());
};

export const setFilterFromURL = (searchParams) => ({
type: TYPES.SET_OCP_APPLIED_FILTERS,
payload: searchParams,
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/actions/quayActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ export const setQuayDateFilter =
});

appendQueryString({ ...appliedFilters, start_date, end_date }, navigate);
};

export const applyQuayDateFilter =
(start_date, end_date, navigate) => (dispatch) => {
dispatch(setQuayDateFilter(start_date, end_date, navigate));
dispatch(fetchQuayJobsData());
};

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/actions/telcoActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,12 @@ export const setTelcoDateFilter =
});

appendQueryString({ ...appliedFilters, start_date, end_date }, navigate);
};

//dispatch(fetchTelcoJobsData());
export const applyTelcoDateFilter =
(start_date, end_date, navigate) => (dispatch) => {
dispatch(setTelcoDateFilter(start_date, end_date, navigate));
dispatch(fetchTelcoJobsData());
};

export const getTelcoSummary = () => (dispatch, getState) => {
Expand Down

0 comments on commit 93b5d0d

Please sign in to comment.