Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ playground/
*.mp4
.turbo
styles.css
.aider*
.aider*
19 changes: 18 additions & 1 deletion src/ui/src/builder/sidebar/BuilderSidebarComponentTreeBranch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@
:disable-collapse="COMPONENT_TYPES_ROOT.has(component.type)"
:no-nested-space="COMPONENT_TYPES_ROOT.has(component.type)"
:collapsed="isOutsideActivePage"
:right-click-options="rightClickDropdownOptions"
:dropdown-options="
component?.type === 'blueprints_blueprint' &&
isDeleteAllowed(props.componentId)
? rightClickDropdownOptions
: undefined
"
@select="select"
@dropdown-select="handleDropdownSelect($event, key)"
@dragover="handleDragOver"
@dragstart="handleDragStart"
@dragend="handleDragEnd"
Expand Down Expand Up @@ -83,6 +91,7 @@
COMPONENT_TYPES_TOP_LEVEL,
} from "@/constants/component";
import WdsIcon from "@/wds/WdsIcon.vue";
import type { WdsDropdownMenuOption } from "@/wds/WdsDropdownMenu.vue";

const props = defineProps({
componentId: { type: String, required: true },
Expand All @@ -91,6 +100,9 @@

const treeBranch = ref<ComponentPublicInstance<typeof BuilderTree>>();

const rightClickDropdownOptions: WdsDropdownMenuOption[] = [
{ label: "Delete", value: "delete", icon: "trash-2" },
];
const wf = inject(injectionKeys.core);
const wfbm = inject(injectionKeys.builderManager);
const selected = computed(() => wfbm.isComponentIdSelected(props.componentId));
Expand All @@ -101,11 +113,12 @@
moveComponent,
goToComponentParentPage,
isDraggingAllowed,
isDeleteAllowed,
} = useComponentActions(wf, wfbm, tracking);
const { getComponentInfoFromDrag, removeInsertionCandidacy, isParentSuitable } =
useDragDropComponent(wf);
const { isComponentVisible } = useEvaluator(wf);
const emit = defineEmits(["expandBranch"]);
const emits = defineEmits(["expandBranch", "delete"]);

const q = computed(() => props.query?.toLocaleLowerCase() ?? "");

Expand Down Expand Up @@ -145,7 +158,7 @@
function expand() {
if (!treeBranch.value) return;
treeBranch.value.expand();
emit("expandBranch");

Check failure on line 161 in src/ui/src/builder/sidebar/BuilderSidebarComponentTreeBranch.vue

View workflow job for this annotation

GitHub Actions / build (3.11)

'emit' is not defined

Check failure on line 161 in src/ui/src/builder/sidebar/BuilderSidebarComponentTreeBranch.vue

View workflow job for this annotation

GitHub Actions / build (3.13)

'emit' is not defined

Check failure on line 161 in src/ui/src/builder/sidebar/BuilderSidebarComponentTreeBranch.vue

View workflow job for this annotation

GitHub Actions / build (3.12)

'emit' is not defined

Check failure on line 161 in src/ui/src/builder/sidebar/BuilderSidebarComponentTreeBranch.vue

View workflow job for this annotation

GitHub Actions / build (3.10)

'emit' is not defined
}

function scrollToShow() {
Expand Down Expand Up @@ -201,6 +214,10 @@
removeInsertionCandidacy(ev);
}

function handleDropdownSelect(action: string, key: string) {
if (action === "delete") emits("delete", key);
}

const isOutsideActivePage = computed(() => {
if (!wf.activePageId.value) return false;

Expand Down
Loading