mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
refactor(editor): Refactor nodeHelpers mixin to composable (#7810)
- Convert `nodeHelpers` mixin into composable and fix types - Replace usage of the mixin with the new composable - Add missing store imports in components that were dependent on opaque imports from nodeHelpers mixin - Refactor the `CollectionParameter` component to the modern script setup syntax Github issue / Community forum post (link here to close automatically): --------- Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -118,7 +118,7 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { genericHelpers } from '@/mixins/genericHelpers';
|
||||
import { nodeHelpers } from '@/mixins/nodeHelpers';
|
||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
|
||||
import TitledList from '@/components/TitledList.vue';
|
||||
@@ -144,7 +144,7 @@ interface CredentialDropdownOption extends ICredentialsResponse {
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NodeCredentials',
|
||||
mixins: [genericHelpers, nodeHelpers],
|
||||
mixins: [genericHelpers],
|
||||
props: {
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
@@ -170,8 +170,11 @@ export default defineComponent({
|
||||
TitledList,
|
||||
},
|
||||
setup() {
|
||||
const nodeHelpers = useNodeHelpers();
|
||||
|
||||
return {
|
||||
...useToast(),
|
||||
nodeHelpers,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
@@ -291,8 +294,6 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
credentialTypesNodeDescription(): INodeCredentialDescription[] {
|
||||
const node = this.node;
|
||||
|
||||
const credType = this.credentialsStore.getCredentialTypeByName(this.overrideCredType);
|
||||
|
||||
if (credType) return [credType];
|
||||
@@ -433,7 +434,7 @@ export default defineComponent({
|
||||
this.$telemetry.track('User selected credential from node modal', {
|
||||
credential_type: credentialType,
|
||||
node_type: this.node.type,
|
||||
...(this.hasProxyAuth(this.node) ? { is_service_specific: true } : {}),
|
||||
...(this.nodeHelpers.hasProxyAuth(this.node) ? { is_service_specific: true } : {}),
|
||||
workflow_id: this.workflowsStore.workflowId,
|
||||
credential_id: credentialId,
|
||||
});
|
||||
@@ -461,7 +462,7 @@ export default defineComponent({
|
||||
invalid: oldCredentials,
|
||||
type: selectedCredentialsType,
|
||||
});
|
||||
this.updateNodesCredentialsIssues();
|
||||
this.nodeHelpers.updateNodesCredentialsIssues();
|
||||
this.showMessage({
|
||||
title: this.$locale.baseText('nodeCredentials.showMessage.title'),
|
||||
message: this.$locale.baseText('nodeCredentials.showMessage.message', {
|
||||
@@ -512,7 +513,12 @@ export default defineComponent({
|
||||
// If it is not defined no need to do a proper check
|
||||
return true;
|
||||
}
|
||||
return this.displayParameter(this.node.parameters, credentialTypeDescription, '', this.node);
|
||||
return this.nodeHelpers.displayParameter(
|
||||
this.node.parameters,
|
||||
credentialTypeDescription,
|
||||
'',
|
||||
this.node,
|
||||
);
|
||||
},
|
||||
|
||||
getIssues(credentialTypeName: string): string[] {
|
||||
|
||||
Reference in New Issue
Block a user