mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix: Show Ask AI only on Code Node (#6336)
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
<div ref="codeNodeEditor" class="code-node-editor-input ph-no-capture"></div>
|
<div ref="codeNodeEditor" class="code-node-editor-input ph-no-capture"></div>
|
||||||
<n8n-button
|
<n8n-button
|
||||||
v-if="isCloud && (isEditorHovered || isEditorFocused)"
|
v-if="aiButtonEnabled && (isEditorHovered || isEditorFocused)"
|
||||||
size="small"
|
size="small"
|
||||||
type="tertiary"
|
type="tertiary"
|
||||||
:class="$style['ask-ai-button']"
|
:class="$style['ask-ai-button']"
|
||||||
@@ -38,7 +38,6 @@ import { workflowHelpers } from '@/mixins/workflowHelpers'; // for json field co
|
|||||||
import { ASK_AI_MODAL_KEY, CODE_NODE_TYPE } from '@/constants';
|
import { ASK_AI_MODAL_KEY, CODE_NODE_TYPE } from '@/constants';
|
||||||
import { codeNodeEditorEventBus } from '@/event-bus';
|
import { codeNodeEditorEventBus } from '@/event-bus';
|
||||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||||
import { useSettingsStore } from '@/stores/settings.store';
|
|
||||||
|
|
||||||
import { readOnlyEditorExtensions, writableEditorExtensions } from './baseExtensions';
|
import { readOnlyEditorExtensions, writableEditorExtensions } from './baseExtensions';
|
||||||
import { CODE_PLACEHOLDERS } from './constants';
|
import { CODE_PLACEHOLDERS } from './constants';
|
||||||
@@ -50,6 +49,10 @@ export default defineComponent({
|
|||||||
name: 'code-node-editor',
|
name: 'code-node-editor',
|
||||||
mixins: [linterExtension, completerExtension, workflowHelpers],
|
mixins: [linterExtension, completerExtension, workflowHelpers],
|
||||||
props: {
|
props: {
|
||||||
|
aiButtonEnabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
mode: {
|
mode: {
|
||||||
type: String as PropType<CodeExecutionMode>,
|
type: String as PropType<CodeExecutionMode>,
|
||||||
validator: (value: CodeExecutionMode): boolean => CODE_EXECUTION_MODES.includes(value),
|
validator: (value: CodeExecutionMode): boolean => CODE_EXECUTION_MODES.includes(value),
|
||||||
@@ -97,9 +100,6 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useRootStore),
|
...mapStores(useRootStore),
|
||||||
isCloud() {
|
|
||||||
return useSettingsStore().deploymentType === 'cloud';
|
|
||||||
},
|
|
||||||
content(): string {
|
content(): string {
|
||||||
if (!this.editor) return '';
|
if (!this.editor) return '';
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@
|
|||||||
:defaultValue="parameter.default"
|
:defaultValue="parameter.default"
|
||||||
:language="editorLanguage"
|
:language="editorLanguage"
|
||||||
:isReadOnly="isReadOnly"
|
:isReadOnly="isReadOnly"
|
||||||
|
:aiButtonEnabled="settingsStore.isCloudDeployment"
|
||||||
@valueChanged="valueChangedDebounced"
|
@valueChanged="valueChangedDebounced"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -387,6 +388,7 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
|
|||||||
import { useNDVStore } from '@/stores/ndv.store';
|
import { useNDVStore } from '@/stores/ndv.store';
|
||||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||||
import { useCredentialsStore } from '@/stores/credentials.store';
|
import { useCredentialsStore } from '@/stores/credentials.store';
|
||||||
|
import { useSettingsStore } from '@/stores/settings.store';
|
||||||
import { htmlEditorEventBus } from '@/event-bus';
|
import { htmlEditorEventBus } from '@/event-bus';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
@@ -519,7 +521,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useCredentialsStore, useNodeTypesStore, useNDVStore, useWorkflowsStore),
|
...mapStores(
|
||||||
|
useCredentialsStore,
|
||||||
|
useNodeTypesStore,
|
||||||
|
useNDVStore,
|
||||||
|
useWorkflowsStore,
|
||||||
|
useSettingsStore,
|
||||||
|
),
|
||||||
expressionDisplayValue(): string {
|
expressionDisplayValue(): string {
|
||||||
if (this.forceShowExpression) {
|
if (this.forceShowExpression) {
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
Reference in New Issue
Block a user