From e7552216156a24d462613bb63b084db15809fc0e Mon Sep 17 00:00:00 2001 From: MVarshini Date: Fri, 18 Oct 2024 23:09:51 +0530 Subject: [PATCH] multiple APIs to fetch periods and icon to display more info --- frontend/src/actions/ilabActions.js | 10 +++++----- .../templates/ILab/IlabCompareComponent.jsx | 14 +++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/src/actions/ilabActions.js b/frontend/src/actions/ilabActions.js index 82cee57..c378273 100644 --- a/frontend/src/actions/ilabActions.js +++ b/frontend/src/actions/ilabActions.js @@ -175,14 +175,14 @@ export const fetchGraphData = export const handleMultiGraph = (uids) => async (dispatch, getState) => { try { const periods = getState().ilab.periods; + const pUids = periods.map((i) => i.uid); - const missingPeriods = periods.filter((item) => !uids.includes(item.uid)); - - const missingUids = - periods.length > 0 ? missingPeriods.map((item) => item.uid) : uids; + const missingPeriods = uids.filter(function (x) { + return pUids.indexOf(x) < 0; + }); await Promise.all( - missingUids.map(async (uid) => { + missingPeriods.map(async (uid) => { await dispatch(fetchPeriods(uid)); // Dispatch each item }) ); diff --git a/frontend/src/components/templates/ILab/IlabCompareComponent.jsx b/frontend/src/components/templates/ILab/IlabCompareComponent.jsx index 161d39f..c062be1 100644 --- a/frontend/src/components/templates/ILab/IlabCompareComponent.jsx +++ b/frontend/src/components/templates/ILab/IlabCompareComponent.jsx @@ -5,11 +5,13 @@ import { Menu, MenuContent, MenuItem, + MenuItemAction, MenuList, Title, } from "@patternfly/react-core"; import { useDispatch, useSelector } from "react-redux"; +import { InfoCircleIcon } from "@patternfly/react-icons"; import Plot from "react-plotly.js"; import PropTypes from "prop-types"; import RenderPagination from "@/components/organisms/Pagination"; @@ -64,8 +66,18 @@ const IlabCompareComponent = () => { hasCheckbox itemId={item.id} isSelected={selectedItems.includes(item.id)} + actions={ + } + actionId="code" + onClick={() => console.log("clicked on code icon")} + aria-label="Code" + /> + } > - {`${new Date(item.begin_date).toLocaleDateString()} ${item.primary_metrics[0]}`} + {`${new Date(item.begin_date).toLocaleDateString()} ${ + item.primary_metrics[0] + }`} ); })}