feat(editor): Add Info Note to NDV Output Panel if no existing Tools were used during Execution (#11672)

This commit is contained in:
Charlie Kolb
2024-11-19 13:11:12 +01:00
committed by GitHub
parent e298ebe90d
commit de0e86150f
6 changed files with 145 additions and 1 deletions

View File

@@ -1,6 +1,12 @@
<script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue';
import type { IRunData, IRunExecutionData, NodeError, Workflow } from 'n8n-workflow';
import {
NodeConnectionType,
type IRunData,
type IRunExecutionData,
type NodeError,
type Workflow,
} from 'n8n-workflow';
import RunData from './RunData.vue';
import RunInfo from './RunInfo.vue';
import { storeToRefs } from 'pinia';
@@ -209,6 +215,29 @@ const canPinData = computed(() => {
return pinnedData.isValidNodeType.value && !props.isReadOnly;
});
const allToolsWereUnusedNotice = computed(() => {
if (!node.value || runsCount.value === 0) return undefined;
// With pinned data there's no clear correct answer for whether
// we should use historic or current parents, so we don't show the notice,
// as it likely ends up unactionable noise to the user
if (pinnedData.hasData.value) return undefined;
const toolsAvailable = props.workflow.getParentNodes(
node.value.name,
NodeConnectionType.AiTool,
1,
);
const toolsUsedInLatestRun = toolsAvailable.filter(
(tool) => !!workflowRunData.value?.[tool]?.[props.runIndex],
);
if (toolsAvailable.length > 0 && toolsUsedInLatestRun.length === 0) {
return i18n.baseText('ndv.output.noToolUsedInfo');
} else {
return undefined;
}
});
// Methods
const insertTestData = () => {
@@ -298,6 +327,7 @@ const activatePane = () => {
:hide-pagination="outputMode === 'logs'"
pane-type="output"
:data-output-type="outputMode"
:callout-message="allToolsWereUnusedNotice"
@activate-pane="activatePane"
@run-change="onRunIndexChange"
@link-run="onLinkRun"