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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ 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 @@ -352,8 +354,8 @@ export function DecisionTableExpression({
id: outputClause["@_id"],
label:
decisionTableExpression.output?.length == 1
? decisionTableExpression["@_label"] ?? DEFAULT_EXPRESSION_VARIABLE_NAME
: outputClause["@_name"] ?? outputClause["@_label"] ?? DEFAULT_EXPRESSION_VARIABLE_NAME,
? ""
: outputClause["@_name"] ?? outputClause["@_label"] ?? singleOutputColumn.name,
dataType:
decisionTableExpression.output?.length == 1
? decisionTableExpression["@_typeRef"] ?? DmnBuiltInDataType.Undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,15 @@ export function getDefaultBoxedExpression({
"@_typeRef": typeRef,
"@_hitPolicy": "UNIQUE",
input,
output,
output: output.map((out) => {
if (output.length > 1) {
return {
...out,
};
} else {
return { ...out, "@_name": undefined };
}
}),
annotation: [
{
"@_name": "Annotations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export function DecisionTableOutputHeaderCell(props: {
const activeDrgElementId = useDmnEditorStore((s) => s.boxedExpressionEditor.activeDrgElementId);
const { dmnEditorRootElementRef } = useDmnEditor();
const { externalModelsByNamespace } = useExternalModels();

const singleOutputColumn = {
name: "Output-1",
};
const node = useDmnEditorStore((s) =>
s
.computed(s)
Expand Down Expand Up @@ -172,18 +174,22 @@ 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;
})
}
/>
{root?.output && root.output.length > 1 ? (
<NameField
alternativeFieldName={undefined}
isReadOnly={props.isReadOnly}
id={cell["@_id"]!}
name={cell?.["@_name"] ?? singleOutputColumn.name}
getAllUniqueNames={getAllUniqueNames}
onChange={(newName) =>
updater((dmnObject) => {
dmnObject["@_name"] = newName;
})
}
/>
) : (
""
)}
<TypeRefField
alternativeFieldName={root?.output.length === 1 ? "Column Type" : undefined}
isReadOnly={cellMustHaveSameTypeAsRoot ? true : props.isReadOnly}
Expand Down
Loading