Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kie-issues#1720] Enhance Process Details UI page to show nodeInstanceId each timer belongs to #2820

Merged
merged 8 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Moment from "react-moment";
import "../styles.css";
import { Job } from "@kie-tools/runtime-tools-process-gateway-api/dist/types";
import { OUIAProps, componentOuiaProps } from "@kie-tools/runtime-tools-components/dist/ouiaTools";
import isNil from "lodash/isNil";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use the inline check (<value> === undefined or <value> !== undefined) instead of using a library to do so. This method checks if the value is null or undefined [1], and looking in the Job type, we don't have one case that can have those two values.

[1] https://lodash.com/docs#isNil


interface IOwnProps {
actionType: string;
Expand Down Expand Up @@ -70,20 +71,30 @@ export const JobsDetailsModal: React.FC<IOwnProps & OUIAProps> = ({
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6}>Status: </Text>{" "}
<Text component={TextVariants.h6}>NodeInstanceId: </Text>
</SplitItem>
<SplitItem>{job.status}</SplitItem>
<SplitItem>{job.nodeInstanceId}</SplitItem>
</Split>
</FlexItem>
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6}>Priority: </Text>{" "}
<Text component={TextVariants.h6}>Status: </Text>{" "}
</SplitItem>
<SplitItem>{job.priority}</SplitItem>
<SplitItem>{job.status}</SplitItem>
</Split>
</FlexItem>
{job.repeatInterval && (
{!isNil(job.priority) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

job.priority is from type number, you don't need to check if it will be null or undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions @ljmotta. I think we can use === or !== but one thing I think in the bug screenshot attached job.priority is displayed as Priority: without applying any validations. In that case I think it maybe null/undefined

<FlexItem>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Priority still appears even if it's empty... @josedee is on PTO right now, will push a fix asap

@ljmotta ^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe the priority can have the null value?

<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6}>Priority: </Text>{" "}
</SplitItem>
<SplitItem>{job.priority}</SplitItem>
</Split>
</FlexItem>
)}
{!isNil(job.repeatInterval) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

job.repeatInterval is from type number as well.

<FlexItem>
<Split hasGutter>
<SplitItem>
Expand All @@ -93,7 +104,7 @@ export const JobsDetailsModal: React.FC<IOwnProps & OUIAProps> = ({
</Split>
</FlexItem>
)}
{job.repeatLimit && (
{!isNil(job.repeatLimit) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

<FlexItem>
<Split hasGutter>
<SplitItem>
Expand All @@ -103,14 +114,16 @@ export const JobsDetailsModal: React.FC<IOwnProps & OUIAProps> = ({
</Split>
</FlexItem>
)}
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6}>ScheduledId: </Text>
</SplitItem>
<SplitItem>{job.scheduledId}</SplitItem>
</Split>
</FlexItem>
{job.scheduledId && (
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6}>ScheduledId: </Text>
</SplitItem>
<SplitItem>{job.scheduledId}</SplitItem>
</Split>
</FlexItem>
)}
<FlexItem>
<Split hasGutter>
<SplitItem>
Expand All @@ -137,16 +150,18 @@ export const JobsDetailsModal: React.FC<IOwnProps & OUIAProps> = ({
</SplitItem>
</Split>
</FlexItem>
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6} className="kogito-management-console-shared--jobsModal__text">
Callback Endpoint:{" "}
</Text>
</SplitItem>
<SplitItem>{job.callbackEndpoint}</SplitItem>
</Split>
</FlexItem>
{job.callbackEndpoint && (
<FlexItem>
<Split hasGutter>
<SplitItem>
<Text component={TextVariants.h6} className="kogito-management-console-shared--jobsModal__text">
Callback Endpoint:{" "}
</Text>
</SplitItem>
<SplitItem>{job.callbackEndpoint}</SplitItem>
</Split>
</FlexItem>
)}
</Flex>
</TextContent>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,23 +342,19 @@ const ProcessDetailsTimelinePanel: React.FC<IOwnProps & OUIAProps> = ({
};

const renderTimerIcon = (id: string) => {
return jobs.length > 0 ? (
jobs.map((job, idx) => {
if (id === job.nodeInstanceId) {
return (
<Tooltip content={"Node has job"} key={idx}>
<OutlinedClockIcon
className="pf-u-ml-sm"
color="var(--pf-global--icon--Color--dark)"
onClick={() => handleJobDetails(job)}
/>
</Tooltip>
);
}
})[0]
) : (
<></>
);
const job = jobs.find((job) => id === job.nodeInstanceId);
if (job) {
return (
<Tooltip content={"Node has job"} key={`${id}-job-tooltip-${job.id}`}>
<OutlinedClockIcon
className="pf-u-ml-sm"
color="var(--pf-global--icon--Color--dark)"
onClick={() => handleJobDetails(job)}
/>
</Tooltip>
);
}
return <></>;
pefernan marked this conversation as resolved.
Show resolved Hide resolved
};

const detailsAction: JSX.Element[] = [
Expand Down
Loading
Loading