Skip to content

Commit c63bf9c

Browse files
authored
Merge pull request #140 from devtron-labs/feat/webhook-event
feat: webhook event
2 parents bf4a83c + 339a954 commit c63bf9c

File tree

9 files changed

+51
-4
lines changed

9 files changed

+51
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.79-beta-6",
3+
"version": "0.0.79-beta-8",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-pull-request.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/Icon/ic-tag.svg

Lines changed: 4 additions & 0 deletions
Loading

src/Assets/Icon/ic-webhook.svg

Lines changed: 15 additions & 0 deletions
Loading

src/Common/Common.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,8 @@ export function fetchChartTemplateVersions() {
326326
export const getDefaultConfig = (): Promise<ResponseType> => {
327327
return get(`${ROUTES.NOTIFIER}/channel/config`)
328328
}
329+
330+
export function getWebhookEventsForEventId(eventId: string | number) {
331+
const URL = `${ROUTES.GIT_HOST_EVENT}/${eventId}`
332+
return get(URL)
333+
}

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const ROUTES = {
4747
UPDATE: 'update',
4848
CLUSTER_NOTE: 'cluster/note',
4949
APPLICATION_NOTE: 'app/note',
50+
GIT_HOST_EVENT: 'git/host/event',
5051
}
5152

5253
export enum KEY_VALUE {

src/Shared/Helpers.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { MaterialInfo } from '../Common'
2-
import { GitTriggers } from './types'
2+
import { GitTriggers, WebhookEventNameType } from './types'
3+
import { ReactComponent as ICPullRequest } from '../Assets/Icon/ic-pull-request.svg'
4+
import { ReactComponent as ICTag } from '../Assets/Icon/ic-tag.svg'
5+
import { ReactComponent as ICWebhook } from '../Assets/Icon/ic-webhook.svg'
36

47
interface HighlightSearchTextProps {
58
/**
@@ -69,3 +72,14 @@ export const getGitCommitInfo = (materialInfo: MaterialInfo): GitTriggers => ({
6972

7073
export const caseInsensitiveStringComparator = (a: string, b: string): number =>
7174
a.toLowerCase().localeCompare(b.toLowerCase())
75+
76+
export const getWebhookEventIcon = (eventName: WebhookEventNameType) => {
77+
switch (eventName) {
78+
case WebhookEventNameType.PULL_REQUEST:
79+
return <ICPullRequest className="icon-dim-12" />
80+
case WebhookEventNameType.TAG_CREATION:
81+
return <ICTag className="icon-dim-12" />
82+
default:
83+
return <ICWebhook className="icon-dim-12" />
84+
}
85+
}

src/Shared/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,8 @@ export interface MaterialSecurityInfoType {
227227
isScanned: boolean
228228
isScanEnabled: boolean
229229
}
230+
231+
export enum WebhookEventNameType {
232+
PULL_REQUEST = 'Pull Request',
233+
TAG_CREATION = 'Tag Creation',
234+
}

0 commit comments

Comments
 (0)