2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-11-26 04:10:03 -08:00
export const dashboardOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
noDataExpression : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a dashboard' ,
2022-07-10 13:50:51 -07:00
action : 'Create a dashboard' ,
2021-11-26 04:10:03 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a dashboard' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a dashboard' ,
2021-11-26 04:10:03 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a dashboard' ,
2022-07-10 13:50:51 -07:00
action : 'Get a dashboard' ,
2021-11-26 04:10:03 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-11-26 04:10:03 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many dashboards' ,
2022-09-08 08:10:13 -07:00
action : 'Get many dashboards' ,
2021-11-26 04:10:03 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a dashboard' ,
2022-07-10 13:50:51 -07:00
action : 'Update a dashboard' ,
2021-11-26 04:10:03 -08:00
} ,
] ,
default : 'create' ,
} ,
] ;
export const dashboardFields : INodeProperties [ ] = [
{
displayName : 'Title' ,
name : 'title' ,
description : 'Title of the dashboard to create' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'create' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'create' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
options : [
{
displayName : 'Folder Name or ID' ,
name : 'folderId' ,
type : 'options' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'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 using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-11-26 04:10:03 -08:00
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 : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'delete' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
// ----------------------------------------
// 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 : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'get' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
// ----------------------------------
// 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 : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'getAll' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
description : 'Max number of results to return' ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'getAll' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
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 : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'update' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dashboard' ] ,
operation : [ 'update' ] ,
2021-11-26 04:10:03 -08:00
} ,
} ,
options : [
{
displayName : 'Folder Name or ID' ,
name : 'folderId' ,
type : 'options' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'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/code/expressions/">expression</a>.' ,
2021-11-26 04:10:03 -08:00
typeOptions : {
loadOptionsMethod : 'getFolders' ,
} ,
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
description : 'New title of the dashboard' ,
} ,
] ,
} ,
] ;