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
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
decisio table with single ouput shouldn't have name
  • Loading branch information
chinnamatli kusumalatha authored and chinnamatli kusumalatha committed Jan 7, 2025
commit 020e6cd617259d2892bff9384159e969af1212f7
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ enum DecisionTableColumnType {
OutputClause = "output",
Annotation = "annotation",
}
const singleOutputColumn = {
name: "Output-1",
};
export const DECISION_TABLE_INPUT_DEFAULT_VALUE = "-";
export const DECISION_TABLE_OUTPUT_DEFAULT_VALUE = "";
export const DECISION_TABLE_ANNOTATION_DEFAULT_VALUE = "";
Expand Down Expand Up @@ -354,8 +351,8 @@ export function DecisionTableExpression({
id: outputClause["@_id"],
label:
decisionTableExpression.output?.length == 1
? ""
: outputClause["@_name"] ?? outputClause["@_label"] ?? singleOutputColumn.name,
? decisionTableExpression["@_label"] ?? DEFAULT_EXPRESSION_VARIABLE_NAME
: outputClause["@_name"] ?? outputClause["@_label"] ?? DEFAULT_EXPRESSION_VARIABLE_NAME,
dataType:
decisionTableExpression.output?.length == 1
? decisionTableExpression["@_typeRef"] ?? DmnBuiltInDataType.Undefined
Expand Down Expand Up @@ -779,7 +776,15 @@ export function DecisionTableExpression({
});
}

const nextOutputColumns = [...(prev.output ?? [])];
const nextOutputColumns = [
...(prev.output ?? []).map((outputColumn, index) => {
const outputCopy = { ...outputColumn };
if (outputCopy["@_name"] == null) {
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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -277,15 +277,7 @@ export function getDefaultBoxedExpression({
"@_typeRef": typeRef,
"@_hitPolicy": "UNIQUE",
input,
output: output.map((out) => {
if (output.length > 1) {
return {
...out,
};
} else {
return { ...out, "@_name": undefined };
}
}),
output,
annotation: [
{
"@_name": "Annotations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ export function DecisionTableOutputHeaderCell(props: {
)}
{root?.output && root.output.length > 1 ? (
<NameField
alternativeFieldName={undefined}
isReadOnly={props.isReadOnly}
id={cell["@_id"]!}
name={cell?.["@_name"] ?? singleOutputColumn.name}
name={cell?.["@_name"] ?? ""}
getAllUniqueNames={getAllUniqueNames}
onChange={(newName) =>
updater((dmnObject) => {
Expand Down
Loading