mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Small improvement to Cockpit-Node
This commit is contained in:
parent
532b9a9294
commit
ef26a4bfe5
|
@ -14,17 +14,17 @@ export const collectionOperations = [
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'Create an entry',
|
name: 'Create an Entry',
|
||||||
value: 'create',
|
value: 'create',
|
||||||
description: 'Create a collection entry',
|
description: 'Create a collection entry',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Get all entries',
|
name: 'Get all Entries',
|
||||||
value: 'getAll',
|
value: 'getAll',
|
||||||
description: 'Get all collection entries',
|
description: 'Get all collection entries',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update an entry',
|
name: 'Update an Entry',
|
||||||
value: 'update',
|
value: 'update',
|
||||||
description: 'Update a collection entries',
|
description: 'Update a collection entries',
|
||||||
},
|
},
|
||||||
|
@ -116,22 +116,24 @@ export const collectionFields = [
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
type: 'json',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
alwaysOpenEditWindow: true,
|
alwaysOpenEditWindow: true,
|
||||||
},
|
},
|
||||||
description: 'Fields to get.',
|
placeholder: '_id,name',
|
||||||
|
description: 'Comma separated list of fields to get.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Filter',
|
displayName: 'Filter Query',
|
||||||
name: 'filter',
|
name: 'filter',
|
||||||
type: 'json',
|
type: 'json',
|
||||||
default: '',
|
default: '',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
alwaysOpenEditWindow: true,
|
alwaysOpenEditWindow: true,
|
||||||
},
|
},
|
||||||
description: 'Filter result by fields.',
|
placeholder: '{"name": "Jim"}',
|
||||||
|
description: 'Filter query in <a href="https://jeroen.github.io/mongolite/query-data.html" target="_blank">Mongolite format</a>.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Language',
|
displayName: 'Language',
|
||||||
|
@ -163,11 +165,12 @@ export const collectionFields = [
|
||||||
description: 'Skip number of entries.',
|
description: 'Skip number of entries.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Sort',
|
displayName: 'Sort Query',
|
||||||
name: 'sort',
|
name: 'sort',
|
||||||
type: 'json',
|
type: 'json',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Sort result by fields.',
|
placeholder: '{"price": -1}',
|
||||||
|
description: 'Sort query in <a href="https://jeroen.github.io/mongolite/query-data.html" target="_blank">Mongolite format</a>.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -213,7 +216,7 @@ export const collectionFields = [
|
||||||
description: 'If new entry fields should be set via the value-key pair UI or JSON.',
|
description: 'If new entry fields should be set via the value-key pair UI or JSON.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Data fields',
|
displayName: 'Entry Data',
|
||||||
name: 'dataFieldsJson',
|
name: 'dataFieldsJson',
|
||||||
type: 'json',
|
type: 'json',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -234,10 +237,10 @@ export const collectionFields = [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Data to send as JSON.',
|
description: 'Entry data to send as JSON.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Data fields',
|
displayName: 'Entry Data',
|
||||||
name: 'dataFieldsUi',
|
name: 'dataFieldsUi',
|
||||||
type: 'fixedCollection',
|
type: 'fixedCollection',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
|
@ -280,6 +283,6 @@ export const collectionFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Data field to send.',
|
description: 'Entry data to send.',
|
||||||
},
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -27,7 +27,16 @@ export async function getAllCollectionEntries(this: IExecuteFunctions | IExecute
|
||||||
const body: ICollection = {};
|
const body: ICollection = {};
|
||||||
|
|
||||||
if (options.fields) {
|
if (options.fields) {
|
||||||
body.fields = JSON.parse(options.fields.toString());
|
const fields = (options.fields as string).split(',').map(field => field.trim() );
|
||||||
|
|
||||||
|
const bodyFields = {
|
||||||
|
_id: false,
|
||||||
|
} as IDataObject;
|
||||||
|
for (const field of fields) {
|
||||||
|
bodyFields[field] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.fields = bodyFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.filter) {
|
if (options.filter) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const formOperations = [
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'Submit a form',
|
name: 'Submit a Form',
|
||||||
value: 'submit',
|
value: 'submit',
|
||||||
description: 'Store submission of a form',
|
description: 'Store submission of a form',
|
||||||
},
|
},
|
||||||
|
@ -61,7 +61,7 @@ export const formFields = [
|
||||||
description: 'If form fields should be set via the value-key pair UI or JSON.',
|
description: 'If form fields should be set via the value-key pair UI or JSON.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Form fields',
|
displayName: 'Form Data',
|
||||||
name: 'dataFieldsJson',
|
name: 'dataFieldsJson',
|
||||||
type: 'json',
|
type: 'json',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -81,10 +81,10 @@ export const formFields = [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Form to send as JSON.',
|
description: 'Form data to send as JSON.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Data fields',
|
displayName: 'Form Data',
|
||||||
name: 'dataFieldsUi',
|
name: 'dataFieldsUi',
|
||||||
type: 'fixedCollection',
|
type: 'fixedCollection',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
|
@ -126,6 +126,6 @@ export const formFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
description: 'Form field to send.',
|
description: 'Form data to send.',
|
||||||
},
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const singletonOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get',
|
name: 'Get',
|
||||||
value: 'get',
|
value: 'get',
|
||||||
description: 'Gets a singleton',
|
description: 'Gets a Singleton',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'get',
|
default: 'get',
|
||||||
|
|
Loading…
Reference in a new issue