Subscriptions now front view

This commit is contained in:
Rupenieks 2020-05-25 09:36:47 +02:00
parent 4ec8a2b44c
commit bb2f1ecd00
2 changed files with 49 additions and 38 deletions

View file

@ -48,6 +48,51 @@ export const streamFields = [
/* -------------------------------------------------------------------------- */
/* stream:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Subscriptions',
name: 'subscriptions',
type: 'fixedCollection',
required: true,
default: '',
description: 'A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.',
displayOptions: {
show: {
resource: [
'stream',
],
operation: [
'create',
],
},
},
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Subscription Properties',
name: 'properties',
values: [
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
description: 'Name of Subscription.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: true,
default: '',
description: 'Description of Subscription.',
}
],
},
],
},
{
displayName: 'JSON Parameters',
name: 'jsonParameters',
@ -162,40 +207,6 @@ export const streamFields = [
},
],
},
{
displayName: 'Subscriptions',
name: 'subscriptions',
type: 'fixedCollection',
required: true,
description: '"A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.',
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Subscription Properties',
name: 'properties',
values: [
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
description: 'Name of Subscription.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: true,
default: '',
description: 'Description of Subscription.',
}
],
},
],
},
{
displayName: 'Stream Post Policy',
name: 'streamPostPolicy',

View file

@ -262,6 +262,10 @@ export class Zulip implements INodeType {
if (operation === 'create') {
const jsonParameters = this.getNodeParameter('jsonParameters', i) as boolean;
const subscriptions = this.getNodeParameter('subscriptions', i) as IDataObject[];
//@ts-ignore
body.subscriptions = JSON.stringify(subscriptions.properties);
if (jsonParameters) {
const additionalFieldsJson = this.getNodeParameter('additionalFieldsJson', i) as string;
@ -281,10 +285,6 @@ export class Zulip implements INodeType {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
if (additionalFields.subscriptions) {
//@ts-ignore
body.subscriptions = JSON.stringify(additionalFields.subscriptions.properties);
}
if (additionalFields.inviteOnly) {
body.invite_only = additionalFields.inviteOnly as boolean;
}