mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Detect active credential type
This commit is contained in:
parent
4997569eb2
commit
64e08c8fdd
|
@ -145,6 +145,7 @@ export interface INodeUi extends INode {
|
||||||
notes?: string;
|
notes?: string;
|
||||||
issues?: INodeIssues;
|
issues?: INodeIssues;
|
||||||
name: string;
|
name: string;
|
||||||
|
activeCredentialType?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeTypesMaxCount {
|
export interface INodeTypesMaxCount {
|
||||||
|
|
|
@ -216,6 +216,8 @@ export default mixins(
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
delete this.node.activeCredentialType;
|
||||||
|
|
||||||
this.$emit('credentialSelected', updateInformation);
|
this.$emit('credentialSelected', updateInformation);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -272,6 +274,8 @@ export default mixins(
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.node.activeCredentialType = credentialType;
|
||||||
|
|
||||||
this.$emit('credentialSelected', updateInformation);
|
this.$emit('credentialSelected', updateInformation);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -601,14 +601,9 @@ export default mixins(
|
||||||
* Whether the node's credential may be used to make a request with the HTTP Request node.
|
* Whether the node's credential may be used to make a request with the HTTP Request node.
|
||||||
*/
|
*/
|
||||||
isSupportedByHttpRequestNode(): boolean {
|
isSupportedByHttpRequestNode(): boolean {
|
||||||
if (!this.node || !this.node.credentials) return false;
|
if (!this.node || !this.node.activeCredentialType || !this.node.credentials) return false;
|
||||||
|
|
||||||
// @TODO Detect currently selected cred
|
const credentialType = this.getCredentialTypeByName(this.node.activeCredentialType);
|
||||||
const selectedCredentialTypeName = Object.keys(this.node.credentials);
|
|
||||||
if (!selectedCredentialTypeName.length) return false;
|
|
||||||
const name = selectedCredentialTypeName.pop()!;
|
|
||||||
|
|
||||||
const credentialType = this.getCredentialTypeByName(name);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
credentialType.name.slice(0, -4).endsWith('OAuth') ||
|
credentialType.name.slice(0, -4).endsWith('OAuth') ||
|
||||||
|
|
Loading…
Reference in a new issue