Skip to content

Commit

Permalink
multiple APIs to fetch periods and icon to display more info
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Oct 18, 2024
1 parent 606f468 commit e755221
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
10 changes: 5 additions & 5 deletions frontend/src/actions/ilabActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
);
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/components/templates/ILab/IlabCompareComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -64,8 +66,18 @@ const IlabCompareComponent = () => {
hasCheckbox
itemId={item.id}
isSelected={selectedItems.includes(item.id)}
actions={
<MenuItemAction
icon={<InfoCircleIcon aria-hidden />}
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]
}`}
</MenuItem>
);
})}
Expand Down

0 comments on commit e755221

Please sign in to comment.