Skip to content

Commit

Permalink
do not display actions for batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Rudnicki committed Dec 19, 2024
1 parent 6555666 commit f953225
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Moment } from "moment";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { getProcessName } from "../../../reducers/selectors/graph";
import { getProcessCategory, getProcessingType, getProcessName } from "../../../reducers/selectors/graph";
import { CountsRangesButtons } from "./CountsRangesButtons";
import { predefinedRanges } from "./utils";
import { StyledRangesWrapper } from "./CountsStyled";
Expand All @@ -16,7 +16,8 @@ interface RangesProps {
export function CountsRanges({ label, onChange }: RangesProps): JSX.Element {
const { t } = useTranslation<string>();
const processName = useSelector(getProcessName);
const activities = useActivityHistory(processName);
const processCategory = useSelector(getProcessCategory);
const activities = useActivityHistory(processName, processCategory);
const dates = useMemo(() => predefinedRanges(t), [t]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ function displayableNameOfPredefinedActivityType(predefinedActivityType: Predefi
}
}

export function useActivityHistory(processName: string): Range[] {
export function useActivityHistory(processName: string, processCategory: string): Range[] {
const { t } = useTranslation();
const [activities, setActivities] = useState<Range[]>([]);

useEffect(() => {
HttpService.fetchProcessesActivities(processName)
.then((activities) =>
processCategory === "BatchPeriodic"
? activities.filter((activity) => activity.type !== PredefinedActivityType.ScenarioDeployed)
: activities,
)
.then((activities) =>
activities.map((current, i, all) => {
const from = moment(current.date);
Expand Down

0 comments on commit f953225

Please sign in to comment.