mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(core): Node hints(warnings) system (#8954)
This commit is contained in:
@@ -152,6 +152,15 @@
|
||||
</div>
|
||||
<slot name="before-data" />
|
||||
|
||||
<n8n-callout
|
||||
v-for="hint in getNodeHints()"
|
||||
:key="hint.message"
|
||||
:class="$style.hintCallout"
|
||||
:theme="hint.type || 'info'"
|
||||
>
|
||||
<n8n-text v-html="hint.message" size="small"></n8n-text>
|
||||
</n8n-callout>
|
||||
|
||||
<div
|
||||
v-if="maxOutputIndex > 0 && branches.length > 1"
|
||||
:class="$style.tabs"
|
||||
@@ -557,6 +566,7 @@ import type {
|
||||
INodeTypeDescription,
|
||||
IRunData,
|
||||
IRunExecutionData,
|
||||
NodeHint,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeHelpers, NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
@@ -824,6 +834,15 @@ export default defineComponent({
|
||||
hasRunError(): boolean {
|
||||
return Boolean(this.node && this.workflowRunData?.[this.node.name]?.[this.runIndex]?.error);
|
||||
},
|
||||
executionHints(): NodeHint[] {
|
||||
if (this.hasNodeRun) {
|
||||
const hints = this.node && this.workflowRunData?.[this.node.name]?.[this.runIndex]?.hints;
|
||||
|
||||
if (hints) return hints;
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
workflowExecution(): IExecutionResponse | null {
|
||||
return this.workflowsStore.getWorkflowExecution;
|
||||
},
|
||||
@@ -1083,6 +1102,46 @@ export default defineComponent({
|
||||
}
|
||||
return [];
|
||||
},
|
||||
shouldHintBeDisplayed(hint: NodeHint): boolean {
|
||||
const { location, whenToDisplay } = hint;
|
||||
if (location) {
|
||||
if (location === 'ndv') {
|
||||
return true;
|
||||
}
|
||||
if (location === 'inputPane' && this.paneType === 'input') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (location === 'outputPane' && this.paneType === 'output') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (whenToDisplay === 'afterExecution' && !this.hasNodeRun) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (whenToDisplay === 'beforeExecution' && this.hasNodeRun) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
getNodeHints(): NodeHint[] {
|
||||
if (this.node && this.nodeType) {
|
||||
const workflow = this.workflowsStore.getCurrentWorkflow();
|
||||
const workflowNode = workflow.getNode(this.node.name);
|
||||
|
||||
if (workflowNode) {
|
||||
const executionHints = this.executionHints;
|
||||
const nodeHints = NodeHelpers.getNodeHints(workflow, workflowNode, this.nodeType);
|
||||
return executionHints.concat(nodeHints).filter(this.shouldHintBeDisplayed);
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
onItemHover(itemIndex: number | null) {
|
||||
if (itemIndex === null) {
|
||||
this.$emit('itemHover', null);
|
||||
@@ -1788,6 +1847,12 @@ export default defineComponent({
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.hintCallout {
|
||||
margin-bottom: var(--spacing-xs);
|
||||
margin-left: var(--spacing-s);
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user