Skip to content

Commit f1d467d

Browse files
committed
enum added for WEBHOOK_EVENT_ACTION_TYPE
1 parent 1ab8116 commit f1d467d

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
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.1.15-beta-17",
3+
"version": "0.1.15-beta-18",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { stopPropagation } from '@Common/Helper'
3434
import { DATE_TIME_FORMATS } from '@Common/Constants'
3535
import GitMaterialInfoHeader from './GitMaterialInfoHeader'
3636
import { MATERIAL_EXCLUDE_TIPPY_TEXT } from '../../constants'
37+
import { WEBHOOK_EVENT_ACTION_TYPE } from './constants'
3738
import { GitCommitInfoGenericProps } from './types'
3839

3940
const GitCommitInfoGeneric = ({
@@ -148,7 +149,7 @@ const GitCommitInfoGeneric = ({
148149

149150
function handleMoreDataForWebhook() {
150151
const _moreData = {}
151-
if (_webhookData.eventactiontype == 'merged') {
152+
if (_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED) {
152153
Object.keys(_webhookData.data).forEach((_key) => {
153154
if (
154155
_key != 'author' &&
@@ -163,7 +164,7 @@ const GitCommitInfoGeneric = ({
163164
_moreData[_key] = _webhookData.data[_key]
164165
}
165166
})
166-
} else if (_webhookData.eventactiontype == 'non-merged') {
167+
} else if (_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED) {
167168
Object.keys(_webhookData.data).forEach((_key) => {
168169
if (_key !== 'author' && _key !== 'date' && _key !== 'target checkout') {
169170
_moreData[_key] = _webhookData.data[_key]
@@ -287,7 +288,7 @@ const GitCommitInfoGeneric = ({
287288
</>
288289
)}
289290

290-
{_isWebhook && _webhookData.eventactiontype == 'merged' && (
291+
{_isWebhook && _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
291292
<>
292293
<div className="flex dc__content-space pr-16 ">
293294
<div className="ml-16 ">
@@ -385,7 +386,7 @@ const GitCommitInfoGeneric = ({
385386
{handleMoreDataForWebhook()}
386387
</>
387388
)}
388-
{_isWebhook && _webhookData.eventactiontype == 'non-merged' && (
389+
{_isWebhook && _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
389390
<>
390391
<div className="flex left pr-16 pb-8 dc__content-space">
391392
<div className="flex left cn-9 fs-13 ml-16"> {_webhookData.data['target checkout']}</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const WEBHOOK_EVENT_ACTION_TYPE = {
2+
MERGED: 'merged',
3+
NON_MERGED: 'non-merged',
4+
}

0 commit comments

Comments
 (0)