Skip to content

Commit

Permalink
⚡ Improvements on Sentry Node
Browse files Browse the repository at this point in the history
  • Loading branch information
janober committed Apr 23, 2021
1 parent a3c5f41 commit cc5b1d9
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 131 deletions.
1 change: 1 addition & 0 deletions packages/nodes-base/nodes/SentryIo/EventDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const eventFields = [
default: 100,
description: 'How many results to return.',
},

/* -------------------------------------------------------------------------- */
/* event:get */
/* -------------------------------------------------------------------------- */
Expand Down
2 changes: 2 additions & 0 deletions packages/nodes-base/nodes/SentryIo/IssueDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const issueFields = [
required: true,
description: 'ID of issue to get.',
},

/* -------------------------------------------------------------------------- */
/* issue:getAll */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -204,6 +205,7 @@ export const issueFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* issue:update */
/* -------------------------------------------------------------------------- */
Expand Down
30 changes: 11 additions & 19 deletions packages/nodes-base/nodes/SentryIo/OrganizationDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const organizationFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* organization:get */
/* -------------------------------------------------------------------------- */
Expand All @@ -143,6 +144,7 @@ export const organizationFields = [
required: true,
description: 'The slug of the organization the team should be created for.',
},

/* -------------------------------------------------------------------------- */
/* organization:create */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -207,6 +209,7 @@ export const organizationFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* organization:update */
/* -------------------------------------------------------------------------- */
Expand All @@ -230,24 +233,6 @@ export const organizationFields = [
required: true,
description: 'The slug of the organization to update.',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'update',
],
},
},
required: true,
description: 'The name of the organization.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
Expand All @@ -265,12 +250,19 @@ export const organizationFields = [
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The new name of the organization.',
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
description: 'The updated URL slug for this organization.',
description: 'The new URL slug for this organization.',
},
],
},
Expand Down
65 changes: 34 additions & 31 deletions packages/nodes-base/nodes/SentryIo/ProjectDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const projectOperations = [
value: 'create',
description: 'Create a new project',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
{
name: 'Get',
value: 'get',
Expand All @@ -35,11 +40,6 @@ export const projectOperations = [
value: 'update',
description: 'Update a project',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
},
],
default: 'get',
description: 'The operation to perform',
Expand Down Expand Up @@ -164,6 +164,7 @@ export const projectFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* project:getAll */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -208,6 +209,7 @@ export const projectFields = [
default: 100,
description: 'How many results to return.',
},

/* -------------------------------------------------------------------------- */
/* project:update */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -274,11 +276,25 @@ export const projectFields = [
},
options: [
{
displayName: 'Team',
name: 'team',
type: 'string',
default: '',
description: 'The new team name.',
displayName: 'Bookmarked',
name: 'isBookmarked',
type: 'boolean',
default: false,
description: 'The new platform for the updated project.',
},
{
displayName: 'Digests Maximum Delay',
name: 'digestsMaxDelay',
type: 'number',
default: 1800,
description: 'Maximum interval to digest alerts.',
},
{
displayName: 'Digests Minimun Delay',
name: 'digestsMinDelay',
type: 'number',
default: 60,
description: 'Minium interval to digest alerts.',
},
{
displayName: 'Name',
Expand All @@ -295,35 +311,22 @@ export const projectFields = [
description: 'The new slug for the updated project.',
},
{
displayName: 'Platform',
name: 'platform',
displayName: 'Team',
name: 'team',
type: 'string',
default: '',
description: 'The new platform for the updated project.',
description: 'The new team name.',
},
{
displayName: 'Bookmarked',
name: 'isBookmarked',
type: 'boolean',
default: false,
displayName: 'Platform',
name: 'platform',
type: 'string',
default: '',
description: 'The new platform for the updated project.',
},
{
displayName: 'Digests Minimun Delay',
name: 'digestsMinDelay',
type: 'number',
default: 60,
description: 'Minium interval to digest alerts.',
},
{
displayName: 'Digests Maximum Delay',
name: 'digestsMaxDelay',
type: 'number',
default: 1800,
description: 'Maximum interval to digest alerts.',
},
],
},

/* -------------------------------------------------------------------------- */
/* project:delete */
/* -------------------------------------------------------------------------- */
Expand Down
55 changes: 29 additions & 26 deletions packages/nodes-base/nodes/SentryIo/ReleaseDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const releaseOperations = [
value: 'create',
description: 'Create a release',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
{
name: 'Get',
value: 'get',
Expand All @@ -35,11 +40,6 @@ export const releaseOperations = [
value: 'update',
description: 'Update a release',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a release',
},
],
default: 'get',
description: 'The operation to perform',
Expand Down Expand Up @@ -138,6 +138,7 @@ export const releaseFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* release:get/delete */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -182,6 +183,7 @@ export const releaseFields = [
required: true,
description: 'The version identifier of the release.',
},

/* -------------------------------------------------------------------------- */
/* release:create */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -438,6 +440,7 @@ export const releaseFields = [
},
],
},

