mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Added description and fixed issue with colors (#686)
This commit is contained in:
@@ -177,6 +177,15 @@ export const eventFields = [
|
|||||||
default: '',
|
default: '',
|
||||||
description: 'The color of the event.',
|
description: 'The color of the event.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
type: 'string',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Guests Can Invite Others',
|
displayName: 'Guests Can Invite Others',
|
||||||
name: 'guestsCanInviteOthers',
|
name: 'guestsCanInviteOthers',
|
||||||
@@ -858,6 +867,15 @@ export const eventFields = [
|
|||||||
default: '',
|
default: '',
|
||||||
description: 'The color of the event.',
|
description: 'The color of the event.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
type: 'string',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'End',
|
displayName: 'End',
|
||||||
name: 'end',
|
name: 'end',
|
||||||
|
|||||||
@@ -33,9 +33,15 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return await this.helpers.requestOAuth2.call(this, 'googleCalendarOAuth2Api', options);
|
return await this.helpers.requestOAuth2.call(this, 'googleCalendarOAuth2Api', options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.body && error.response.body.message) {
|
if (error.response && error.response.body && error.response.body.error) {
|
||||||
|
|
||||||
|
let errors = error.response.body.error.errors;
|
||||||
|
|
||||||
|
errors = errors.map((e: IDataObject) => e.message);
|
||||||
// Try to return the error prettier
|
// Try to return the error prettier
|
||||||
throw new Error(`Google Calendar error response [${error.statusCode}]: ${error.response.body.message}`);
|
throw new Error(
|
||||||
|
`Google Calendar error response [${error.statusCode}]: ${errors.join('|')}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,16 +97,16 @@ export class GoogleCalendar implements INodeType {
|
|||||||
this: ILoadOptionsFunctions
|
this: ILoadOptionsFunctions
|
||||||
): Promise<INodePropertyOptions[]> {
|
): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
const { calendar } = await googleApiRequest.call(
|
const { event } = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
'GET',
|
'GET',
|
||||||
'/calendar/v3/colors'
|
'/calendar/v3/colors'
|
||||||
);
|
);
|
||||||
for (const key of Object.keys(calendar)) {
|
for (const key of Object.keys(event)) {
|
||||||
const colorName = calendar[key].background;
|
const colorName = `Background: ${event[key].background} - Foreground: ${event[key].foreground}`;
|
||||||
const colorId = key;
|
const colorId = key;
|
||||||
returnData.push({
|
returnData.push({
|
||||||
name: `${colorName} - ${colorId}`,
|
name: `${colorName}`,
|
||||||
value: colorId
|
value: colorId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user