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#1466: A Decision Table with a single output column shouldn't have a name #2834

Merged
merged 16 commits into from
Feb 3, 2025
Merged
Changes from 15 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
@@ -76,7 +76,6 @@ enum DecisionTableColumnType {
OutputClause = "output",
Annotation = "annotation",
}

export const DECISION_TABLE_INPUT_DEFAULT_VALUE = "-";
export const DECISION_TABLE_OUTPUT_DEFAULT_VALUE = "";
export const DECISION_TABLE_ANNOTATION_DEFAULT_VALUE = "";
@@ -777,7 +776,15 @@ export function DecisionTableExpression({
});
}

const nextOutputColumns = [...(prev.output ?? [])];
const nextOutputColumns = [
...(prev.output ?? []).map((outputColumn, index) => {
const outputCopy = { ...outputColumn };
if (outputCopy["@_name"] === undefined) {
outputCopy["@_name"] = `Output-${index + 1}`;
}
return outputCopy;
}),
];
for (/* Add new columns */ let i = 0; i < outputColumnsToAdd.length; i++) {
nextOutputColumns.splice(localIndexInsideGroup + i, 0, outputColumnsToAdd[i]);
}
@@ -895,11 +902,21 @@ export function DecisionTableExpression({
case DecisionTableColumnType.OutputClause:
const newOutputs = [...(prev.output ?? [])];
newOutputs.splice(localIndexInsideGroup, 1);

//Output name shouldn't be displayed when there is single output column(kie-issues#1466)
const updatedOutputForSingleOutputColumns = [
...(newOutputs ?? []).map((outputColumn) => {
const outputCopy = { ...outputColumn };
if (newOutputs.length === 1) {
outputCopy["@_name"] = undefined;
outputCopy["@_typeRef"] = undefined;
}
return outputCopy;
}),
];
// Do not inline this variable for type safety. See https://github.com/microsoft/TypeScript/issues/241
const retOutput: Normalized<BoxedDecisionTable> = {
...prev,
output: newOutputs,
output: updatedOutputForSingleOutputColumns,
rule: [...(prev.rule ?? [])].map((rule) => {
const newOutputEntry = [...rule.outputEntry];
newOutputEntry.splice(localIndexInsideGroup, 1);
Original file line number Diff line number Diff line change
@@ -230,7 +230,7 @@ export function getDefaultBoxedExpression({
return relationExpression;
} else if (logicType === "decisionTable") {
const singleOutputColumn = {
name: "Output-1",
name: undefined,
typeRef: dataType?.feelName,
};
const singleInputColumn = {
Original file line number Diff line number Diff line change
@@ -45,7 +45,6 @@ export function DecisionTableOutputHeaderCell(props: {
const activeDrgElementId = useDmnEditorStore((s) => s.boxedExpressionEditor.activeDrgElementId);
const { dmnEditorRootElementRef } = useDmnEditor();
const { externalModelsByNamespace } = useExternalModels();

const node = useDmnEditorStore((s) =>
s
.computed(s)
@@ -172,29 +171,35 @@ export function DecisionTableOutputHeaderCell(props: {
/>
</>
)}
<NameField
alternativeFieldName={root?.output.length === 1 ? "Column Name" : undefined}
isReadOnly={props.isReadOnly}
id={cell["@_id"]!}
name={cell?.["@_name"] ?? ""}
getAllUniqueNames={getAllUniqueNames}
onChange={(newName) =>
updater((dmnObject) => {
dmnObject["@_name"] = newName;
})
}
/>
<TypeRefField
alternativeFieldName={root?.output.length === 1 ? "Column Type" : undefined}
isReadOnly={cellMustHaveSameTypeAsRoot ? true : props.isReadOnly}
dmnEditorRootElementRef={dmnEditorRootElementRef}
typeRef={cellMustHaveSameTypeAsRoot ? root?.["@_typeRef"] : cell?.["@_typeRef"]}
onChange={(newTypeRef) =>
updater((dmnObject) => {
dmnObject["@_typeRef"] = newTypeRef;
})
}
/>
{root?.output && root.output.length > 1 ? (
<NameField
isReadOnly={props.isReadOnly}
id={cell["@_id"]!}
name={cell?.["@_name"] ?? ""}
getAllUniqueNames={getAllUniqueNames}
onChange={(newName) =>
updater((dmnObject) => {
dmnObject["@_name"] = newName;
})
}
/>
) : (
""
)}
{root?.output && root.output.length > 1 ? (
<TypeRefField
isReadOnly={cellMustHaveSameTypeAsRoot ? true : props.isReadOnly}
dmnEditorRootElementRef={dmnEditorRootElementRef}
typeRef={cellMustHaveSameTypeAsRoot ? root?.["@_typeRef"] : cell?.["@_typeRef"]}
onChange={(newTypeRef) =>
updater((dmnObject) => {
dmnObject["@_typeRef"] = newTypeRef;
})
}
/>
) : (
""
)}
{itemDefinition && (
<FormGroup label="Constraint">
<ConstraintsFromTypeConstraintAttribute
Loading

Unchanged files with check annotations Beta

await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP });
await decisionServicePropertiesPanel.open();
expect(await decisionServicePropertiesPanel.getOutputDecisions()).toEqual(["A"]);

Check failure on line 255 in packages/dmn-editor/tests-e2e/drgElements/modelDecisionService.spec.ts

GitHub Actions / run (ubuntu-latest, 2)

[webkit] › drgElements/modelDecisionService.spec.ts:259:11 › Model Decision Service › Model Decision Service - Signature › Model Decision Service - Signature - Decisions › Decision Service Decision Signature should not contain deleted Output Decision

1) [webkit] › drgElements/modelDecisionService.spec.ts:259:11 › Model Decision Service › Model Decision Service - Signature › Model Decision Service - Signature - Decisions › Decision Service Decision Signature should not contain deleted Output Decision Error: expect(received).toEqual(expected) // deep equality - Expected - 3 + Received + 1 - Array [ - "A", - ] + Array [] 253 | await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP }); 254 | await decisionServicePropertiesPanel.open(); > 255 | expect(await decisionServicePropertiesPanel.getOutputDecisions()).toEqual(["A"]); | ^ 256 | expect(await decisionServicePropertiesPanel.getEncapsulatedDecisions()).toEqual(["B"]); 257 | }); 258 | at /home/runner/work/incubator-kie-tools/incubator-kie-tools/packages/dmn-editor/tests-e2e/drgElements/modelDecisionService.spec.ts:255:75

Check failure on line 255 in packages/dmn-editor/tests-e2e/drgElements/modelDecisionService.spec.ts

GitHub Actions / run (ubuntu-latest, 2)

[webkit] › drgElements/modelDecisionService.spec.ts:272:11 › Model Decision Service › Model Decision Service - Signature › Model Decision Service - Signature - Decisions › Decision Service Decision Signature should not contain deleted Encapsulated Decision

2) [webkit] › drgElements/modelDecisionService.spec.ts:272:11 › Model Decision Service › Model Decision Service - Signature › Model Decision Service - Signature - Decisions › Decision Service Decision Signature should not contain deleted Encapsulated Decision Error: expect(received).toEqual(expected) // deep equality - Expected - 3 + Received + 1 - Array [ - "A", - ] + Array [] 253 | await nodes.select({ name: DefaultNodeName.DECISION_SERVICE, position: NodePosition.TOP }); 254 | await decisionServicePropertiesPanel.open(); > 255 | expect(await decisionServicePropertiesPanel.getOutputDecisions()).toEqual(["A"]); | ^ 256 | expect(await decisionServicePropertiesPanel.getEncapsulatedDecisions()).toEqual(["B"]); 257 | }); 258 | at /home/runner/work/incubator-kie-tools/incubator-kie-tools/packages/dmn-editor/tests-e2e/drgElements/modelDecisionService.spec.ts:255:75
expect(await decisionServicePropertiesPanel.getEncapsulatedDecisions()).toEqual(["B"]);
});
test.describe("Test scenario table context menu", () => {
test.describe("Context menu checks", () => {
test.beforeEach(async ({ editor, testScenarioTable, table }) => {

Check failure on line 28 in packages/scesim-editor/tests-e2e/scesimEditor/testScenarioTable/contextMenu.spec.ts

GitHub Actions / run (ubuntu-latest, 2)

[chromium] › scesimEditor/testScenarioTable/contextMenu.spec.ts:50:9 › Test scenario table context menu › Context menu checks › should render instance context menu

1) [chromium] › scesimEditor/testScenarioTable/contextMenu.spec.ts:50:9 › Test scenario table context menu › Context menu checks › should render instance context menu Test timeout of 60000ms exceeded while running "beforeEach" hook. 26 | test.describe("Test scenario table context menu", () => { 27 | test.describe("Context menu checks", () => { > 28 | test.beforeEach(async ({ editor, testScenarioTable, table }) => { | ^ 29 | await editor.createTestScenario(AssetType.RULE); 30 | await table.addRow({ targetCellName: "1", position: AddRowPosition.ABOVE }); 31 | await testScenarioTable.fill({ content: "test", rowLocatorInfo: "1", columnNumber: 1 }); at /home/runner/work/incubator-kie-tools/incubator-kie-tools/packages/scesim-editor/tests-e2e/scesimEditor/testScenarioTable/contextMenu.spec.ts:28:10
await editor.createTestScenario(AssetType.RULE);
await table.addRow({ targetCellName: "1", position: AddRowPosition.ABOVE });
await testScenarioTable.fill({ content: "test", rowLocatorInfo: "1", columnNumber: 1 });
await this.page.getByRole("cell", { name: args.targetCellName, exact: true }).click({ button: "right" });
args.position === AddRowPosition.BELOW
? await this.page.getByRole("menuitem", { name: "Insert Below" }).click()
: await this.page.getByRole("menuitem", { name: "Insert Above" }).click();

Check failure on line 44 in packages/scesim-editor/tests-e2e/__fixtures__/table.ts

GitHub Actions / run (ubuntu-latest, 2)

[chromium] › scesimEditor/testScenarioTable/contextMenu.spec.ts:50:9 › Test scenario table context menu › Context menu checks › should render instance context menu

1) [chromium] › scesimEditor/testScenarioTable/contextMenu.spec.ts:50:9 › Test scenario table context menu › Context menu checks › should render instance context menu Error: locator.click: Test timeout of 60000ms exceeded. Call log: - waiting for getByRole('menuitem', { name: 'Insert Above' }) at __fixtures__/table.ts:44 42 | args.position === AddRowPosition.BELOW 43 | ? await this.page.getByRole("menuitem", { name: "Insert Below" }).click() > 44 | : await this.page.getByRole("menuitem", { name: "Insert Above" }).click(); | ^ 45 | } 46 | 47 | public async addPropertyColumn(args: { targetCellName: string; position: AddColumnPosition; columnNumber: number }) { at Table.addRow (/home/runner/work/incubator-kie-tools/incubator-kie-tools/packages/scesim-editor/tests-e2e/__fixtures__/table.ts:44:73) at /home/runner/work/incubator-kie-tools/incubator-kie-tools/packages/scesim-editor/tests-e2e/scesimEditor/testScenarioTable/contextMenu.spec.ts:30:7
}
public async addPropertyColumn(args: { targetCellName: string; position: AddColumnPosition; columnNumber: number }) {
token: "",
insecurelyDisableTlsCertificateValidation: false,
});
}, []);

Check warning on line 176 in packages/online-editor/src/accounts/kubernetes/ConnectToLocalKubernetesClusterWizard.tsx

GitHub Actions / run (ubuntu-latest, 2)

React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect

Check warning on line 176 in packages/online-editor/src/accounts/kubernetes/ConnectToLocalKubernetesClusterWizard.tsx

GitHub Actions / run (macos-13, 2)

React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect

Check warning on line 176 in packages/online-editor/src/accounts/kubernetes/ConnectToLocalKubernetesClusterWizard.tsx

GitHub Actions / run (windows-latest, 2)

React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect
const isNamespaceValidated = useMemo(() => {
return isNamespaceValid(props.connection.namespace);