-
Notifications
You must be signed in to change notification settings - Fork 190
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#1547: DMN Editor: Render evaluation highlights in the Boxed Expression Editor #2681
Conversation
@@ -203,6 +203,46 @@ | |||
border: 0; | |||
} | |||
|
|||
.expression-container .table-component tr.evaluation-highlights-row-overlay > td:first-child::before { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jomarko Thanks a lot for your PR. I didn't have time to manually test it, but I will. Until then, I've made some comments inline.
/** Index of the column, where the evaluation hits count should be displayed. If not set, evaluation hits count number is not shown. */ | ||
evaluationHitsCountColumnIndex?: number; | ||
/** Method should return true for table rows, that can display evaluation hits count, false otherwise. If not set, BeeTableBody defaults to false. */ | ||
getEvaluationHitsCountSupportedByRow?: (row: ReactTable.Row<R>) => boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is a little strange for me. The idea is to the get if a row supports (or not) the "EvaluationHitsCount". I don't think the "ByRow" makes sense, so:
isEvaluationHitCountSupported(row: Row)
: Theis
tells the method will be booleansupportsEvaluationHitCount(row: Row)
Another idea is to use the args: { row: Row }
, but I don't think is necessary, as we just have one parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understand, done
@@ -247,6 +256,8 @@ export function ConditionalExpression({ | |||
shouldRenderRowIndexColumn={false} | |||
shouldShowRowsInlineControls={false} | |||
shouldShowColumnsInlineControls={false} | |||
evaluationHitsCountColumnIndex={1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 1
? Could you please add a comment here? Or make it a variable with a very good name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed from the codebase
@@ -1073,6 +1077,8 @@ export function DecisionTableExpression({ | |||
shouldRenderRowIndexColumn={true} | |||
shouldShowRowsInlineControls={true} | |||
shouldShowColumnsInlineControls={true} | |||
evaluationHitsCountColumnIndex={0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the 0
here, but it would be good to add a comment too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed from the codebase
packages/boxed-expression-component/src/BoxedExpressionEditorContext.tsx
Outdated
Show resolved
Hide resolved
const rowKey = getRowKey(row); | ||
const isEvalationHitsCountSupportedByRow: boolean = getEvaluationHitsCountSupportedByRow?.(row) ?? false; | ||
const rowEvaluationHitsCount = evaluationHitsCountPerId ? evaluationHitsCountPerId?.get(rowKey) ?? 0 : undefined; | ||
const canDisplayEvaluationHitsCountRowOverlay = | ||
rowEvaluationHitsCount !== undefined && isEvalationHitsCountSupportedByRow === true; | ||
const rowClassName = canDisplayEvaluationHitsCountRowOverlay | ||
? rowKey + (rowEvaluationHitsCount > 0 ? " evaluation-hits-count-row-overlay" : "") | ||
: rowKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is a little dense, a lot of information here.
- Could you please inline the
isEvalationHitsCountSupportedByRow
as it's used only one time? - I'm not sure about this one, but can you force the ternary to be written in multiple lines?
- Could you please add a line break between? As multiple ternaries can be very difficult to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ternary operator is tricky
there is an eslint rule, that would force what you propose:
https://eslint.style/rules/js/multiline-ternary
However once I used it in project and formatted ternary operators as multiple lines, the current prettier configuration, the pre-commit hook for formatting we have reverted those changes, or adapted them in a way, that caused eslint again complaining..
So we have currently a prettier configuration that is not compatible with this eslint rule.
const evaluationHitsCountBadgeClassName = canDisplayEvaluationHitsCountBadge | ||
? (evaluationHitsCount ?? 0) > 0 | ||
? "evaluation-hits-count-badge-colored" | ||
: "evaluation-hits-count-badge-non-colored" | ||
: ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use an useMemo
hook here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, used
…ontext.tsx Co-authored-by: Luiz João Motta <[email protected]>
@jomarko Thanks for applying the changes. After manually testing it, I could find a CSS that will highlight as first discussed: .expression-container-box .conditional-expression .table-component tr.evaluation-hits-count-row-overlay > td:first-child::before {
content: "";
position: absolute;
background-color: rgb(215, 201, 255, 0.5);
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.expression-container-box .conditional-expression .table-component tr.evaluation-hits-count-row-overlay > td > div > div > div > .logic-type-selected-header::before {
content: "";
position: absolute;
background-color: rgb(215, 201, 255, 0.5);
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.expression-container-box .decision-table-expression .table-component tr.evaluation-hits-count-row-overlay > td::before {
content: "";
position: absolute;
background-color: rgb(215, 201, 255, 0.5);
left: 0;
top: 0;
width: 100%;
height: 100%;
} You will need to add a <div className={"conditional-expression"} data-testid={"kie-tools--boxed-expression-component---conditional"}>
<BeeTable<ROWTYPE>
... I guess it can be simplified, but I broke into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jomarko everything looks great to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jomarko I've just one last comment regarding the boxedExpressionStoriesWrapper
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary to modify the BoxedExpressionEditorStoryArgs
type, as the BoxedExpressionEditorProps
already contains the evaluationHitsCountById
property.
Also, the useState
isn't required.
The evaluationHitsCountById should have the same value as other props:
evaluationHitsCountById={props?.evaluationHitsCountById ?? args?.evaluationHitsCountById}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, I am happy we can keep it simple
Closes: apache/incubator-kie-issues/issues/1547
checklist
testing
New
Evaluation Hits
stories were added intoConditional
andDecision Table
stories.