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 4 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
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -777,7 +776,15 @@ export function DecisionTableExpression({
});
}

const nextOutputColumns = [...(prev.output ?? [])];
const nextOutputColumns = [
...(prev.output ?? []).map((outputColumn, index) => {
const outputCopy = { ...outputColumn };
if (outputCopy["@_name"] == null) {
Kusuma04-dev marked this conversation as resolved.
Show resolved Hide resolved
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -172,18 +171,21 @@ 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
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}
Expand Down
Loading