mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Consolidate HTTPRN check
This commit is contained in:
parent
2eaf05ea21
commit
fec2fc1b08
|
@ -77,7 +77,6 @@ import { showMessage } from '@/components/mixins/showMessage';
|
|||
import { mapGetters } from "vuex";
|
||||
|
||||
import mixins from 'vue-typed-mixins';
|
||||
import { HTTP_REQUEST_NODE_TYPE } from '@/constants';
|
||||
|
||||
export default mixins(
|
||||
genericHelpers,
|
||||
|
@ -101,14 +100,12 @@ export default mixins(
|
|||
getCredentialTypeByName: 'getCredentialTypeByName',
|
||||
}),
|
||||
isProxyAuth(): boolean {
|
||||
return this.node.type === HTTP_REQUEST_NODE_TYPE
|
||||
&& this.node.typeVersion === 2
|
||||
&& this.node.parameters.authenticateWith === 'nodeCredential';
|
||||
return this.isHttpRequestNodeV2(this.node) &&
|
||||
this.node.parameters.authenticateWith === 'nodeCredential';
|
||||
},
|
||||
isGenericAuth(): boolean {
|
||||
return this.node.type === HTTP_REQUEST_NODE_TYPE
|
||||
&& this.node.typeVersion === 2
|
||||
&& this.node.parameters.authenticateWith === 'genericAuth';
|
||||
return this.isHttpRequestNodeV2(this.node) &&
|
||||
this.node.parameters.authenticateWith === 'genericAuth';
|
||||
},
|
||||
credentialTypesNode (): string[] {
|
||||
return this.credentialTypesNodeDescription
|
||||
|
|
|
@ -134,9 +134,7 @@ export default mixins(
|
|||
return this.$store.getters.activeNode;
|
||||
},
|
||||
indexToShowSlotAt (): number {
|
||||
if (this.node.type === HTTP_REQUEST_NODE_TYPE && this.node.typeVersion === 2) {
|
||||
return 2;
|
||||
}
|
||||
if (this.isHttpRequestNodeV2(this.node)) return 2;
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
|
|
@ -43,6 +43,9 @@ export const nodeHelpers = mixins(
|
|||
...mapGetters('credentials', [ 'getCredentialTypeByName', 'getCredentialsByType' ]),
|
||||
},
|
||||
methods: {
|
||||
isHttpRequestNodeV2 (node: INodeUi): boolean {
|
||||
return node.type === HTTP_REQUEST_NODE_TYPE && node.typeVersion === 2;
|
||||
},
|
||||
|
||||
// Returns the parameter value
|
||||
getParameterValue (nodeValues: INodeParameters, parameterName: string, path: string) {
|
||||
|
@ -211,7 +214,7 @@ export const nodeHelpers = mixins(
|
|||
};
|
||||
|
||||
if (
|
||||
isHttpRequestNodeV2(node) &&
|
||||
this.isHttpRequestNodeV2(node) &&
|
||||
authenticateWith === 'genericAuth' &&
|
||||
selectedCredsAreUnusable(node, genericAuthType)
|
||||
) {
|
||||
|
@ -220,7 +223,7 @@ export const nodeHelpers = mixins(
|
|||
}
|
||||
|
||||
if (
|
||||
isHttpRequestNodeV2(node) &&
|
||||
this.isHttpRequestNodeV2(node) &&
|
||||
authenticateWith === 'nodeCredential' &&
|
||||
nodeCredentialType !== '' &&
|
||||
node.credentials !== undefined
|
||||
|
@ -234,7 +237,7 @@ export const nodeHelpers = mixins(
|
|||
}
|
||||
|
||||
if (
|
||||
isHttpRequestNodeV2(node) &&
|
||||
this.isHttpRequestNodeV2(node) &&
|
||||
authenticateWith === 'nodeCredential' &&
|
||||
nodeCredentialType !== '' &&
|
||||
selectedCredsAreUnusable(node, nodeCredentialType)
|
||||
|
@ -440,10 +443,6 @@ export const nodeHelpers = mixins(
|
|||
},
|
||||
});
|
||||
|
||||
function isHttpRequestNodeV2(node: INodeUi) {
|
||||
return node.type === HTTP_REQUEST_NODE_TYPE && node.typeVersion === 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the node has no selected credentials, or none of the node's
|
||||
* selected credentials are of the specified type.
|
||||
|
|
|
@ -327,13 +327,11 @@ export const workflowHelpers = mixins(
|
|||
const nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, node.parameters, false, false, node);
|
||||
nodeData.parameters = nodeParameters !== null ? nodeParameters : {};
|
||||
|
||||
const fullAccess = node.type === HTTP_REQUEST_NODE_TYPE && node.typeVersion === 2;
|
||||
|
||||
// Add the node credentials if there are some set and if they should be displayed
|
||||
if (node.credentials !== undefined && nodeType.credentials !== undefined) {
|
||||
const saveCredenetials: INodeCredentials = {};
|
||||
for (const nodeCredentialTypeName of Object.keys(node.credentials)) {
|
||||
if (fullAccess) {
|
||||
if (this.isHttpRequestNodeV2(node)) {
|
||||
saveCredenetials[nodeCredentialTypeName] = node.credentials[nodeCredentialTypeName];
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue