mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
✨ Extend Google Drive node upload functionality (#1872)
* Add a function to validate JSON - copied from other nodes. * Add properties and appProperties attributes. * ⚡ Improvements to #1637 Co-authored-by: vbouchet <vincent.bouchet.31@gmail.com>
This commit is contained in:
parent
20be641e63
commit
e298d2a1a8
|
@ -741,6 +741,7 @@ export class GoogleDrive implements INodeType {
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
description: 'Name of the binary property which contains<br />the data for the file to be uploaded.',
|
description: 'Name of the binary property which contains<br />the data for the file to be uploaded.',
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// file:update
|
// file:update
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1898,6 +1899,91 @@ export class GoogleDrive implements INodeType {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'upload',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'file',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'APP Properties',
|
||||||
|
name: 'appPropertiesUi',
|
||||||
|
placeholder: 'Add Property',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
default: '',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'A collection of arbitrary key-value pairs which are private to the requesting app',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'appPropertyValues',
|
||||||
|
displayName: 'APP Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Key',
|
||||||
|
name: 'key',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the key to add.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value to set for the key.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Properties',
|
||||||
|
name: 'propertiesUi',
|
||||||
|
placeholder: 'Add Property',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
default: '',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'A collection of arbitrary key-value pairs which are visible to all apps.',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'propertyValues',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Key',
|
||||||
|
name: 'key',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the key to add.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value to set for the key.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2228,6 +2314,18 @@ export class GoogleDrive implements INodeType {
|
||||||
originalFilename,
|
originalFilename,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const properties = this.getNodeParameter('options.propertiesUi.propertyValues', i, []) as IDataObject[];
|
||||||
|
|
||||||
|
if (properties.length) {
|
||||||
|
Object.assign(body, { properties: properties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}) } );
|
||||||
|
}
|
||||||
|
|
||||||
|
const appProperties = this.getNodeParameter('options.appPropertiesUi.appPropertyValues', i, []) as IDataObject[];
|
||||||
|
|
||||||
|
if (properties.length) {
|
||||||
|
Object.assign(body, { appProperties: appProperties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}) });
|
||||||
|
}
|
||||||
|
|
||||||
qs = {
|
qs = {
|
||||||
addParents: parents.join(','),
|
addParents: parents.join(','),
|
||||||
// When set to true shared drives can be used.
|
// When set to true shared drives can be used.
|
||||||
|
|
Loading…
Reference in a new issue