/* -------------------------------------------------------------------------- */
/* release:update */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -497,27 +500,6 @@ export const releaseFields = [
},
},
options: [
{
displayName: 'Ref',
name: 'ref',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'Date released',
name: 'dateReleased',
type: 'dateTime',
default: '',
description: 'an optional date that indicates when the release went live. If not provided the current time is assumed.',
},
{
displayName: 'Commits',
name: 'commits',
Expand Down Expand Up @@ -626,6 +608,20 @@ export const releaseFields = [
},
],
},
{
displayName: 'Date released',
name: 'dateReleased',
type: 'dateTime',
default: '',
description: 'an optional date that indicates when the release went live. If not provided the current time is assumed.',
},
{
displayName: 'Ref',
name: 'ref',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
{
displayName: 'Refs',
name: 'refs',
Expand Down Expand Up @@ -667,6 +663,13 @@ export const releaseFields = [
},
],
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
description: 'A URL that points to the release. This can be the path to an online interface to the sourcecode for instance.',
},
],
},
] as INodeProperties[];
21 changes: 4 additions & 17 deletions packages/nodes-base/nodes/SentryIo/SentryIo.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,10 @@ export class SentryIo implements INodeType {
responseData = await sentryIoApiRequest.call(this, 'POST', endpoint, qs);
}
if (operation === 'update') {
const name = this.getNodeParameter('name', i) as string;
const organizationSlug = this.getNodeParameter('organization_slug', i) as string;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
const endpoint = `/api/0/organizations/${organizationSlug}/`;

const body = {name};

if (updateFields.slug) {
Object.assign(body, updateFields.slug as string);
}
const body = this.getNodeParameter('updateFields', i) as IDataObject;

responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
Expand Down Expand Up @@ -650,7 +644,7 @@ export class SentryIo implements INodeType {

const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;

const body = {...updateFields};
const body = { ...updateFields };

if (updateFields.commits) {
const commits: ICommit[] = [];
Expand Down Expand Up @@ -694,7 +688,7 @@ export class SentryIo implements INodeType {

body.refs = refs;
}

responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
}
Expand Down Expand Up @@ -742,17 +736,10 @@ export class SentryIo implements INodeType {
if (operation === 'update') {
const organizationSlug = this.getNodeParameter('organizationSlug', i) as string;
const teamSlug = this.getNodeParameter('teamSlug', i) as string;
const name = this.getNodeParameter('name', i) as string;
const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/`;

const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;

const body={name};
const body = this.getNodeParameter('updateFields', i) as IDataObject;

if (updateFields.slug) {
Object.assign(body, updateFields);
}

responseData = await sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
}
if (operation === 'delete') {
Expand Down
Loading

0 comments on commit cc5b1d9

Please sign in to comment.