mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 13:39:44 +02:00
feat(core): Hide feature request link for nodes in canvas-only mode (no-changelog) (#35998)
This commit is contained in:
parent
284a9dbeef
commit
20e331c867
|
|
@ -14,6 +14,7 @@ import { NdvAgentConfigKey } from '@/features/ndv/agents/composables/useNdvAgent
|
|||
import type { UseNdvAgentConfigReturn } from '@/features/ndv/agents/composables/useNdvAgentConfig';
|
||||
import { useNDVStore } from '@/features/ndv/shared/ndv.store';
|
||||
import { useNodeTypesStore } from '@/app/stores/nodeTypes.store';
|
||||
import { useSettingsStore } from '@n8n/stores/settings.store';
|
||||
import { useWorkflowsStore } from '@/app/stores/workflows.store';
|
||||
import {
|
||||
createWorkflowDocumentId,
|
||||
|
|
@ -110,16 +111,26 @@ interface RenderOptions {
|
|||
nodeType?: INodeTypeDescription;
|
||||
provide?: Record<symbol, unknown>;
|
||||
stubs?: Record<string, unknown>;
|
||||
canvasOnly?: boolean;
|
||||
}
|
||||
|
||||
const renderNodeSettings = (options: RenderOptions = {}) => {
|
||||
const { runData, node = httpNode, nodeType = httpNodeType, provide = {}, stubs = {} } = options;
|
||||
const {
|
||||
runData,
|
||||
node = httpNode,
|
||||
nodeType = httpNodeType,
|
||||
provide = {},
|
||||
stubs = {},
|
||||
canvasOnly = false,
|
||||
} = options;
|
||||
const pinia = createTestingPinia({ stubActions: false });
|
||||
setActivePinia(pinia);
|
||||
|
||||
const workflow = createTestWorkflow({ nodes: [node], connections: {} });
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const nodeTypesStore = useNodeTypesStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
settingsStore.settings = { ...settingsStore.settings, canvasOnly };
|
||||
workflowsStore.setWorkflowId(workflow.id);
|
||||
const ndvStore = useNDVStore(createWorkflowDocumentId(workflow.id));
|
||||
const workflowDocumentStore = useWorkflowDocumentStore(createWorkflowDocumentId(workflow.id));
|
||||
|
|
@ -231,6 +242,21 @@ describe('NodeSettings', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('feature request link', () => {
|
||||
it('renders the feature request link by default', async () => {
|
||||
const { findByTestId } = renderNodeSettings({});
|
||||
|
||||
expect(await findByTestId('node-feature-request')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hides the feature request link when in canvas-only mode', async () => {
|
||||
const { findByTestId, queryByTestId } = renderNodeSettings({ canvasOnly: true });
|
||||
|
||||
await findByTestId('tab-params');
|
||||
expect(queryByTestId('node-feature-request')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('AI Agent node surfaces', () => {
|
||||
// The children are stubbed, so NodeSettings only checks the facade's
|
||||
// presence + mode. A missing `mode` resolves to referenced.
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ const credentialOwnerName = computed(() => {
|
|||
});
|
||||
|
||||
const featureRequestUrl = computed(() => {
|
||||
if (!nodeType.value) {
|
||||
if (!nodeType.value || settingsStore.isCanvasOnly) {
|
||||
return '';
|
||||
}
|
||||
return `${BASE_NODE_SURVEY_URL}${nodeType.value.name}`;
|
||||
|
|
@ -845,7 +845,11 @@ function handleSelectAction(params: INodeParameters) {
|
|||
<span>({{ nodeVersionTag }})</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="featureRequestUrl && !isEmbeddedInCanvas" :class="$style.featureRequest">
|
||||
<div
|
||||
v-if="featureRequestUrl && !isEmbeddedInCanvas"
|
||||
data-test-id="node-feature-request"
|
||||
:class="$style.featureRequest"
|
||||
>
|
||||
<a target="_blank" @click="onFeatureRequestClick">
|
||||
<N8nIcon icon="lightbulb" />
|
||||
{{ i18n.baseText('ndv.featureRequest') }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user