Skip to content

Commit

Permalink
[NU-1901] fix deployment status indicator for periodic scenarios (#7283)
Browse files Browse the repository at this point in the history
* NU-1901 fix deploy status activity for periodic scenarios
  • Loading branch information
Dzuming authored Dec 4, 2024
1 parent 86c4912 commit b580599
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const ActivitiesPanelRow = memo(({ index, style, setRowHeight, handleShow
() => activities.findIndex((activeItem) => activeItem.uiType === "item" && activeItem.type === "SCENARIO_DEPLOYED"),
[activities],
);
const isRunning = firstDeployedIndex === index && scenarioState.status.name === "RUNNING";
const scenarioStatusesToActiveDeploy = ["RUNNING", "SCHEDULED"];
const isDeploymentActive = firstDeployedIndex === index && scenarioStatusesToActiveDeploy.includes(scenarioState.status.name);
const isFirstDateItem = activities.findIndex((activeItem) => activeItem.uiType === "date") === index;

useEffect(() => {
Expand All @@ -41,7 +42,7 @@ export const ActivitiesPanelRow = memo(({ index, style, setRowHeight, handleShow
case "item": {
return (
<ActivityItemProvider>
<ActivityItem activity={activity} ref={rowRef} isRunning={isRunning} searchQuery={searchQuery} />
<ActivityItem activity={activity} ref={rowRef} isDeploymentActive={isDeploymentActive} searchQuery={searchQuery} />
</ActivityItemProvider>
);
}
Expand Down Expand Up @@ -69,7 +70,7 @@ export const ActivitiesPanelRow = memo(({ index, style, setRowHeight, handleShow
return null;
}
}
}, [activity, handleHideRows, handleShowRows, isRunning, isFirstDateItem, searchQuery, t]);
}, [activity, handleHideRows, handleShowRows, isDeploymentActive, isFirstDateItem, searchQuery, t]);

return (
<div style={style} data-testid={`activity-row-${index}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const StyledActivityBody = styled("div")(({ theme }) => ({

export const ActivityItem = forwardRef(
(
{ activity, isRunning, searchQuery }: { activity: ItemActivity; isRunning: boolean; searchQuery: string },
{ activity, isDeploymentActive, searchQuery }: { activity: ItemActivity; isDeploymentActive: boolean; searchQuery: string },
ref: ForwardedRef<HTMLDivElement>,
) => {
const { t } = useTranslation();
Expand All @@ -55,7 +55,7 @@ export const ActivityItem = forwardRef(
>
<StyledActivityContent isActiveFound={activity.isActiveFound} isFound={activity.isFound}>
<ActivityItemHeader
isRunning={isRunning}
isDeploymentActive={isDeploymentActive}
searchQuery={searchQuery}
activity={activity}
isActiveFound={activity.isActiveFound}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ const StyledHeaderActionRoot = styled("div")(({ theme }) => ({
gap: theme.spacing(0.5),
}));

const StyledActivityItemHeader = styled("div")<{ isHighlighted: boolean; isRunning: boolean; isActiveFound: boolean }>(
({ theme, isHighlighted, isRunning, isActiveFound }) => ({
const StyledActivityItemHeader = styled("div")<{ isHighlighted: boolean; isDeploymentActive: boolean; isActiveFound: boolean }>(
({ theme, isHighlighted, isDeploymentActive, isActiveFound }) => ({
display: "flex",
alignItems: "center",
padding: theme.spacing(0.5, 0.5, 0.5, 0.75),
borderRadius: theme.spacing(0.5),
...getHeaderColors(theme, isHighlighted, isRunning, isActiveFound),
...getHeaderColors(theme, isHighlighted, isDeploymentActive, isActiveFound),
}),
);

Expand Down Expand Up @@ -167,7 +167,7 @@ const HeaderActivity = ({

interface Props {
activity: ItemActivity;
isRunning: boolean;
isDeploymentActive: boolean;
isActiveFound: boolean;
isFound: boolean;
searchQuery: string;
Expand Down Expand Up @@ -230,7 +230,7 @@ const WithOpenVersion = ({
);
};

const ActivityItemHeader = ({ activity, isRunning, isFound, isActiveFound, searchQuery }: Props) => {
const ActivityItemHeader = ({ activity, isDeploymentActive, isFound, isActiveFound, searchQuery }: Props) => {
const scenario = useSelector(getScenario);
const { processVersionId } = scenario || {};

Expand Down Expand Up @@ -279,7 +279,7 @@ const ActivityItemHeader = ({ activity, isRunning, isFound, isActiveFound, searc
]);

return (
<StyledActivityItemHeader isHighlighted={isHighlighted} isRunning={isRunning} isActiveFound={isActiveFound}>
<StyledActivityItemHeader isHighlighted={isHighlighted} isDeploymentActive={isDeploymentActive} isActiveFound={isActiveFound}>
<StyledHeaderIcon src={activity.activities.icon} id={activity.uiGeneratedId} />
{getHeaderTitle}
<StyledHeaderActionRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const runningHeaderBackground = (theme: Theme) => blend(theme.palette.background
const activeFoundItemBackground = (theme: Theme) => blend(theme.palette.background.paper, theme.palette.primary.main, 0.2);
const foundItemBackground = (theme: Theme) => blend(theme.palette.background.paper, theme.palette.primary.main, 0.08);

export const getHeaderColors = (theme: Theme, isHighlighted: boolean, isRunning: boolean, isActiveFound: boolean) => {
if (isRunning && isActiveFound) {
export const getHeaderColors = (theme: Theme, isHighlighted: boolean, isDeploymentActive: boolean, isActiveFound: boolean) => {
if (isDeploymentActive && isActiveFound) {
return {
backgroundColor: runningActiveFoundHeaderBackground(theme),
border: activeBorder(theme),
Expand All @@ -27,7 +27,7 @@ export const getHeaderColors = (theme: Theme, isHighlighted: boolean, isRunning:
};
}

if (isRunning) {
if (isDeploymentActive) {
return {
backgroundColor: runningHeaderBackground(theme),
border: defaultBorder(theme),
Expand Down
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* [#7269](https://github.com/TouK/nussknacker/pull/7269) Fixed focus scrolling in expression editor
* [#7270](https://github.com/TouK/nussknacker/pull/7270) Savepoint deserialization fixup - some taken savepoints (e.g. for scenarios with async enrichers) were not deserializable which led to errors during redeployments on Flink
* [#7279](https://github.com/TouK/nussknacker/pull/7279) Fixed Flink TaskManager and Designer containers restarts in installation example
* [#7283](https://github.com/TouK/nussknacker/pull/7283) fix deployment status indicator for periodic scenarios type

### 1.18.0 (22 November 2024)

Expand Down

0 comments on commit b580599

Please sign in to comment.