1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-11 13:15:28 +03:00

Improvements

This commit is contained in:
ricardo 2021-11-10 18:30:05 -05:00
parent f451852747
commit 732f95fd6c
5 changed files with 14 additions and 22 deletions

View File

@ -56,7 +56,7 @@ export const blockFields = [
],
},
},
description: `The ID of block. A page it is also considered a block. Hence, a Page ID can be used as well`,
description: `The Block URL from Notion's 'copy link' functionality (or just the ID contained within the URL). Pages are also blocks, so you can use a page URL/ID here too`,
},
...blocks('block', 'append'),
/* -------------------------------------------------------------------------- */
@ -78,6 +78,7 @@ export const blockFields = [
],
},
},
description: `The Block URL from Notion's 'copy link' functionality (or just the ID contained within the URL). Pages are also blocks, so you can use a page URL/ID here too`,
},
{
displayName: 'Return All',

View File

@ -551,7 +551,6 @@ export const blocks = (resource: string, operation: string) => [{
typeOptions: {
loadOptionsMethod: 'getBlockTypes',
},
description: 'Type of block',
default: 'paragraph',
},
...block('paragraph'),

View File

@ -51,7 +51,7 @@ export const databasePageFields = [
/* databasePage:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Database ID',
displayName: 'Database Name or ID',
name: 'databaseId',
type: 'options',
default: '',
@ -981,23 +981,6 @@ export const databasePageFields = [
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Download',
name: 'download',
type: 'boolean',
displayOptions: {
show: {
resource: [
'databasePage',
],
operation: [
'getAll',
],
},
},
default: true,
description: 'Whether to download the fields type file',
},
{
displayName: 'Options',
name: 'options',
@ -1015,6 +998,13 @@ export const databasePageFields = [
default: {},
placeholder: 'Add Field',
options: [
{
displayName: 'Download',
name: 'download',
type: 'boolean',
default: false,
description: 'If a database field contains a file, whether to download it',
},
{
displayName: 'Filters',
name: 'filter',

View File

@ -467,6 +467,7 @@ export function simplifyObjects(objects: any, download = false) {
if (object === 'page' && (parent.type === 'page_id' || parent.type === 'workspace')) {
results.push({
id,
//if change title for name then it's going to be a breaking change.
title: properties.title.title[0].plain_text,
url,
created_time,

View File

@ -149,7 +149,6 @@ export class Notion implements INodeType {
},
],
default: 'page',
description: 'Resource to consume.',
},
...blockOperations,
...blockFields,
@ -346,10 +345,12 @@ export class Notion implements INodeType {
children: formatBlocks(this.getNodeParameter('blockUi.blockValues', i, []) as IDataObject[]),
};
const block = await notionApiRequest.call(this, 'PATCH', `/blocks/${blockId}/children`, body);
//console.log(await notionApiRequest.call(this, 'GET', `/blocks/3faf44f3a2284526b1dfe0b6edc1e76e`));
returnData.push(block);
}
}
if (operation === 'getAll') {
for (let i = 0; i < length; i++) {
const blockId = extractPageId(this.getNodeParameter('blockId', i) as string);
@ -453,7 +454,7 @@ export class Notion implements INodeType {
if (operation === 'getAll') {
for (let i = 0; i < length; i++) {
download = this.getNodeParameter('download', 0) as boolean;
download = this.getNodeParameter('options.download', 0, false) as boolean;
const simple = this.getNodeParameter('simple', 0) as boolean;
const databaseId = this.getNodeParameter('databaseId', i) as string;
const returnAll = this.getNodeParameter('returnAll', i) as boolean;