Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add more events in integrations #4815

Merged
merged 4 commits into from
Sep 29, 2023
Merged

Conversation

nunogois
Copy link
Member

@nunogois nunogois commented Sep 22, 2023

https://linear.app/unleash/issue/2-1253/add-support-for-more-events-in-the-slack-app-integration

Adds support for a lot more events in our integrations. Here is how the full list looks like:

  • ADDON_CONFIG_CREATED
  • ADDON_CONFIG_DELETED
  • ADDON_CONFIG_UPDATED
  • API_TOKEN_CREATED
  • API_TOKEN_DELETED
  • CHANGE_ADDED
  • CHANGE_DISCARDED
  • CHANGE_EDITED
  • CHANGE_REQUEST_APPLIED
  • CHANGE_REQUEST_APPROVAL_ADDED
  • CHANGE_REQUEST_APPROVED
  • CHANGE_REQUEST_CANCELLED
  • CHANGE_REQUEST_CREATED
  • CHANGE_REQUEST_DISCARDED
  • CHANGE_REQUEST_REJECTED
  • CHANGE_REQUEST_SENT_TO_REVIEW
  • CONTEXT_FIELD_CREATED
  • CONTEXT_FIELD_DELETED
  • CONTEXT_FIELD_UPDATED
  • FEATURE_ARCHIVED
  • FEATURE_CREATED
  • FEATURE_DELETED
  • FEATURE_ENVIRONMENT_DISABLED
  • FEATURE_ENVIRONMENT_ENABLED
  • FEATURE_ENVIRONMENT_VARIANTS_UPDATED
  • FEATURE_METADATA_UPDATED
  • FEATURE_POTENTIALLY_STALE_ON
  • FEATURE_PROJECT_CHANGE
  • FEATURE_REVIVED
  • FEATURE_STALE_OFF
  • FEATURE_STALE_ON
  • FEATURE_STRATEGY_ADD
  • FEATURE_STRATEGY_REMOVE
  • FEATURE_STRATEGY_UPDATE
  • FEATURE_TAGGED
  • FEATURE_UNTAGGED
  • GROUP_CREATED
  • GROUP_DELETED
  • GROUP_UPDATED
  • PROJECT_CREATED
  • PROJECT_DELETED
  • SEGMENT_CREATED
  • SEGMENT_DELETED
  • SEGMENT_UPDATED
  • SERVICE_ACCOUNT_CREATED
  • SERVICE_ACCOUNT_DELETED
  • SERVICE_ACCOUNT_UPDATED
  • USER_CREATED
  • USER_DELETED
  • USER_UPDATED

I added the events that I thought were relevant based on my own discretion. Know of any event we should add? Let me know and I'll add it 🙂

For now I only added these events to the new Slack App integration, but we can add them to the other integrations as well since they are now supported.

The event formatter was refactored and changed quite a bit in order to make it easier to maintain and add new events in the future. As a result, events are now posted with different text. Do we consider this a breaking change? If so, I can keep the old event formatter around, create a new one and only use it for the new Slack App integration.

I noticed we don't have good 404 behaviors in the UI for things that are deleted in the meantime, that's why I avoided some links to specific resources (like feature strategies, integration configurations, etc), but we could add them later if we improve this.

This PR also tries to add some consistency to the the way we log events.

@vercel
Copy link

vercel bot commented Sep 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 29, 2023 0:58am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 29, 2023 0:58am

value: event,
label: event,
}))
.sort((a, b) => a.label.localeCompare(b.label));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a bunch of events, so it's better if we sort them. Ideally they would be grouped, but maybe that can come in a later PR.

return type;
}
}
Mustache.escape = (text) => text;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Globally disables Mustache escaping so we don't need to specify link variables with {{{link}}}, which would be unintuitive.

@nunogois nunogois marked this pull request as ready for review September 29, 2023 11:40
Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. That's a lot of extra events to support!

Nice!

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -171,7 +171,7 @@ export class SegmentService implements ISegmentService {
await this.eventService.storeEvent({
type: SEGMENT_DELETED,
createdBy: user.email || user.username,
data: segment,
preData: segment,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice discovery!

@nunogois nunogois merged commit 521cc24 into main Sep 29, 2023
14 of 19 checks passed
@nunogois nunogois deleted the feat-integrations-add-events branch September 29, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants