mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(editor): Fix 0 items
labels on new canvas (no-changelog) (#11344)
This commit is contained in:
parent
5fae187a0a
commit
f98f0ead25
|
@ -31,6 +31,7 @@ onEdgeMouseEnter(({ edge }) => {
|
|||
if (edge.id !== props.id) return;
|
||||
isHovered.value = true;
|
||||
});
|
||||
|
||||
onEdgeMouseLeave(({ edge }) => {
|
||||
if (edge.id !== props.id) return;
|
||||
isHovered.value = false;
|
||||
|
|
|
@ -64,7 +64,7 @@ describe('CanvasHandleMainOutput', () => {
|
|||
expect(getByText('1 item')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render run data label if output label is available', async () => {
|
||||
it('should render run data label even if output label is available', async () => {
|
||||
const runData = {
|
||||
total: 1,
|
||||
iterations: 1,
|
||||
|
@ -77,7 +77,22 @@ describe('CanvasHandleMainOutput', () => {
|
|||
},
|
||||
});
|
||||
|
||||
expect(() => getByText('1 item')).toThrow();
|
||||
expect(getByText('1 item')).toBeInTheDocument();
|
||||
expect(getByText('Output')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render run data label if handle is connected', async () => {
|
||||
const runData = {
|
||||
total: 1,
|
||||
iterations: 1,
|
||||
};
|
||||
const { queryByText } = renderComponent({
|
||||
global: {
|
||||
provide: {
|
||||
...createCanvasHandleProvide({ label: '', runData, isConnected: true }),
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(queryByText('1 item')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ const renderOptions = computed(() => render.value.options as CanvasNodeDefaultRe
|
|||
const runDataTotal = computed(() => runData.value?.total ?? 0);
|
||||
|
||||
const runDataLabel = computed(() =>
|
||||
runData.value
|
||||
!isConnected.value && runData.value && runData.value.total > 0
|
||||
? i18n.baseText('ndv.output.items', {
|
||||
adjustToNumber: runData.value.total,
|
||||
interpolate: { count: String(runData.value.total) },
|
||||
|
@ -77,7 +77,7 @@ function onClickAdd() {
|
|||
<template>
|
||||
<div :class="classes">
|
||||
<div v-if="label" :class="outputLabelClasses">{{ label }}</div>
|
||||
<div v-else-if="runData" :class="runDataLabelClasses">{{ runDataLabel }}</div>
|
||||
<div v-if="runData" :class="runDataLabelClasses">{{ runDataLabel }}</div>
|
||||
<CanvasHandleDot :handle-classes="handleClasses" />
|
||||
<Transition name="canvas-node-handle-main-output">
|
||||
<CanvasHandlePlus
|
||||
|
|
|
@ -555,19 +555,23 @@ export function useCanvasMapping({
|
|||
|
||||
if (nodePinnedDataById.value[fromNode.id]) {
|
||||
const pinnedDataCount = nodePinnedDataById.value[fromNode.id]?.length ?? 0;
|
||||
return i18n.baseText('ndv.output.items', {
|
||||
adjustToNumber: pinnedDataCount,
|
||||
interpolate: { count: String(pinnedDataCount) },
|
||||
});
|
||||
return pinnedDataCount > 0
|
||||
? i18n.baseText('ndv.output.items', {
|
||||
adjustToNumber: pinnedDataCount,
|
||||
interpolate: { count: String(pinnedDataCount) },
|
||||
})
|
||||
: '';
|
||||
} else if (nodeExecutionRunDataById.value[fromNode.id]) {
|
||||
const { type, index } = parseCanvasConnectionHandleString(connection.sourceHandle);
|
||||
const runDataTotal =
|
||||
nodeExecutionRunDataOutputMapById.value[fromNode.id]?.[type]?.[index]?.total ?? 0;
|
||||
|
||||
return i18n.baseText('ndv.output.items', {
|
||||
adjustToNumber: runDataTotal,
|
||||
interpolate: { count: String(runDataTotal) },
|
||||
});
|
||||
return runDataTotal > 0
|
||||
? i18n.baseText('ndv.output.items', {
|
||||
adjustToNumber: runDataTotal,
|
||||
interpolate: { count: String(runDataTotal) },
|
||||
})
|
||||
: '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
Loading…
Reference in a new issue