Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
f-dag-app add new group in same group if all elements are from same g…
Browse files Browse the repository at this point in the history
…roup
  • Loading branch information
vikas-cldcvr committed Jul 1, 2024
1 parent ae68978 commit 350dc13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/flow-lineage/src/components/f-dag/add-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ export function addSelectionToGroup(this: FDag, groupid: string) {
export function addToNewGroup(this: FDag) {
const groupIdInput = this.querySelector<FInput>("#new-group-id")!;
const groupLabelInput = this.querySelector<FInput>("#new-group-label")!;
const parentGroupIfAny = this.selectedNodes[0].group;

const isAllFromSameGroup = this.selectedNodes.every(sn => sn.group === parentGroupIfAny);
this.config.groups.push({
id: groupIdInput.value as string,
label: groupLabelInput.value as string,
icon: "i-org"
icon: "i-org",
group: isAllFromSameGroup && parentGroupIfAny ? parentGroupIfAny : undefined
});

this.addSelectionToGroup(groupIdInput.value as string);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export function updateNodePosition(this: FDag, event: MouseEvent) {
nodeLeft + nodeWidth < left + width
) {
insideGroup = true;
if (nodeElement.dataset.group !== group.getAttribute("id")) placedIn = group;
nodeElement.dataset.group = group.getAttribute("id")!;
placedIn = group;
}
}

Expand Down

0 comments on commit 350dc13

Please sign in to comment.