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 {
|
||||
IDataObject,
|
||||
|
@ -12,11 +12,17 @@ import {
|
|||
NodeOperationError,
|
||||
} 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 {snakeCase,} from 'change-case';
|
||||
import { snakeCase } from 'change-case';
|
||||
|
||||
export class Asana implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
@ -1600,8 +1606,9 @@ export class Asana implements INodeType {
|
|||
{
|
||||
displayName: 'Color',
|
||||
name: 'color',
|
||||
type: 'string',
|
||||
default: '',
|
||||
type: 'options',
|
||||
options: getColorOptions(),
|
||||
default: 'none',
|
||||
description: 'Color of the project.',
|
||||
},
|
||||
{
|
||||
|
@ -1793,10 +1800,9 @@ export class Asana implements INodeType {
|
|||
description: 'The workspace in which to get users.',
|
||||
},
|
||||
{
|
||||
displayName: 'Project',
|
||||
name: 'projectId',
|
||||
displayName: 'Project ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
options: [],
|
||||
default: '',
|
||||
required: true,
|
||||
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',
|
||||
|
@ -1832,8 +1838,9 @@ export class Asana implements INodeType {
|
|||
{
|
||||
displayName: 'Color',
|
||||
name: 'color',
|
||||
type: 'string',
|
||||
default: '',
|
||||
type: 'options',
|
||||
options: getColorOptions(),
|
||||
default: 'none',
|
||||
description: 'Color of the project.',
|
||||
},
|
||||
{
|
||||
|
@ -2488,9 +2495,9 @@ export class Asana implements INodeType {
|
|||
|
||||
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') {
|
||||
|
@ -2548,7 +2555,7 @@ export class Asana implements INodeType {
|
|||
// ----------------------------------
|
||||
// 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;
|
||||
|
||||
// request parameters
|
||||
|
|
|
@ -86,6 +86,36 @@ export async function getWorkspaces(this: ILoadOptionsFunctions): Promise<INodeP
|
|||
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() {
|
||||
return [
|
||||
'*',
|
||||
|
|
Loading…
Reference in a new issue