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

Sync main branch with Apache main branch #70

Merged
merged 6 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -2036,3 +2036,5 @@ scripts.iml
index.test.js
# scripts/check-junit-report-results/tests/reports/empty.xml
empty.xml
# packages/runtime-tools-process-gateway-api/src/graphql/types.tsx
types.tsx
6 changes: 3 additions & 3 deletions examples/kie-sandbox-commit-message-validation-service/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions examples/kie-sandbox-commit-message-validation-service/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZ
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ quarkus.http.test-port=0
quarkus.swagger-ui.always-include=true
quarkus.kogito.data-index.graphql.ui.always-include=true

# Development tasks users
%dev.jbpm.devui.users.jdoe.groups=admin,HR,IT
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface BoxedExpressionEditorProps {
isReadOnly?: boolean;
/** PMML models available to use on Boxed PMML Function */
pmmlDocuments?: PmmlDocument[];
evaluationHitsCountById?: Map<string, number>;
/** The containing HTMLElement which is scrollable */
scrollableParentRef: React.RefObject<HTMLElement>;
/** Parsed variables used for syntax coloring and auto-complete */
Expand All @@ -79,6 +80,7 @@ export function BoxedExpressionEditor({
isResetSupportedOnRootExpression,
scrollableParentRef,
pmmlDocuments,
evaluationHitsCountById,
onRequestFeelVariables,
widthsById,
onWidthsChange,
Expand All @@ -103,6 +105,7 @@ export function BoxedExpressionEditor({
isReadOnly={isReadOnly}
dataTypes={dataTypes}
pmmlDocuments={pmmlDocuments}
evaluationHitsCountById={evaluationHitsCountById}
onRequestFeelVariables={onRequestFeelVariables}
widthsById={widthsById}
hideDmn14BoxedExpressions={hideDmn14BoxedExpressions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface BoxedExpressionEditorContextType {
pmmlDocuments?: PmmlDocument[];
dataTypes: DmnDataType[];
isReadOnly?: boolean;
evaluationHitsCountById?: Map<string, number>;

// State
currentlyOpenContextMenu: string | undefined;
Expand Down Expand Up @@ -74,6 +75,7 @@ export function BoxedExpressionEditorContextProvider({
beeGwtService,
children,
pmmlDocuments,
evaluationHitsCountById,
scrollableParentRef,
onRequestFeelVariables,
widthsById,
Expand Down Expand Up @@ -114,6 +116,7 @@ export function BoxedExpressionEditorContextProvider({
dataTypes,
isReadOnly,
pmmlDocuments,
evaluationHitsCountById,

//state // FIXME: Move to a separate context (https://github.com/apache/incubator-kie-issues/issues/168)
currentlyOpenContextMenu,
Expand Down
2 changes: 2 additions & 0 deletions packages/boxed-expression-component/src/api/BeeTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export interface BeeTableProps<R extends object> {
shouldShowColumnsInlineControls: boolean;
resizerStopBehavior: ResizerStopBehavior;
lastColumnMinWidth?: number;
/** Method should return true for table rows, that can display evaluation hits count, false otherwise. If not set, BeeTableBody defaults to false. */
supportsEvaluationHitsCount?: (row: ReactTable.Row<R>) => boolean;
}

/** Possible status for the visibility of the Table's Header */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,23 @@ export function ConditionalExpression({
[setExpression]
);

const getRowKey = useCallback((row: ReactTable.Row<ROWTYPE>) => {
return row.original.part["@_id"];
}, []);

const supportsEvaluationHitsCount = useCallback((row: ReactTable.Row<ROWTYPE>) => {
return row.original.label !== "if";
}, []);

return (
<NestedExpressionContainerContext.Provider value={nestedExpressionContainerValue}>
<div data-testid={"kie-tools--boxed-expression-component---conditional"}>
<div className={"conditional-expression"} data-testid={"kie-tools--boxed-expression-component---conditional"}>
<BeeTable<ROWTYPE>
isReadOnly={isReadOnly}
isEditableHeader={!isReadOnly}
resizerStopBehavior={ResizerStopBehavior.SET_WIDTH_WHEN_SMALLER}
tableId={id}
getRowKey={getRowKey}
headerLevelCountForAppendingRowIndexColumn={1}
headerVisibility={headerVisibility}
cellComponentByColumnAccessor={cellComponentByColumnAccessor}
Expand All @@ -247,6 +256,7 @@ export function ConditionalExpression({
shouldRenderRowIndexColumn={false}
shouldShowRowsInlineControls={false}
shouldShowColumnsInlineControls={false}
supportsEvaluationHitsCount={supportsEvaluationHitsCount}
/>
</div>
</NestedExpressionContainerContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,10 @@ export function DecisionTableExpression({
[beeTableRows.length]
);

const supportsEvaluationHitsCount = useCallback((row: ReactTable.Row<ROWTYPE>) => {
return true;
}, []);

return (
<div className={`decision-table-expression ${decisionTableExpression["@_id"]}`}>
<BeeTable<ROWTYPE>
Expand Down Expand Up @@ -1073,6 +1077,7 @@ export function DecisionTableExpression({
shouldRenderRowIndexColumn={true}
shouldShowRowsInlineControls={true}
shouldShowColumnsInlineControls={true}
supportsEvaluationHitsCount={supportsEvaluationHitsCount}
// lastColumnMinWidth={lastColumnMinWidth} // FIXME: Check if this is a good strategy or not when doing https://github.com/apache/incubator-kie-issues/issues/181
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,82 @@
border: 0;
}

.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%;
}

.evaluation-hits-count-badge-non-colored::before {
content: attr(data-evaluation-hits-count);
font-size: 0.8em;
text-align: left;
color: white;
background-color: var(--pf-global--palette--black-600);
position: absolute;
top: 0px;
left: 0px;
height: 40px;
width: 40px;
clip-path: polygon(0% 100%, 100% 0%, 0% 0%);
padding-left: 0.2em;
}

.evaluation-hits-count-badge-colored::before {
content: attr(data-evaluation-hits-count);
font-size: 0.8em;
text-align: left;
color: white;
background-color: rgb(134, 106, 212);
position: absolute;
top: 0px;
left: 0px;
height: 40px;
width: 40px;
clip-path: polygon(0% 100%, 100% 0%, 0% 0%);
padding-left: 0.2em;
}

.expression-container .table-component table tbody tr td.row-index-cell-column {
padding: 1.1em 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function BeeTableInternal<R extends object>({
resizerStopBehavior,
lastColumnMinWidth,
rowWrapper,
supportsEvaluationHitsCount,
}: BeeTableProps<R> & {
selectionRef?: React.RefObject<BeeTableSelectionRef>;
}) {
Expand Down Expand Up @@ -657,6 +658,7 @@ export function BeeTableInternal<R extends object>({
onDataCellKeyUp={onDataCellKeyUp}
lastColumnMinWidth={lastColumnMinWidth}
isReadOnly={isReadOnly}
supportsEvaluationHitsCount={supportsEvaluationHitsCount}
/>
</table>
<BeeTableContextMenuHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { BeeTableTdForAdditionalRow } from "./BeeTableTdForAdditionalRow";
import { BeeTableTd } from "./BeeTableTd";
import { BeeTableCoordinatesContextProvider } from "../../selection/BeeTableSelectionContext";
import { ResizerStopBehavior } from "../../resizing/ResizingWidthsContext";
import { useBoxedExpressionEditor } from "../../BoxedExpressionEditorContext";

export interface BeeTableBodyProps<R extends object> {
/** Table instance */
Expand Down Expand Up @@ -55,6 +56,8 @@ export interface BeeTableBodyProps<R extends object> {
rowWrapper?: React.FunctionComponent<React.PropsWithChildren<{ row: R; rowIndex: number }>>;

isReadOnly: boolean;
/** See BeeTable.ts */
supportsEvaluationHitsCount?: (row: ReactTable.Row<R>) => boolean;
}

export function BeeTableBody<R extends object>({
Expand All @@ -72,18 +75,37 @@ export function BeeTableBody<R extends object>({
lastColumnMinWidth,
rowWrapper,
isReadOnly,
supportsEvaluationHitsCount,
}: BeeTableBodyProps<R>) {
const { evaluationHitsCountById } = useBoxedExpressionEditor();

const renderRow = useCallback(
(row: ReactTable.Row<R>, rowIndex: number) => {
reactTableInstance.prepareRow(row);

const rowKey = getRowKey(row);
const rowEvaluationHitsCount = evaluationHitsCountById ? evaluationHitsCountById?.get(rowKey) ?? 0 : undefined;
const canDisplayEvaluationHitsCountRowOverlay =
rowEvaluationHitsCount !== undefined && (supportsEvaluationHitsCount?.(row) ?? false);
const rowClassName = `${rowKey}${canDisplayEvaluationHitsCountRowOverlay && rowEvaluationHitsCount > 0 ? " evaluation-hits-count-row-overlay" : ""}`;

let evaluationHitsCountBadgeColumnIndex = -1;
const renderTr = () => (
<tr className={rowKey} key={rowKey} data-testid={`kie-tools--bee--expression-row-${rowIndex}`}>
<tr className={rowClassName} key={rowKey} data-testid={`kie-tools--bee--expression-row-${rowIndex}`}>
{row.cells.map((cell, cellIndex) => {
const columnKey = getColumnKey(reactTableInstance.allColumns[cellIndex]);
const isColumnToRender =
(cell.column.isRowIndexColumn && shouldRenderRowIndexColumn) || !cell.column.isRowIndexColumn;
if (evaluationHitsCountBadgeColumnIndex === -1 && isColumnToRender) {
// We store the index of the first column in the row
// We show evaluation hits count badge in this column
evaluationHitsCountBadgeColumnIndex = cellIndex;
}
const canDisplayEvaluationHitsCountBadge =
canDisplayEvaluationHitsCountRowOverlay && cellIndex === evaluationHitsCountBadgeColumnIndex;
return (
<React.Fragment key={columnKey}>
{((cell.column.isRowIndexColumn && shouldRenderRowIndexColumn) || !cell.column.isRowIndexColumn) && (
{isColumnToRender && (
<BeeTableTd<R>
resizerStopBehavior={resizerStopBehavior}
shouldShowRowsInlineControls={shouldShowRowsInlineControls}
Expand All @@ -104,6 +126,8 @@ export function BeeTableBody<R extends object>({
cellIndex === reactTableInstance.allColumns.length - 1 ? lastColumnMinWidth : undefined
}
isReadOnly={isReadOnly}
canDisplayEvaluationHitsCountBadge={canDisplayEvaluationHitsCountBadge}
evaluationHitsCount={rowEvaluationHitsCount}
/>
)}
</React.Fragment>
Expand All @@ -114,8 +138,6 @@ export function BeeTableBody<R extends object>({

const RowWrapper = rowWrapper;

const rowKey = getRowKey(row);

return (
<React.Fragment key={rowKey}>
{RowWrapper ? (
Expand All @@ -129,6 +151,8 @@ export function BeeTableBody<R extends object>({
);
},
[
evaluationHitsCountById,
supportsEvaluationHitsCount,
reactTableInstance,
rowWrapper,
getRowKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export interface BeeTableTdProps<R extends object> {
onDataCellClick?: (columnID: string) => void;
onDataCellKeyUp?: (columnID: string) => void;
isReadOnly: boolean;
/** True means the table cell can display evaluation hits count. False means evaluation hits count is not displayed in the table cell. */
canDisplayEvaluationHitsCountBadge?: boolean;
/** Actuall evaluation hits count number that will be displayed in the table cell if 'canDisplayEvaluationHitsCountBadge' is set to true. */
evaluationHitsCount?: number;
}

export type HoverInfo =
Expand All @@ -73,6 +77,8 @@ export function BeeTableTd<R extends object>({
onDataCellClick,
onDataCellKeyUp,
isReadOnly,
canDisplayEvaluationHitsCountBadge,
evaluationHitsCount,
}: BeeTableTdProps<R>) {
const [isResizing, setResizing] = useState(false);
const [hoverInfo, setHoverInfo] = useState<HoverInfo>({ isHovered: false });
Expand Down Expand Up @@ -225,6 +231,14 @@ export function BeeTableTd<R extends object>({
return onDataCellKeyUp?.(column.id);
}, [column.id, onDataCellKeyUp]);

const evaluationHitsCountBadgeClassName = useMemo(() => {
return canDisplayEvaluationHitsCountBadge
? (evaluationHitsCount ?? 0) > 0
? "evaluation-hits-count-badge-colored"
: "evaluation-hits-count-badge-non-colored"
: "";
}, [canDisplayEvaluationHitsCountBadge, evaluationHitsCount]);

return (
<BeeTableCoordinatesContextProvider coordinates={coordinates}>
<td
Expand All @@ -246,9 +260,11 @@ export function BeeTableTd<R extends object>({
}}
>
{column.isRowIndexColumn ? (
<>{rowIndexLabel}</>
<div className={evaluationHitsCountBadgeClassName} data-evaluation-hits-count={evaluationHitsCount}>
{rowIndexLabel}
</div>
) : (
<>
<div className={evaluationHitsCountBadgeClassName} data-evaluation-hits-count={evaluationHitsCount}>
{tdContent}

{!isReadOnly && shouldRenderResizer && (
Expand All @@ -262,7 +278,7 @@ export function BeeTableTd<R extends object>({
setResizing={setResizing}
/>
)}
</>
</div>
)}

{!isReadOnly &&
Expand Down
Loading
Loading