Add parameter type "hidden"

This commit is contained in:
Jan Oberhauser 2020-02-09 13:33:40 -08:00
parent 928bf4dc68
commit 6bff3dc199
4 changed files with 26 additions and 3 deletions

View file

@ -34,6 +34,7 @@ import CredentialsInput from '@/components/CredentialsInput.vue';
import {
ICredentialsCreatedEvent,
ICredentialsDecryptedResponse,
INodeProperties,
} from '@/Interface';
import {
@ -181,9 +182,21 @@ export default mixins(
// Credentials extends another one. So get the properties of the one it
// extends and add them.
credentialData = JSON.parse(JSON.stringify(credentialData));
let existingIndex: number;
for (const credentialTypeName of credentialData.extends) {
const data = this.$store.getters.credentialType(credentialTypeName);
credentialData.properties.push.apply(credentialData.properties, data.properties);
for (const property of data.properties) {
existingIndex = credentialData.properties.findIndex(element => element.name === property.name);
if (existingIndex === -1) {
// Property does not exist yet, so add
credentialData.properties.push(property);
} else {
// Property exists already, so overwrite
credentialData.properties[existingIndex] = property;
}
}
}
return credentialData;

View file

@ -149,6 +149,10 @@ export default mixins(
this.$emit('valueChanged', parameterData);
},
displayNodeParameter (parameter: INodeProperties): boolean {
if (parameter.type === 'hidden') {
return false;
}
if (parameter.displayOptions === undefined) {
// If it is not defined no need to do a proper check
return true;

View file

@ -1,15 +1,21 @@
import {
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
export class GithubOAuth2Api implements ICredentialType {
name = 'githubOAuth2Api';
// name = 'oAuth2Api/githubOAuth2Api';
extends = [
'oAuth2Api',
];
displayName = 'Github OAuth2 API';
properties = [
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes,
default: '',
},
];
}

View file

@ -364,7 +364,7 @@ export interface INodeParameters {
}
export type NodePropertyTypes = 'boolean' | 'collection' | 'color' | 'dateTime' | 'fixedCollection' | 'json' | 'multiOptions' | 'number' | 'options' | 'string';
export type NodePropertyTypes = 'boolean' | 'collection' | 'color' | 'dateTime' | 'fixedCollection' | 'hidden' | 'json' | 'multiOptions' | 'number' | 'options' | 'string';
export type EditorTypes = 'code';