mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Some improvements to Asana project additions
This commit is contained in:
parent
0a92e616b6
commit
d7a26da699
|
@ -1,4 +1,4 @@
|
||||||
import {IExecuteFunctions,} from 'n8n-core';
|
import { IExecuteFunctions } from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -12,11 +12,17 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {asanaApiRequest, asanaApiRequestAllItems, getTaskFields, getWorkspaces,} from './GenericFunctions';
|
import {
|
||||||
|
asanaApiRequest,
|
||||||
|
asanaApiRequestAllItems,
|
||||||
|
getColorOptions,
|
||||||
|
getTaskFields,
|
||||||
|
getWorkspaces,
|
||||||
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import * as moment from 'moment-timezone';
|
import * as moment from 'moment-timezone';
|
||||||
|
|
||||||
import {snakeCase,} from 'change-case';
|
import { snakeCase } from 'change-case';
|
||||||
|
|
||||||
export class Asana implements INodeType {
|
export class Asana implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
@ -1600,8 +1606,9 @@ export class Asana implements INodeType {
|
||||||
{
|
{
|
||||||
displayName: 'Color',
|
displayName: 'Color',
|
||||||
name: 'color',
|
name: 'color',
|
||||||
type: 'string',
|
type: 'options',
|
||||||
default: '',
|
options: getColorOptions(),
|
||||||
|
default: 'none',
|
||||||
description: 'Color of the project.',
|
description: 'Color of the project.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1793,10 +1800,9 @@ export class Asana implements INodeType {
|
||||||
description: 'The workspace in which to get users.',
|
description: 'The workspace in which to get users.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Project',
|
displayName: 'Project ID',
|
||||||
name: 'projectId',
|
name: 'id',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
options: [],
|
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
|
@ -1809,7 +1815,7 @@ export class Asana implements INodeType {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'The project to update info on.',
|
description: 'The ID of the project to update the data of.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -1832,8 +1838,9 @@ export class Asana implements INodeType {
|
||||||
{
|
{
|
||||||
displayName: 'Color',
|
displayName: 'Color',
|
||||||
name: 'color',
|
name: 'color',
|
||||||
type: 'string',
|
type: 'options',
|
||||||
default: '',
|
options: getColorOptions(),
|
||||||
|
default: 'none',
|
||||||
description: 'Color of the project.',
|
description: 'Color of the project.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2488,9 +2495,9 @@ export class Asana implements INodeType {
|
||||||
|
|
||||||
endpoint = `/projects/${projectId}`;
|
endpoint = `/projects/${projectId}`;
|
||||||
|
|
||||||
responseData = await asanaApiRequest.call(this, requestMethod, endpoint, body, qs);
|
asanaApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||||
|
|
||||||
responseData = responseData.data;
|
responseData = { success: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
@ -2548,7 +2555,7 @@ export class Asana implements INodeType {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// project:update
|
// project:update
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
const projectId = this.getNodeParameter('projectId', i) as string;
|
const projectId = this.getNodeParameter('id', i) as string;
|
||||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
|
|
||||||
// request parameters
|
// request parameters
|
||||||
|
|
|
@ -86,6 +86,36 @@ export async function getWorkspaces(this: ILoadOptionsFunctions): Promise<INodeP
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getColorOptions(): INodePropertyOptions[] {
|
||||||
|
return [
|
||||||
|
'dark-blue',
|
||||||
|
'dark-brown',
|
||||||
|
'dark-green',
|
||||||
|
'dark-orange',
|
||||||
|
'dark-pink',
|
||||||
|
'dark-purple',
|
||||||
|
'dark-red',
|
||||||
|
'dark-teal',
|
||||||
|
'dark-warm-gray',
|
||||||
|
'light-blue',
|
||||||
|
'light-green',
|
||||||
|
'light-orange',
|
||||||
|
'light-pink',
|
||||||
|
'light-purple',
|
||||||
|
'light-red',
|
||||||
|
'light-teal',
|
||||||
|
'light-warm-gray',
|
||||||
|
'light-yellow',
|
||||||
|
'none',
|
||||||
|
].map(value => {
|
||||||
|
return {
|
||||||
|
name: value,
|
||||||
|
value: value,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function getTaskFields() {
|
export function getTaskFields() {
|
||||||
return [
|
return [
|
||||||
'*',
|
'*',
|
||||||
|
|
Loading…
Reference in a new issue