Add Grafana node (#2411)

*  Create Grafana node

* 👕 Fix lint

*  Apply feedback

*  Apply feedback

* 👕 Fix lint

*  Remove double import

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Iván Ovejero
2021-11-26 13:10:03 +01:00
committed by GitHub
parent ff48a9a3ed
commit a6fd5597af
11 changed files with 1854 additions and 1 deletions

View File

@@ -0,0 +1,271 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const dashboardOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'dashboard',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a dashboard',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a dashboard',
},
{
name: 'Get',
value: 'get',
description: 'Get a dashboard',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all dashboards',
},
{
name: 'Update',
value: 'update',
description: 'Update a dashboard',
},
],
default: 'create',
},
];
export const dashboardFields: INodeProperties[] = [
{
displayName: 'Title',
name: 'title',
description: 'Title of the dashboard to create',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Folder Name or ID',
name: 'folderId',
type: 'options',
default: '',
description: 'Folder to create the dashboard in - if the folder is unspecified, the dashboard will be saved to the General folder. Choose from the list or specify an ID. You can also specify the ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getFolders',
},
},
],
},
// ----------------------------------------
// dashboard: delete
// ----------------------------------------
{
displayName: 'Dashboard UID or URL',
name: 'dashboardUidOrUrl',
description: 'Unique alphabetic identifier or URL of the dashboard to delete',
placeholder: 'cIBgcSjkk',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// dashboard: get
// ----------------------------------------
{
displayName: 'Dashboard UID or URL',
name: 'dashboardUidOrUrl',
description: 'Unique alphabetic identifier or URL of the dashboard to retrieve',
placeholder: 'cIBgcSjkk',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'get',
],
},
},
},
// ----------------------------------
// dashboard: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 100,
},
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Search Query',
name: 'query',
type: 'string',
default: '',
},
],
},
// ----------------------------------------
// dashboard: update
// ----------------------------------------
{
displayName: 'Dashboard UID or URL',
name: 'dashboardUidOrUrl',
description: 'Unique alphabetic identifier or URL of the dashboard to update',
placeholder: 'cIBgcSjkk',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'dashboard',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Folder Name or ID',
name: 'folderId',
type: 'options',
default: '',
description: 'Folder to move the dashboard into - if the folder is unspecified, the dashboard will be saved to the General folder. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getFolders',
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'New title of the dashboard',
},
],
},
];

View File

@@ -0,0 +1,270 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const teamOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'team',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a team',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a team',
},
{
name: 'Get',
value: 'get',
description: 'Get a team',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all teams',
},
{
name: 'Update',
value: 'update',
description: 'Update a team',
},
],
default: 'create',
},
];
export const teamFields: INodeProperties[] = [
// ----------------------------------------
// team: create
// ----------------------------------------
{
displayName: 'Name',
name: 'name',
description: 'Name of the team to create',
placeholder: 'Engineering',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'engineering@n8n.io',
default: '',
description: 'Email of the team to create',
},
],
},
// ----------------------------------------
// team: delete
// ----------------------------------------
{
displayName: 'Team ID',
name: 'teamId',
description: 'ID of the team to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// team: get
// ----------------------------------------
{
displayName: 'Team ID',
name: 'teamId',
description: 'ID of the team to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// team: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the team to filter by',
},
],
},
// ----------------------------------------
// team: update
// ----------------------------------------
{
displayName: 'Team ID',
name: 'teamId',
description: 'ID of the team to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'team',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'engineering@n8n.io',
default: '',
description: 'Email of the team to update',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
placeholder: 'Engineering Team',
default: '',
description: 'Name of the team to update',
},
],
},
];

View File

@@ -0,0 +1,196 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const teamMemberOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'teamMember',
],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Add a member to a team',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all team members',
},
{
name: 'Remove',
value: 'remove',
description: 'Remove a member from a team',
},
],
default: 'add',
},
];
export const teamMemberFields: INodeProperties[] = [
// ----------------------------------------
// teamMember: add
// ----------------------------------------
{
displayName: 'User Name or ID',
name: 'userId',
description: 'User to add to a team. Choose a name from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
type: 'options',
required: true,
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'add',
],
},
},
},
{
displayName: 'Team Name or ID',
name: 'teamId',
description: 'Team to add the user to. Choose a name from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
type: 'options',
required: true,
default: '',
typeOptions: {
loadOptionsMethod: 'getTeams',
},
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'add',
],
},
},
},
// ----------------------------------------
// teamMember: remove
// ----------------------------------------
{
displayName: 'User Name or ID',
name: 'memberId',
description: 'User to remove from the team. Choose a name from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
type: 'options',
required: true,
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'remove',
],
},
},
},
{
displayName: 'Team Name or ID',
name: 'teamId',
description: 'Team to remove the user from. Choose a name from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
type: 'options',
required: true,
default: '',
typeOptions: {
loadOptionsMethod: 'getTeams',
},
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'remove',
],
},
},
},
// ----------------------------------------
// teamMember: getAll
// ----------------------------------------
{
displayName: 'Team Name or ID',
name: 'teamId',
description: 'Team to retrieve all members from. Choose a name from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getTeams',
},
type: 'options',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'teamMember',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
];

View File

@@ -0,0 +1,167 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const userOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
},
},
options: [
{
name: 'Delete',
value: 'delete',
description: 'Delete a user from the current organization',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all users in the current organization',
},
{
name: 'Update',
value: 'update',
description: 'Update a user in the current organization',
},
],
default: 'getAll',
},
];
export const userFields: INodeProperties[] = [
// ----------------------------------------
// user: update
// ----------------------------------------
{
displayName: 'User ID',
name: 'userId',
description: 'ID of the user to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Role',
name: 'role',
type: 'options',
default: 'Admin',
description: 'New role for the user',
options: [
{
name: 'Admin',
value: 'Admin',
},
{
name: 'Editor',
value: 'Editor',
},
{
name: 'Viewer',
value: 'Viewer',
},
],
},
],
},
// ----------------------------------------
// user: delete
// ----------------------------------------
{
displayName: 'User ID',
name: 'userId',
description: 'ID of the user to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// user: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
];

View File

@@ -0,0 +1,4 @@
export * from './DashboardDescription';
export * from './TeamDescription';
export * from './TeamMemberDescription';
export * from './UserDescription';