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

Conversation

josedee
Copy link
Contributor

@josedee josedee commented Dec 18, 2024

Closes apache/incubator-kie-issues#1720

Currently we do not have node instance details for every job in the Process Details UI page. Hence adding nodeInstanceId corresponding to each job/timer.

@josedee josedee requested a review from tiagobento as a code owner December 18, 2024 06:58
@josedee
Copy link
Contributor Author

josedee commented Dec 18, 2024

Attaching few screenshots

Fixed below bugs
Screenshot 2024-12-18 at 9 25 15 AM

Added nodeInstanceId as shown below
Screenshot 2024-12-18 at 11 15 40 AM

Fixed timer icon and tooltip not appearing for all nodes
Screenshot 2024-12-18 at 11 15 20 AM

Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request. I have a question about isNil usage. Could you please explain little bit more why we need it for:

  • job.priority
  • job.repeatInterval
  • job.repeatLimit

while we do not need it for:

  • job.scheduleId
  • job.callbackEndpoint

usually our effort is to minimize the need of used libraries. So just doublechecking if we need to introduce a dependency for lodash.isNil in this file.

Comment on lines -1 to -19
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo this change, it is an important aspect of releasing Apache open source. Because of this change "CI :: License headers" check will fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jomarko good catch, this file is autogenerated during codegen and codegen tool doesn't add the headers... @josedee please add the license back manually.

@josedee
Copy link
Contributor Author

josedee commented Dec 18, 2024

Thank you for the pull request. I have a question about isNil usage. Could you please explain little bit more why we need it for:

  • job.priority
  • job.repeatInterval
  • job.repeatLimit

while we do not need it for:

  • job.scheduleId
  • job.callbackEndpoint

usually our effort is to minimize the need of used libraries. So just doublechecking if we need to introduce a dependency for lodash.isNil in this file.

As seen in this screenshot, priority, repeatInterval and repeatLimit weren't displayed correctly.

In this example priority was either null/undefined, repeatInterval and repeatLimit are boths 0's. All three are numbers. I did this to display them when they are also 0. callbackEndpoint and scheduledId are both strings hence not requiring stringent validation

Copy link
Contributor

@pefernan pefernan left a comment

Choose a reason for hiding this comment

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

+1 when licenses are back and all is green.

@jomarko
Copy link
Contributor

jomarko commented Dec 18, 2024

@pefernan @josedee ok, that changes the situation, and I am sorry, it is my fault. If packages/runtime-tools-process-gateway-api/src/graphql/types.tsx is autogenerated, then the correct approach is to remove the license header from it, and add an entry into .rat-exludes file

like:

# packages/runtime-tools-process-gateway-api/src/graphql/types.tsx
types.tsx

@josedee
Copy link
Contributor Author

josedee commented Dec 18, 2024

@pefernan @josedee ok, that changes the situation, and I am sorry, it is my fault. If packages/runtime-tools-process-gateway-api/src/graphql/types.tsx is autogenerated, then the correct approach is to remove the license header from it, and add an entry into .rat-exludes file

like:

# packages/runtime-tools-process-gateway-api/src/graphql/types.tsx
types.tsx

@jomarko Does it consider all types.tsx files? Should we add only the specific tsx file. In this case

# packages/runtime-tools-process-gateway-api/src/graphql/types.tsx
packages/runtime-tools-process-gateway-api/src/graphql/types.tsx

@jomarko
Copy link
Contributor

jomarko commented Dec 18, 2024

@josedee thank you for comment. It is currently not possible to add packages/runtime-tools-process-gateway-api/src/graphql/types.tsx, because we are blocked by apache/incubator-kie-issues#1670.

I see currently only two types.tsx files in the kie-tools codebase. If both are autogenerated, we can remove the license header from both and we should be fine adding types.tsx into .rat-excludes. What do you think?

Copy link
Contributor

@ljmotta ljmotta left a comment

Choose a reason for hiding this comment

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

Hi @josedee . Nice PR! I've just made some request changes inline regarding the lodash/isNil usage.

@@ -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

</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

</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.

@@ -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

@pefernan
Copy link
Contributor

pefernan commented Dec 18, 2024

@ljmotta @josedee I agree on not using the isNill (although I proposed it originally), but I still think that we need that check because the graphql schema defines those properties as optional, so I'd prefer having it just in case.

@ljmotta
Copy link
Contributor

ljmotta commented Dec 18, 2024

@pefernan oh ok! So the job can be undefined or its properties can be undefined? If is the first case, please add the optional (?) to the job property, or if is the latter please change the job to Partial<Job>.

@pefernan
Copy link
Contributor

@ljmotta nope priority, repeatLimit & repeatInterval can be undefined

@ljmotta
Copy link
Contributor

ljmotta commented Dec 18, 2024

@josedee Could you please update the Job interface with the correct type as @pefernan described? Them you can make the check as follow:

job.priority !== undefined && <></>

Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

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

I did no manual checks. However apache licenses and isNil removal seems as addressed.

</Split>
</FlexItem>
{job.repeatInterval && (
{job.priority !== 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?

@pefernan pefernan merged commit c59b389 into apache:main Dec 23, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Process Details UI page to show nodeInstanceId each timer belongs to
4 participants