fix(editor): Schema view shows checkbox in case of empty data (#4889)

* fix(editor): Schema view show nothing in case of empty data

* fix(editor): Schema view test for empty data
This commit is contained in:
Csaba Tuncsik
2022-12-12 10:08:29 +01:00
committed by GitHub
parent 07b2f7678c
commit b0c158c64f
4 changed files with 75 additions and 49 deletions

View File

@@ -8,7 +8,7 @@ import { useWebhooksStore } from "@/stores/webhooks";
import { runExternalHook } from "@/mixins/externalHooks";
import { telemetry } from "@/plugins/telemetry";
import { IDataObject } from "n8n-workflow";
import { getSchema, mergeDeep } from "@/utils";
import { getSchema, isEmpty, mergeDeep } from "@/utils";
type Props = {
data: IDataObject[]
@@ -32,6 +32,10 @@ const schema = computed<Schema>(() => {
return getSchema(mergeDeep([head, ...tail, head]));
});
const isDataEmpty = computed(() => {
return isEmpty(props.data);
});
const onDragStart = (el: HTMLElement) => {
if (el && el.dataset?.path) {
draggingPath.value = el.dataset.path;
@@ -67,7 +71,9 @@ const onDragEnd = (el: HTMLElement) => {
<template>
<div :class="$style.schemaWrapper">
<div v-if="isDataEmpty" />
<draggable
v-else
type="mapping"
targetDataKey="mappable"
:disabled="!mappingEnabled"