fix(Google Calendar Node): Make it work with public calendars and clean up (#3283)

This commit is contained in:
Michael Kret 2022-05-14 11:44:19 +03:00 committed by GitHub
parent a14d85ea48
commit a7d960c561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 39 deletions

View file

@ -7,6 +7,7 @@ export const calendarOperations: INodeProperties[] = [
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
type: 'options', type: 'options',
noDataExpression: true,
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
@ -22,7 +23,6 @@ export const calendarOperations: INodeProperties[] = [
}, },
], ],
default: 'availability', default: 'availability',
description: 'The operation to perform.',
}, },
]; ];

View file

@ -7,6 +7,7 @@ export const eventOperations: INodeProperties[] = [
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
type: 'options', type: 'options',
noDataExpression: true,
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
@ -42,7 +43,6 @@ export const eventOperations: INodeProperties[] = [
}, },
], ],
default: 'create', default: 'create',
description: 'The operation to perform.',
}, },
]; ];
@ -284,12 +284,6 @@ export const eventFields: INodeProperties[] = [
], ],
default: '', default: '',
}, },
{
displayName: 'Repeat Until',
name: 'repeatUntil',
type: 'dateTime',
default: '',
},
{ {
displayName: 'Repeat How Many Times?', displayName: 'Repeat How Many Times?',
name: 'repeatHowManyTimes', name: 'repeatHowManyTimes',
@ -299,6 +293,12 @@ export const eventFields: INodeProperties[] = [
}, },
default: 1, default: 1,
}, },
{
displayName: 'Repeat Until',
name: 'repeatUntil',
type: 'dateTime',
default: '',
},
{ {
displayName: 'RRULE', displayName: 'RRULE',
name: 'rrule', name: 'rrule',
@ -330,13 +330,6 @@ export const eventFields: INodeProperties[] = [
description: 'Whether to send notifications about the creation of the new event', description: 'Whether to send notifications about the creation of the new event',
default: '', default: '',
}, },
{
displayName: 'Summary',
name: 'summary',
type: 'string',
default: '',
description: 'Title of the event',
},
{ {
displayName: 'Show Me As', displayName: 'Show Me As',
name: 'showMeAs', name: 'showMeAs',
@ -356,6 +349,13 @@ export const eventFields: INodeProperties[] = [
default: 'opaque', default: 'opaque',
description: 'Whether the event blocks time on the calendar', description: 'Whether the event blocks time on the calendar',
}, },
{
displayName: 'Summary',
name: 'summary',
type: 'string',
default: '',
description: 'Title of the event',
},
{ {
displayName: 'Visibility', displayName: 'Visibility',
name: 'visibility', name: 'visibility',
@ -607,7 +607,7 @@ export const eventFields: INodeProperties[] = [
minValue: 1, minValue: 1,
maxValue: 500, maxValue: 500,
}, },
default: 100, default: 50,
description: 'Max number of results to return', description: 'Max number of results to return',
}, },
{ {
@ -649,7 +649,7 @@ export const eventFields: INodeProperties[] = [
{ {
name: 'Start Time', name: 'Start Time',
value: 'startTime', value: 'startTime',
description: 'Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True)', description: 'Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True).',
}, },
{ {
name: 'Updated', name: 'Updated',
@ -895,12 +895,6 @@ export const eventFields: INodeProperties[] = [
], ],
default: '', default: '',
}, },
{
displayName: 'Repeat Until',
name: 'repeatUntil',
type: 'dateTime',
default: '',
},
{ {
displayName: 'Repeat How Many Times?', displayName: 'Repeat How Many Times?',
name: 'repeatHowManyTimes', name: 'repeatHowManyTimes',
@ -910,6 +904,12 @@ export const eventFields: INodeProperties[] = [
}, },
default: 1, default: 1,
}, },
{
displayName: 'Repeat Until',
name: 'repeatUntil',
type: 'dateTime',
default: '',
},
{ {
displayName: 'RRULE', displayName: 'RRULE',
name: 'rrule', name: 'rrule',
@ -917,13 +917,6 @@ export const eventFields: INodeProperties[] = [
default: '', default: '',
description: 'Recurrence rule. When set, the parameters Repeat Frecuency, Repeat How Many Times and Repeat Until are ignored.', description: 'Recurrence rule. When set, the parameters Repeat Frecuency, Repeat How Many Times and Repeat Until are ignored.',
}, },
{
displayName: 'Start',
name: 'start',
type: 'dateTime',
default: '',
description: 'Start time of the event',
},
{ {
displayName: 'Send Updates', displayName: 'Send Updates',
name: 'sendUpdates', name: 'sendUpdates',
@ -948,13 +941,6 @@ export const eventFields: INodeProperties[] = [
description: 'Whether to send notifications about the creation of the new event', description: 'Whether to send notifications about the creation of the new event',
default: '', default: '',
}, },
{
displayName: 'Summary',
name: 'summary',
type: 'string',
default: '',
description: 'Title of the event',
},
{ {
displayName: 'Show Me As', displayName: 'Show Me As',
name: 'showMeAs', name: 'showMeAs',
@ -974,6 +960,20 @@ export const eventFields: INodeProperties[] = [
default: 'opaque', default: 'opaque',
description: 'Whether the event blocks time on the calendar', description: 'Whether the event blocks time on the calendar',
}, },
{
displayName: 'Start',
name: 'start',
type: 'dateTime',
default: '',
description: 'Start time of the event',
},
{
displayName: 'Summary',
name: 'summary',
type: 'string',
default: '',
description: 'Title of the event',
},
{ {
displayName: 'Visibility', displayName: 'Visibility',
name: 'visibility', name: 'visibility',

View file

@ -36,7 +36,6 @@ import {
import moment from 'moment-timezone'; import moment from 'moment-timezone';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { moveMessagePortToContext } from 'worker_threads';
export class GoogleCalendar implements INodeType { export class GoogleCalendar implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
@ -125,7 +124,7 @@ export class GoogleCalendar implements INodeType {
); );
for (const calendar of calendars) { for (const calendar of calendars) {
const calendarName = calendar.summary; const calendarName = calendar.summary;
const calendarId = calendar.id; const calendarId = encodeURIComponent(calendar.id);
returnData.push({ returnData.push({
name: calendarName, name: calendarName,
value: calendarId, value: calendarId,