Skip to content

Commit

Permalink
sorting amd telco in side menu
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Jul 9, 2024
1 parent bbc007e commit 7348cdb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/src/actions/commonActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const sortTable = (currState) => (dispatch, getState) => {
const { activeSortDir, activeSortIndex, tableColumns } =
getState()[currState];
try {
if (activeSortIndex) {
if (activeSortIndex !== null && typeof activeSortIndex !== "undefined") {
const sortedResults = results.sort((a, b) => {
const aValue = getSortableRowValues(a, tableColumns)[activeSortIndex];
const bValue = getSortableRowValues(b, tableColumns)[activeSortIndex];
Expand All @@ -31,7 +31,7 @@ export const sortTable = (currState) => (dispatch, getState) => {
return bValue.localeCompare(aValue);
}
});
sortedTableRows(currState, sortedResults);
dispatch(sortedTableRows(currState, sortedResults));
}
} catch (error) {
console.log(error);
Expand All @@ -41,15 +41,15 @@ export const sortTable = (currState) => (dispatch, getState) => {
const sortedTableRows = (currState, sortedResults) => (dispatch) => {
if (currState === "cpt") {
dispatch({
type: TYPES.SET_CPT_JOBS_DATA,
type: TYPES.SET_FILTERED_DATA,
payload: sortedResults,
});
dispatch(sliceTableRows(0, DEFAULT_PER_PAGE));
return;
}
if (currState === "ocp") {
dispatch({
type: TYPES.SET_OCP_JOBS_DATA,
type: TYPES.SET_OCP_FILTERED_DATA,
payload: sortedResults,
});
dispatch(sliceOCPTableRows(0, DEFAULT_PER_PAGE));
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/actions/homeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const buildFilterData = () => (dispatch, getState) => {
let obj = {
name: filter.name,
key,
value: [...new Set(results.map((item) => item[key]))],
value: [...new Set(results.map((item) => item[key]?.toLowerCase()))],
};
filterData.push(obj);
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/assets/constants/SidemenuConstants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const HOME_NAV = "home";
export const QUAY_NAV = "quay";
export const OCP_NAV = "ocp";
export const TELCO_NAV = "telco";
5 changes: 5 additions & 0 deletions frontend/src/components/molecules/SideMenuOptions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const sideMenuOptions = [
key: "quay",
displayName: "Quay",
},
{
id: CONSTANTS.TELCO_NAV,
key: "telco",
displayName: "Telco",
},
];

const MenuOptions = () => {
Expand Down

0 comments on commit 7348cdb

Please sign in to comment.