From cbcc969334b74f4bd45832c7bf8112cbb811d2c5 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Fri, 18 Oct 2024 17:40:29 +0530
Subject: [PATCH 01/64] feat: ui for tag & PR info card
---
.../Components/CICDHistory/CiPipelineSourceConfig.tsx | 6 +-----
src/Shared/Components/KeyValueTable/KeyValueTable.scss | 6 +++---
.../MaterialHistory/MaterialHistory.component.tsx | 4 ++--
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
index da874cb0f..ba981e735 100644
--- a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
+++ b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
@@ -169,11 +169,7 @@ export const CiPipelineSourceConfig = ({
)}
>
)}
- {baseText && (
-
- {baseText}
-
- )}
+ {baseText && {baseText}}
)}
diff --git a/src/Shared/Components/KeyValueTable/KeyValueTable.scss b/src/Shared/Components/KeyValueTable/KeyValueTable.scss
index efe43bb85..2aaba811c 100644
--- a/src/Shared/Components/KeyValueTable/KeyValueTable.scss
+++ b/src/Shared/Components/KeyValueTable/KeyValueTable.scss
@@ -19,11 +19,11 @@
gap: 1px;
&.two-columns-top-row {
- grid-template-columns: 20% 1fr;
+ grid-template-columns: 30% 1fr;
}
&.two-columns {
- grid-template-columns: 20% 1fr;
+ grid-template-columns: 30% 1fr;
.key-value-table__row:last-of-type {
.key-value-table__cell:first-child,
@@ -41,7 +41,7 @@
}
&.three-columns {
- grid-template-columns: 20% 1fr 32px;
+ grid-template-columns: 30% 1fr 32px;
.key-value-table__row:last-of-type {
.key-value-table__cell:first-child,
diff --git a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
index a1b534ee9..e63c4df9f 100644
--- a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
+++ b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
@@ -35,7 +35,7 @@ const MaterialHistory = ({
const getMaterialHistoryMapWithTime = () => {
const historyTimeMap = {}
- material.history?.forEach((history) => {
+ material.history.forEach((history) => {
const newDate = history.date.substring(0, 16)
if (!historyTimeMap[newDate]) {
@@ -59,7 +59,7 @@ const MaterialHistory = ({
const historyList = materialHistoryMapWithTime[date]
return (
<>
- {!isCommitInfoModal && material.type !== SourceTypeMap.WEBHOOK && (
+ {!isCommitInfoModal && (
{date}
From dc1b079f77415c7cd5bc19f6250a07e13a68ea2e Mon Sep 17 00:00:00 2001
From: shivani170
Date: Fri, 18 Oct 2024 18:39:27 +0530
Subject: [PATCH 02/64] feat: commit info card ui modification
---
.../GitCommitInfoGeneric.tsx | 232 +++++++++---------
.../MaterialHistory.component.tsx | 1 -
2 files changed, 116 insertions(+), 117 deletions(-)
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 4da369fef..0721ff964 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -21,17 +21,16 @@ import Tippy from '@tippyjs/react'
import ClipboardButton from '@Common/ClipboardButton/ClipboardButton'
import { ReactComponent as Circle } from '@Icons/ic-circle.svg'
import { ReactComponent as Commit } from '@Icons/ic-commit.svg'
-import { ReactComponent as CommitIcon } from '@Icons/ic-code-commit.svg'
import { ReactComponent as PersonIcon } from '@Icons/ic-person.svg'
import { ReactComponent as CalendarIcon } from '@Icons/ic-calendar.svg'
import { ReactComponent as MessageIcon } from '@Icons/ic-message.svg'
-import { ReactComponent as BranchIcon } from '@Icons/ic-branch.svg'
-import { ReactComponent as BranchMain } from '@Icons/ic-branch-main.svg'
+import { ReactComponent as PullRequestIcon } from '@Icons/ic-pull-request.svg'
import { ReactComponent as Check } from '@Icons/ic-check-circle.svg'
import { ReactComponent as Abort } from '@Icons/ic-abort.svg'
import { SourceTypeMap, createGitCommitUrl } from '@Common/Common.service'
import { stopPropagation } from '@Common/Helper'
import { DATE_TIME_FORMATS } from '@Common/Constants'
+import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
import GitMaterialInfoHeader from './GitMaterialInfoHeader'
import { MATERIAL_EXCLUDE_TIPPY_TEXT } from '../../constants'
import { WEBHOOK_EVENT_ACTION_TYPE } from './constants'
@@ -44,7 +43,6 @@ const GitCommitInfoGeneric = ({
selectedCommitInfo,
materialUrl,
showMaterialInfoHeader,
- canTriggerBuild = false,
index,
isExcluded = false,
}: GitCommitInfoGenericProps) => {
@@ -213,6 +211,118 @@ const GitCommitInfoGeneric = ({
return matSelectionText()
}
+ const renderWebhookTitle = () =>
+ _webhookData.data.title ? {_webhookData.data.title} : null
+
+ const renderPullRequestId = (pullRequestUrl: string) => {
+ const pullRequestId = pullRequestUrl.split('/').pop()
+ if (pullRequestId) {
+ return (
+
+ # {pullRequestId}
+
+ )
+ }
+ return null
+ }
+
+ const renderTargetBranch = () => {
+ if (_webhookData.data['target branch name']) {
+ return (
+
+ )
+ }
+ return null
+ }
+
+ const renderSourceBranch = () => {
+ if (_webhookData.data['source branch name']) {
+ return (
+
+ )
+ }
+ return null
+ }
+
+ const renderPRInfoCard = () =>
+ _isWebhook &&
+ _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
+ <>
+ {renderPullRequestId(_webhookData.data['git url'])}
+
+ {renderWebhookTitle()}
+ {selectedCommitInfo ? (
+
+ {_lowerCaseCommitInfo.isselected ? (
+
+ ) : (
+
+ )}
+
+ ) : null}
+
+
+
+
+
+ Merge 1 commit
+ {renderTargetBranch()}
+ {renderSourceBranch()}
+
+
+ {renderBasicGitCommitInfoForWebhook()}
+ {handleMoreDataForWebhook()}
+ >
+ )
+
+ const renderTagInfoCard = () =>
+ _isWebhook &&
+ _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
+ <>
+
+
+
+ {_webhookData.data['target checkout']}
+
+ {selectedCommitInfo ? (
+
+ {_lowerCaseCommitInfo.isselected ? : 'Select'}
+
+ ) : null}
+
+ {renderBasicGitCommitInfoForWebhook()}
+ {handleMoreDataForWebhook()}
+ >
+ )
+
return (
{showMaterialInfoHeader && (_isWebhook || _lowerCaseCommitInfo.commit) && (
@@ -288,118 +398,8 @@ const GitCommitInfoGeneric = ({
>
)}
- {_isWebhook && _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
- <>
-
-
- {_webhookData.data.title ? (
-
{_webhookData.data.title}
- ) : null}
- {_webhookData.data['git url'] ? (
-
- View git url
-
- ) : null}
-
- {selectedCommitInfo ? (
-
- {_lowerCaseCommitInfo.isselected ? (
-
- ) : (
-
- )}
-
- ) : null}
-
-
-
-
-
-
-
- {_webhookData.data['source branch name'] ? (
-
- {' '}
- {_webhookData.data['source branch name']}
-
- ) : null}
- {_webhookData.data['source checkout'] ? (
-
- ) : null}
-
-
-
- {_webhookData.data['target branch name'] ? (
- <>
- {' '}
- {_webhookData.data['target branch name']}{' '}
- >
- ) : null}
-
-
-
-
-
-
- {renderBasicGitCommitInfoForWebhook()}
- {handleMoreDataForWebhook()}
- >
- )}
- {_isWebhook && _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
- <>
-
-
{_webhookData.data['target checkout']}
- {selectedCommitInfo ? (
-
- {_lowerCaseCommitInfo.isselected ? : 'Select'}
-
- ) : null}
-
- {renderBasicGitCommitInfoForWebhook()}
- {handleMoreDataForWebhook()}
- >
- )}
+ {renderPRInfoCard()}
+ {renderTagInfoCard()}
)
diff --git a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
index e63c4df9f..d2f4eba6c 100644
--- a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
+++ b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
@@ -87,7 +87,6 @@ const MaterialHistory = ({
materialSourceType={material.type}
selectedCommitInfo={selectCommit}
materialSourceValue={material.value}
- canTriggerBuild={!history.excluded}
isExcluded={history.excluded}
/>
From 0bda2bba0ac969d3a17a0762ec22e9e93f1eae39 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Mon, 21 Oct 2024 16:15:09 +0530
Subject: [PATCH 03/64] chore: code refactoring
---
.../GitCommitInfoGeneric.tsx | 24 ++-----------
.../MaterialHistory.component.tsx | 7 +++-
src/Shared/Helpers.tsx | 35 +++++++++++++++++++
src/Shared/Services/app.types.ts | 2 +-
4 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 0721ff964..1a2f5050c 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -31,6 +31,7 @@ import { SourceTypeMap, createGitCommitUrl } from '@Common/Common.service'
import { stopPropagation } from '@Common/Helper'
import { DATE_TIME_FORMATS } from '@Common/Constants'
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
+import { _lowerCaseObject, getWebhookDate } from '@Shared/Helpers'
import GitMaterialInfoHeader from './GitMaterialInfoHeader'
import { MATERIAL_EXCLUDE_TIPPY_TEXT } from '../../constants'
import { WEBHOOK_EVENT_ACTION_TYPE } from './constants'
@@ -48,23 +49,6 @@ const GitCommitInfoGeneric = ({
}: GitCommitInfoGenericProps) => {
const [showSeeMore, setShowSeeMore] = useState(true)
- function _lowerCaseObject(input): any {
- const _output = {}
- if (!input) {
- return _output
- }
- Object.keys(input).forEach((_key) => {
- const _modifiedKey = _key.toLowerCase()
- const _value = input[_key]
- if (_value && typeof _value === 'object') {
- _output[_modifiedKey] = _lowerCaseObject(_value)
- } else {
- _output[_modifiedKey] = _value
- }
- })
- return _output
- }
-
const _lowerCaseCommitInfo = _lowerCaseObject(commitInfo)
const _isWebhook =
materialSourceType === SourceTypeMap.WEBHOOK ||
@@ -78,11 +62,7 @@ const GitCommitInfoGeneric = ({
: createGitCommitUrl(materialUrl, _lowerCaseCommitInfo.commit)
function renderBasicGitCommitInfoForWebhook() {
- let _date
- if (_webhookData.data.date) {
- const _moment = moment(_webhookData.data.date, 'YYYY-MM-DDTHH:mm:ssZ')
- _date = _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : _webhookData.data.date
- }
+ const _date = getWebhookDate(materialSourceType, commitInfo)
return (
<>
{_webhookData.data.author ? (
diff --git a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
index d2f4eba6c..d90938526 100644
--- a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
+++ b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import { getWebhookDate } from '@Shared/Helpers'
import { SourceTypeMap } from '../../../Common'
import { GitCommitInfoGeneric } from '../GitCommitInfoGeneric'
import { MaterialHistoryProps } from './types'
@@ -36,7 +37,11 @@ const MaterialHistory = ({
const historyTimeMap = {}
material.history.forEach((history) => {
- const newDate = history.date.substring(0, 16)
+ const isWebhook = material.type === SourceTypeMap.WEBHOOK
+
+ const newDate = isWebhook
+ ? getWebhookDate(material.type, history).substring(0, 16)
+ : history.date.substring(0, 16)
if (!historyTimeMap[newDate]) {
historyTimeMap[newDate] = []
diff --git a/src/Shared/Helpers.tsx b/src/Shared/Helpers.tsx
index 5eaac04f8..756063b55 100644
--- a/src/Shared/Helpers.tsx
+++ b/src/Shared/Helpers.tsx
@@ -19,6 +19,7 @@ import { useEffect, useRef, useState, ReactElement } from 'react'
import Tippy from '@tippyjs/react'
import { Pair } from 'yaml'
import moment from 'moment'
+import { MaterialHistoryType } from '@Shared/Services/app.types'
import {
handleUTCTime,
ManualApprovalType,
@@ -30,6 +31,8 @@ import {
PATTERNS,
ZERO_TIME_STRING,
noop,
+ SourceTypeMap,
+ DATE_TIME_FORMATS,
} from '../Common'
import {
AggregationKeys,
@@ -852,3 +855,35 @@ export const groupArrayByObjectKey = , K extends k
},
{} as Record,
)
+
+export const _lowerCaseObject = (input): any => {
+ const _output = {}
+ if (!input) {
+ return _output
+ }
+ Object.keys(input).forEach((_key) => {
+ const _modifiedKey = _key.toLowerCase()
+ const _value = input[_key]
+ if (_value && typeof _value === 'object') {
+ _output[_modifiedKey] = _lowerCaseObject(_value)
+ } else {
+ _output[_modifiedKey] = _value
+ }
+ })
+ return _output
+}
+
+export const getWebhookDate = (materialSourceType: string, history: MaterialHistoryType): string => {
+ const _lowerCaseCommitInfo = _lowerCaseObject(history)
+ const _isWebhook =
+ materialSourceType === SourceTypeMap.WEBHOOK ||
+ (_lowerCaseCommitInfo && _lowerCaseCommitInfo.webhookdata && _lowerCaseCommitInfo.webhookdata.id !== 0)
+ const _webhookData = _isWebhook ? _lowerCaseCommitInfo.webhookdata : {}
+
+ let _date
+ if (_webhookData.data.date) {
+ const _moment = moment(_webhookData.data.date, 'YYYY-MM-DDTHH:mm:ssZ')
+ _date = _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : _webhookData.data.date
+ }
+ return _date
+}
diff --git a/src/Shared/Services/app.types.ts b/src/Shared/Services/app.types.ts
index cf3d4f31a..4fcddce43 100644
--- a/src/Shared/Services/app.types.ts
+++ b/src/Shared/Services/app.types.ts
@@ -31,7 +31,7 @@ interface MaterialHistoryDTO {
WebhookData: WebhookDataType
}
-interface MaterialHistoryType {
+export interface MaterialHistoryType {
commitURL: string
commit: MaterialHistoryDTO['Commit']
author: MaterialHistoryDTO['Author']
From b1c724dd9801713dea61bd28e894c97c690b2778 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Mon, 21 Oct 2024 17:51:00 +0530
Subject: [PATCH 04/64] chore: hrlpers utils refactoring
---
.../GitCommitInfoGeneric.tsx | 36 ++++++-------
src/Shared/Helpers.tsx | 53 ++++++++++---------
2 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 1a2f5050c..2c4ec582a 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -31,7 +31,7 @@ import { SourceTypeMap, createGitCommitUrl } from '@Common/Common.service'
import { stopPropagation } from '@Common/Helper'
import { DATE_TIME_FORMATS } from '@Common/Constants'
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
-import { _lowerCaseObject, getWebhookDate } from '@Shared/Helpers'
+import { getLowerCaseObject, getWebhookDate } from '@Shared/Helpers'
import GitMaterialInfoHeader from './GitMaterialInfoHeader'
import { MATERIAL_EXCLUDE_TIPPY_TEXT } from '../../constants'
import { WEBHOOK_EVENT_ACTION_TYPE } from './constants'
@@ -49,7 +49,7 @@ const GitCommitInfoGeneric = ({
}: GitCommitInfoGenericProps) => {
const [showSeeMore, setShowSeeMore] = useState(true)
- const _lowerCaseCommitInfo = _lowerCaseObject(commitInfo)
+ const _lowerCaseCommitInfo = getLowerCaseObject(commitInfo)
const _isWebhook =
materialSourceType === SourceTypeMap.WEBHOOK ||
(_lowerCaseCommitInfo && _lowerCaseCommitInfo.webhookdata && _lowerCaseCommitInfo.webhookdata.id !== 0)
@@ -196,26 +196,24 @@ const GitCommitInfoGeneric = ({
const renderPullRequestId = (pullRequestUrl: string) => {
const pullRequestId = pullRequestUrl.split('/').pop()
- if (pullRequestId) {
- return (
-
- # {pullRequestId}
-
- )
- }
- return null
+
+ return (
+
+ # {typeof pullRequestId === 'number' ? pullRequestId : 'PR'}
+
+ )
}
const renderTargetBranch = () => {
if (_webhookData.data['target branch name']) {
return (
-
+
)
}
return null
@@ -273,7 +271,7 @@ const GitCommitInfoGeneric = ({
- Merge 1 commit
+ Merge commit
{renderTargetBranch()}
{renderSourceBranch()}
diff --git a/src/Shared/Helpers.tsx b/src/Shared/Helpers.tsx
index 756063b55..8f5e8af10 100644
--- a/src/Shared/Helpers.tsx
+++ b/src/Shared/Helpers.tsx
@@ -856,34 +856,39 @@ export const groupArrayByObjectKey =
, K extends k
{} as Record,
)
-export const _lowerCaseObject = (input): any => {
- const _output = {}
- if (!input) {
- return _output
+/**
+ * @description - Function to get the lower case object
+ * @param input - The input object
+ * @returns Record
+ */
+export const getLowerCaseObject = (input): Record => {
+ if (!input || typeof input !== 'object') {
+ return input
}
- Object.keys(input).forEach((_key) => {
- const _modifiedKey = _key.toLowerCase()
- const _value = input[_key]
- if (_value && typeof _value === 'object') {
- _output[_modifiedKey] = _lowerCaseObject(_value)
+ return Object.keys(input).reduce((acc, key) => {
+ const modifiedKey = key.toLowerCase()
+ const value = input[key]
+ if (value && typeof value === 'object') {
+ acc[modifiedKey] = getLowerCaseObject(value)
} else {
- _output[_modifiedKey] = _value
+ acc[modifiedKey] = value
}
- })
- return _output
+ return acc
+ }, {})
}
+/**
+ * @description - Function to get the webhook date
+ * @param materialSourceType - The type of material source (e.g., WEBHOOK)
+ * @param history - The history object containing commit information
+ * @returns - Formatted webhook date if available, otherwise an empty string
+ */
+
export const getWebhookDate = (materialSourceType: string, history: MaterialHistoryType): string => {
- const _lowerCaseCommitInfo = _lowerCaseObject(history)
- const _isWebhook =
- materialSourceType === SourceTypeMap.WEBHOOK ||
- (_lowerCaseCommitInfo && _lowerCaseCommitInfo.webhookdata && _lowerCaseCommitInfo.webhookdata.id !== 0)
- const _webhookData = _isWebhook ? _lowerCaseCommitInfo.webhookdata : {}
-
- let _date
- if (_webhookData.data.date) {
- const _moment = moment(_webhookData.data.date, 'YYYY-MM-DDTHH:mm:ssZ')
- _date = _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : _webhookData.data.date
- }
- return _date
+ const lowerCaseCommitInfo = getLowerCaseObject(history)
+ const isWebhook = materialSourceType === SourceTypeMap.WEBHOOK || lowerCaseCommitInfo?.webhookdata?.id !== 0
+ const webhookData = isWebhook ? lowerCaseCommitInfo.webhookdata : {}
+
+ const _moment = moment(webhookData.data.date, 'YYYY-MM-DDTHH:mm:ssZ')
+ return _moment.isValid() ? _moment.format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT) : webhookData.data.date
}
From 3de590ee58bdeeec50469071b4752696a3a14398 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 22 Oct 2024 09:52:32 +0530
Subject: [PATCH 05/64] chore: code refactoring
---
src/Common/Common.service.ts | 21 +++-
src/Common/Constants.ts | 8 ++
.../GitCommitInfoGeneric.tsx | 106 +++++++-----------
.../MaterialHistory.component.tsx | 35 +++---
src/Shared/Services/app.types.ts | 1 +
5 files changed, 85 insertions(+), 86 deletions(-)
diff --git a/src/Common/Common.service.ts b/src/Common/Common.service.ts
index 99e28ff6c..fddf52533 100644
--- a/src/Common/Common.service.ts
+++ b/src/Common/Common.service.ts
@@ -18,7 +18,7 @@ import moment from 'moment'
import { RuntimeParamsAPIResponseType, RuntimeParamsListItemType } from '@Shared/types'
import { getIsManualApprovalSpecific, sanitizeUserApprovalConfig, stringComparatorBySortOrder } from '@Shared/Helpers'
import { get, post } from './Api'
-import { ROUTES } from './Constants'
+import { GitProviderType, ROUTES } from './Constants'
import { getUrlWithSearchParams, sortCallback } from './Helper'
import {
TeamList,
@@ -511,3 +511,22 @@ export function getWebhookEventsForEventId(eventId: string | number) {
const URL = `${ROUTES.GIT_HOST_EVENT}/${eventId}`
return get(URL)
}
+
+export const getGitBranchUrl = (gitUrl: string, branchName: string): string | null => {
+ if (!gitUrl) return null
+
+ const trimmedGitUrl = gitUrl.trim().replace(/\/$/, '') // Remove any trailing slash
+
+ switch (true) {
+ case trimmedGitUrl.includes(GitProviderType.GITLAB):
+ return `${trimmedGitUrl}/-/tree/${branchName}`
+ case trimmedGitUrl.includes(GitProviderType.GITHUB):
+ return `${trimmedGitUrl}/tree/${branchName}`
+ case trimmedGitUrl.includes(GitProviderType.BITBUCKET):
+ return `${trimmedGitUrl}/branch/${branchName}`
+ case trimmedGitUrl.includes(GitProviderType.AZURE):
+ return `${trimmedGitUrl}/src/branch/${branchName}`
+ default:
+ return null
+ }
+}
\ No newline at end of file
diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts
index f15e80ef6..db2bfc643 100644
--- a/src/Common/Constants.ts
+++ b/src/Common/Constants.ts
@@ -554,3 +554,11 @@ export const VULNERABILITIES_SORT_PRIORITY = {
// TODO: might not work need to verify
export const IS_PLATFORM_MAC_OS = window.navigator.userAgent.toUpperCase().includes('MAC')
+
+export enum GitProviderType {
+ GITHUB = 'github',
+ GITLAB = 'gitlab',
+ BITBUCKET = 'bitbucket',
+ AZURE = 'azure',
+ GITEA = 'gitea',
+}
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 2c4ec582a..b1b7c3387 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -27,7 +27,7 @@ import { ReactComponent as MessageIcon } from '@Icons/ic-message.svg'
import { ReactComponent as PullRequestIcon } from '@Icons/ic-pull-request.svg'
import { ReactComponent as Check } from '@Icons/ic-check-circle.svg'
import { ReactComponent as Abort } from '@Icons/ic-abort.svg'
-import { SourceTypeMap, createGitCommitUrl } from '@Common/Common.service'
+import { SourceTypeMap, createGitCommitUrl, getGitBranchUrl } from '@Common/Common.service'
import { stopPropagation } from '@Common/Helper'
import { DATE_TIME_FORMATS } from '@Common/Constants'
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
@@ -49,17 +49,17 @@ const GitCommitInfoGeneric = ({
}: GitCommitInfoGenericProps) => {
const [showSeeMore, setShowSeeMore] = useState(true)
- const _lowerCaseCommitInfo = getLowerCaseObject(commitInfo)
+ const lowerCaseCommitInfo = getLowerCaseObject(commitInfo)
const _isWebhook =
materialSourceType === SourceTypeMap.WEBHOOK ||
- (_lowerCaseCommitInfo && _lowerCaseCommitInfo.webhookdata && _lowerCaseCommitInfo.webhookdata.id !== 0)
- const _webhookData = _isWebhook ? _lowerCaseCommitInfo.webhookdata : {}
+ (lowerCaseCommitInfo && lowerCaseCommitInfo.webhookdata && lowerCaseCommitInfo.webhookdata.id !== 0)
+ const _webhookData = _isWebhook ? lowerCaseCommitInfo.webhookdata : {}
// eslint-disable-next-line no-nested-ternary
const _commitUrl = _isWebhook
? null
- : _lowerCaseCommitInfo.commiturl
- ? _lowerCaseCommitInfo.commiturl
- : createGitCommitUrl(materialUrl, _lowerCaseCommitInfo.commit)
+ : lowerCaseCommitInfo.commiturl
+ ? lowerCaseCommitInfo.commiturl
+ : createGitCommitUrl(materialUrl, lowerCaseCommitInfo.commit)
function renderBasicGitCommitInfoForWebhook() {
const _date = getWebhookDate(materialSourceType, commitInfo)
@@ -185,7 +185,7 @@ const GitCommitInfoGeneric = ({
}
const renderCommitStatus = () => {
- if (_lowerCaseCommitInfo.isselected) {
+ if (lowerCaseCommitInfo.isselected) {
return
}
return matSelectionText()
@@ -202,53 +202,26 @@ const GitCommitInfoGeneric = ({
href={pullRequestUrl}
target="_blank"
rel="noopener noreferrer"
- className="commit-hash fs-14 px-6 mono dc__w-fit-content"
+ className="commit-hash fs-14 px-6 mono dc__w-fit-content cursor"
onClick={stopPropagation}
>
- # {typeof pullRequestId === 'number' ? pullRequestId : 'PR'}
+ # {Number.isNaN(pullRequestId) ? 'PR' : pullRequestId}
)
}
- const renderTargetBranch = () => {
- if (_webhookData.data['target branch name']) {
- return (
-
- into
-
- {_webhookData.data['target branch name']}
-
-
- )
- }
- return null
- }
-
- const renderSourceBranch = () => {
- if (_webhookData.data['source branch name']) {
- return (
-
- )
- }
- return null
- }
+ const renderBranchName = (branchName: string) =>
+ branchName ? (
+
+ {branchName}
+
+ ) : null
const renderPRInfoCard = () =>
_isWebhook &&
@@ -259,7 +232,7 @@ const GitCommitInfoGeneric = ({
{renderWebhookTitle()}
{selectedCommitInfo ? (
- {_lowerCaseCommitInfo.isselected ? (
+ {lowerCaseCommitInfo.isselected ? (
) : (
@@ -271,9 +244,10 @@ const GitCommitInfoGeneric = ({
- Merge commit
- {renderTargetBranch()}
- {renderSourceBranch()}
+ Merge commit into
+ {renderBranchName(_webhookData.data['target branch name'])}
+ from
+ {renderBranchName(_webhookData.data['source branch name'])}
{renderBasicGitCommitInfoForWebhook()}
@@ -292,7 +266,7 @@ const GitCommitInfoGeneric = ({
{selectedCommitInfo ? (
- {_lowerCaseCommitInfo.isselected ? : 'Select'}
+ {lowerCaseCommitInfo.isselected ? : 'Select'}
) : null}
@@ -303,7 +277,7 @@ const GitCommitInfoGeneric = ({
return (
- {showMaterialInfoHeader && (_isWebhook || _lowerCaseCommitInfo.commit) && (
+ {showMaterialInfoHeader && (_isWebhook || lowerCaseCommitInfo.commit) && (
{!_isWebhook && (
<>
- {_lowerCaseCommitInfo.commit && (
+ {lowerCaseCommitInfo.commit && (
{_commitUrl ? (
@@ -331,44 +305,42 @@ const GitCommitInfoGeneric = ({
data-testid={`git-commit-credential${index}`}
>
- {_lowerCaseCommitInfo.commit.slice(0, 7)}
+ {lowerCaseCommitInfo.commit.slice(0, 7)}
-
+
) : null}
{selectedCommitInfo ? renderCommitStatus() : null}
)}
- {_lowerCaseCommitInfo.message ? (
+ {lowerCaseCommitInfo.message ? (
- {_lowerCaseCommitInfo.message}
+ {lowerCaseCommitInfo.message}
) : null}
- {_lowerCaseCommitInfo.author ? (
+ {lowerCaseCommitInfo.author ? (
-
{_lowerCaseCommitInfo.author}
+
{lowerCaseCommitInfo.author}
) : null}
- {_lowerCaseCommitInfo.date ? (
+ {lowerCaseCommitInfo.date ? (
- {moment(_lowerCaseCommitInfo.date).format(
- DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT,
- )}
+ {moment(lowerCaseCommitInfo.date).format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT)}
) : null}
diff --git a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
index d90938526..bf1eaef44 100644
--- a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
+++ b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
@@ -15,6 +15,8 @@
*/
import { getWebhookDate } from '@Shared/Helpers'
+import { MaterialHistoryType } from '@Shared/Services'
+import { useMemo } from 'react'
import { SourceTypeMap } from '../../../Common'
import { GitCommitInfoGeneric } from '../GitCommitInfoGeneric'
import { MaterialHistoryProps } from './types'
@@ -33,26 +35,23 @@ const MaterialHistory = ({
}
}
- const getMaterialHistoryMapWithTime = () => {
- const historyTimeMap = {}
-
- material.history.forEach((history) => {
- const isWebhook = material.type === SourceTypeMap.WEBHOOK
-
- const newDate = isWebhook
- ? getWebhookDate(material.type, history).substring(0, 16)
- : history.date.substring(0, 16)
-
- if (!historyTimeMap[newDate]) {
- historyTimeMap[newDate] = []
- }
- historyTimeMap[newDate].push(history)
- })
+ const materialHistoryMapWithTime = useMemo(
+ () =>
+ material.history.reduce
>((acc, historyElem: MaterialHistoryType) => {
+ const isWebhook = material.type === SourceTypeMap.WEBHOOK
+ const newDate = isWebhook
+ ? getWebhookDate(material.type, historyElem).substring(0, 16)
+ : historyElem.date.substring(0, 16)
+ if (!acc[newDate]) {
+ acc[newDate] = []
+ }
+ acc[newDate].push(historyElem)
+ return acc
+ }, {}),
+ [material.history, material.type],
+ )
- return historyTimeMap
- }
// Retrieve the history map
- const materialHistoryMapWithTime = getMaterialHistoryMapWithTime()
// Retrieve the keys of the history map
const dateKeys = Object.keys(materialHistoryMapWithTime)
diff --git a/src/Shared/Services/app.types.ts b/src/Shared/Services/app.types.ts
index 279e9006a..e2192d00d 100644
--- a/src/Shared/Services/app.types.ts
+++ b/src/Shared/Services/app.types.ts
@@ -84,6 +84,7 @@ export interface CIMaterialType
gitURL: CIMaterialDTO['url']
history: MaterialHistoryType[]
isSelected: boolean
+ gitMaterialUrl?: string
}
interface ImageCommentDTO {
From 0464aa4fb4c1e7fd65ad4573eb77640fea5960de Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 22 Oct 2024 10:57:16 +0530
Subject: [PATCH 06/64] chore: getFormattedSchema added
---
src/Common/Constants.ts | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts
index db2bfc643..7c5aded2d 100644
--- a/src/Common/Constants.ts
+++ b/src/Common/Constants.ts
@@ -555,6 +555,10 @@ export const VULNERABILITIES_SORT_PRIORITY = {
// TODO: might not work need to verify
export const IS_PLATFORM_MAC_OS = window.navigator.userAgent.toUpperCase().includes('MAC')
+/**
+ * Git provider types
+ */
+
export enum GitProviderType {
GITHUB = 'github',
GITLAB = 'gitlab',
@@ -562,3 +566,8 @@ export enum GitProviderType {
AZURE = 'azure',
GITEA = 'gitea',
}
+
+/**
+ * Formats the schema removing any irregularity in the existing schema
+ */
+export const getFormattedSchema = (schema?: string) => JSON.stringify(JSON.parse(schema ?? '{}'), null, 2)
From 18aa6d682798ba024b81e750ca46d5fe1759a452 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 22 Oct 2024 16:21:25 +0530
Subject: [PATCH 07/64] chore: version bump
---
package-lock.json | 4 ++--
package.json | 2 +-
.../Components/CICDHistory/CiPipelineSourceConfig.tsx | 6 +++++-
.../GitCommitInfoGeneric/GitCommitInfoGeneric.tsx | 4 ++--
.../MaterialHistory/MaterialHistory.component.tsx | 4 ++--
5 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 5b2219979..49904c6b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8",
+ "version": "0.5.8-beta-3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8",
+ "version": "0.5.8-beta-3",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 71f17bf42..4320ade74 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8",
+ "version": "0.5.8-beta-3",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
diff --git a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
index ba981e735..2aef84f47 100644
--- a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
+++ b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
@@ -169,7 +169,11 @@ export const CiPipelineSourceConfig = ({
)}
>
)}
- {baseText && {baseText}}
+ {baseText && (
+
+ {baseText}
+
+ )}
)}
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index b1b7c3387..f0f0f82fc 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -192,7 +192,7 @@ const GitCommitInfoGeneric = ({
}
const renderWebhookTitle = () =>
- _webhookData.data.title ? {_webhookData.data.title} : null
+ _webhookData.data.title ? {_webhookData.data.title} : null
const renderPullRequestId = (pullRequestUrl: string) => {
const pullRequestId = pullRequestUrl.split('/').pop()
@@ -228,7 +228,7 @@ const GitCommitInfoGeneric = ({
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
<>
{renderPullRequestId(_webhookData.data['git url'])}
-
+
{renderWebhookTitle()}
{selectedCommitInfo ? (
diff --git a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
index bf1eaef44..c4db340a4 100644
--- a/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
+++ b/src/Shared/Components/MaterialHistory/MaterialHistory.component.tsx
@@ -62,7 +62,7 @@ const MaterialHistory = ({
{dateKeys.map((date) => {
const historyList = materialHistoryMapWithTime[date]
return (
- <>
+
{!isCommitInfoModal && (
{date}
@@ -96,7 +96,7 @@ const MaterialHistory = ({
)
})}
- >
+
)
})}
>
From 96ddc7f59fe9ab412ef4c2a9e4d647c22b82c97e Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 22 Oct 2024 18:07:02 +0530
Subject: [PATCH 08/64] chore: version bump
---
package-lock.json | 4 ++--
package.json | 2 +-
src/Common/Common.service.ts | 29 +++++++++++++----------------
3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 49904c6b1..0892335a4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8-beta-3",
+ "version": "0.5.8-beta-4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8-beta-3",
+ "version": "0.5.8-beta-4",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 4320ade74..6cd6a7dee 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.5.8-beta-3",
+ "version": "0.5.8-beta-4",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
diff --git a/src/Common/Common.service.ts b/src/Common/Common.service.ts
index fddf52533..c294997b1 100644
--- a/src/Common/Common.service.ts
+++ b/src/Common/Common.service.ts
@@ -250,7 +250,7 @@ const getImageApprovalPolicyDetailsFromMaterialResult = (cdMaterialsResult): Ima
const validGroups = userApprovalConfig.userGroups.map((group) => group.identifier)
// Have moved from Object.keys(imageApprovalUsersInfo) to approvalUsers since backend is not filtering out the users without approval
- // TODO: This check should be on BE. Need to remove this once BE is updated
+ // TODO: This check should be on BE. Need to remove this once BE is updated
const usersList = approvalUsers.filter((user) => user !== DefaultUserKey.system)
const groupIdentifierToUsersMap = usersList.reduce(
(acc, user) => {
@@ -512,21 +512,18 @@ export function getWebhookEventsForEventId(eventId: string | number) {
return get(URL)
}
+/**
+ *
+ * @param gitUrl Git URL of the repository
+ * @param branchName Branch name
+ * @returns URL to the branch in the Git repository
+ */
export const getGitBranchUrl = (gitUrl: string, branchName: string): string | null => {
if (!gitUrl) return null
-
const trimmedGitUrl = gitUrl.trim().replace(/\/$/, '') // Remove any trailing slash
-
- switch (true) {
- case trimmedGitUrl.includes(GitProviderType.GITLAB):
- return `${trimmedGitUrl}/-/tree/${branchName}`
- case trimmedGitUrl.includes(GitProviderType.GITHUB):
- return `${trimmedGitUrl}/tree/${branchName}`
- case trimmedGitUrl.includes(GitProviderType.BITBUCKET):
- return `${trimmedGitUrl}/branch/${branchName}`
- case trimmedGitUrl.includes(GitProviderType.AZURE):
- return `${trimmedGitUrl}/src/branch/${branchName}`
- default:
- return null
- }
-}
\ No newline at end of file
+ if (trimmedGitUrl.includes(GitProviderType.GITLAB)) return `${trimmedGitUrl}/-/tree/${branchName}`
+ else if (trimmedGitUrl.includes(GitProviderType.GITHUB)) return `${trimmedGitUrl}/tree/${branchName}`
+ else if (trimmedGitUrl.includes(GitProviderType.BITBUCKET)) return `${trimmedGitUrl}/branch/${branchName}`
+ else if (trimmedGitUrl.includes(GitProviderType.AZURE)) return `${trimmedGitUrl}/src/branch/${branchName}`
+ return null
+}
From 64e213cd0c672329a0dd4495b3afccc631607e98 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Mon, 4 Nov 2024 16:59:56 +0530
Subject: [PATCH 09/64] chore: hash icon added
---
src/Assets/Icon/ic-hash.svg | 3 ++
.../GitCommitInfoGeneric.tsx | 41 ++++++++++---------
2 files changed, 25 insertions(+), 19 deletions(-)
create mode 100644 src/Assets/Icon/ic-hash.svg
diff --git a/src/Assets/Icon/ic-hash.svg b/src/Assets/Icon/ic-hash.svg
new file mode 100644
index 000000000..8220a82ae
--- /dev/null
+++ b/src/Assets/Icon/ic-hash.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index f0f0f82fc..4eaf1e83c 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -32,6 +32,7 @@ import { stopPropagation } from '@Common/Helper'
import { DATE_TIME_FORMATS } from '@Common/Constants'
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
import { getLowerCaseObject, getWebhookDate } from '@Shared/Helpers'
+import { ReactComponent as Hash } from '@Icons/ic-hash.svg'
import GitMaterialInfoHeader from './GitMaterialInfoHeader'
import { MATERIAL_EXCLUDE_TIPPY_TEXT } from '../../constants'
import { WEBHOOK_EVENT_ACTION_TYPE } from './constants'
@@ -64,25 +65,25 @@ const GitCommitInfoGeneric = ({
function renderBasicGitCommitInfoForWebhook() {
const _date = getWebhookDate(materialSourceType, commitInfo)
return (
- <>
+
{_webhookData.data.author ? (
-
+
{_webhookData.data.author}
) : null}
{_date ? (
-
+
) : null}
{_webhookData.data.message ? (
-
+
{_webhookData.data.message}
) : null}
- >
+
)
}
@@ -198,15 +199,17 @@ const GitCommitInfoGeneric = ({
const pullRequestId = pullRequestUrl.split('/').pop()
return (
-
- # {Number.isNaN(pullRequestId) ? 'PR' : pullRequestId}
-
+
)
}
@@ -226,9 +229,9 @@ const GitCommitInfoGeneric = ({
const renderPRInfoCard = () =>
_isWebhook &&
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
- <>
+
{renderPullRequestId(_webhookData.data['git url'])}
-
+
{renderWebhookTitle()}
{selectedCommitInfo ? (
@@ -241,7 +244,7 @@ const GitCommitInfoGeneric = ({
) : null}
-
+
Merge commit into
@@ -252,7 +255,7 @@ const GitCommitInfoGeneric = ({
{renderBasicGitCommitInfoForWebhook()}
{handleMoreDataForWebhook()}
- >
+
)
const renderTagInfoCard = () =>
@@ -260,7 +263,7 @@ const GitCommitInfoGeneric = ({
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
<>
-
+
{_webhookData.data['target checkout']}
From 3d74f3fd1e48ba013ec6897fcbc9f162a42224a7 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 5 Nov 2024 08:31:25 +0530
Subject: [PATCH 10/64] chore: version bump
---
package-lock.json | 4 +-
package.json | 2 +-
.../GitCommitInfoGeneric.tsx | 51 +++++++++----------
3 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index a0026053e..988919486 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-2",
+ "version": "0.6.4-beta-3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-2",
+ "version": "0.6.4-beta-3",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 26250d588..9a0153d39 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-2",
+ "version": "0.6.4-beta-3",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 4eaf1e83c..900fdbaf1 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -62,10 +62,32 @@ const GitCommitInfoGeneric = ({
? lowerCaseCommitInfo.commiturl
: createGitCommitUrl(materialUrl, lowerCaseCommitInfo.commit)
+ const renderBranchName = (branchName: string) =>
+ branchName ? (
+
+ {branchName}
+
+ ) : null
+
function renderBasicGitCommitInfoForWebhook() {
const _date = getWebhookDate(materialSourceType, commitInfo)
return (
+
+
+
+ Merge commit into
+ {renderBranchName(_webhookData.data['target branch name'])}
+ from
+ {renderBranchName(_webhookData.data['source branch name'])}
+
+
{_webhookData.data.author ? (
{_webhookData.data.author}
@@ -213,26 +235,12 @@ const GitCommitInfoGeneric = ({
)
}
- const renderBranchName = (branchName: string) =>
- branchName ? (
-
- {branchName}
-
- ) : null
-
const renderPRInfoCard = () =>
_isWebhook &&
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
-
- {renderPullRequestId(_webhookData.data['git url'])}
+
- {renderWebhookTitle()}
+ {renderPullRequestId(_webhookData.data['git url'])}
{selectedCommitInfo ? (
{lowerCaseCommitInfo.isselected ? (
@@ -243,16 +251,7 @@ const GitCommitInfoGeneric = ({
) : null}
-
-
-
-
- Merge commit into
- {renderBranchName(_webhookData.data['target branch name'])}
- from
- {renderBranchName(_webhookData.data['source branch name'])}
-
-
+ {renderWebhookTitle()}
{renderBasicGitCommitInfoForWebhook()}
{handleMoreDataForWebhook()}
From f2ff26877459c9c6cfbb2b5582cbc0e8650b7022 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Tue, 5 Nov 2024 08:32:03 +0530
Subject: [PATCH 11/64] chore: version bump
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 988919486..90c894d33 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-4",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 9a0153d39..539d3caa1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-4",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
From a80a176fdc5628bcffa532f09a429d49c71412a1 Mon Sep 17 00:00:00 2001
From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com>
Date: Tue, 5 Nov 2024 13:40:41 +0530
Subject: [PATCH 12/64] fix: payload for getPluginsDetails
---
src/Common/Policy.Types.ts | 2 +-
src/Shared/Components/Plugin/service.tsx | 21 +++++++++++++++------
src/Shared/Components/Plugin/types.ts | 10 +++++-----
3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/Common/Policy.Types.ts b/src/Common/Policy.Types.ts
index b18617026..c3200e20c 100644
--- a/src/Common/Policy.Types.ts
+++ b/src/Common/Policy.Types.ts
@@ -95,7 +95,7 @@ export type ProcessPluginDataParamsType = {
/**
* Would be sent in case we have to get data for steps
*/
- requiredPluginIds?: PluginDetailPayloadType['pluginId']
+ requiredPluginIds?: PluginDetailPayloadType['pluginIds']
} & (ProcessPluginDataCIParamsType | ProcessPluginDataCDParamsType)
export enum ConsequenceAction {
diff --git a/src/Shared/Components/Plugin/service.tsx b/src/Shared/Components/Plugin/service.tsx
index 1dc8ae23f..4ce04b761 100644
--- a/src/Shared/Components/Plugin/service.tsx
+++ b/src/Shared/Components/Plugin/service.tsx
@@ -14,7 +14,15 @@
* limitations under the License.
*/
-import { get, getIsRequestAborted, getUrlWithSearchParams, ResponseType, ROUTES, showError } from '../../../Common'
+import {
+ get,
+ getIsRequestAborted,
+ getUrlWithSearchParams,
+ post,
+ ResponseType,
+ ROUTES,
+ showError,
+} from '../../../Common'
import { stringComparatorBySortOrder } from '../../Helpers'
import {
GetParentPluginListPayloadType,
@@ -41,13 +49,14 @@ export const getPluginsDetail = async ({
try {
const payload: PluginDetailPayloadType = {
appId,
- parentPluginId: parentPluginIds,
- pluginId: pluginIds,
- parentPluginIdentifier: parentPluginIdentifiers ? `${parentPluginIdentifiers}` : null,
+ parentPluginIds,
+ pluginIds,
+ parentPluginIdentifiers,
}
- const { result } = await get(
- getUrlWithSearchParams(ROUTES.PLUGIN_GLOBAL_LIST_DETAIL_V2, payload),
+ const { result } = await post(
+ ROUTES.PLUGIN_GLOBAL_LIST_DETAIL_V2,
+ payload,
{ signal },
)
diff --git a/src/Shared/Components/Plugin/types.ts b/src/Shared/Components/Plugin/types.ts
index 972c2f8d2..cea743f08 100644
--- a/src/Shared/Components/Plugin/types.ts
+++ b/src/Shared/Components/Plugin/types.ts
@@ -94,11 +94,11 @@ export interface PluginDetailServiceParamsType {
signal?: AbortSignal
}
-export interface PluginDetailPayloadType extends Pick {
- pluginId?: PluginDetailServiceParamsType['pluginIds']
- parentPluginId?: PluginDetailServiceParamsType['parentPluginIds']
- parentPluginIdentifier?: PluginDetailServiceParamsType['parentPluginIdentifiers'][number]
-}
+export interface PluginDetailPayloadType
+ extends Pick<
+ PluginDetailServiceParamsType,
+ 'appId' | 'parentPluginIds' | 'pluginIds' | 'parentPluginIdentifiers'
+ > {}
export interface PluginListFiltersType extends Pick, 'searchKey'> {
selectedTags: string[]
From 576353264b2c9cac5e292995c7864b06f5d4a604 Mon Sep 17 00:00:00 2001
From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:06:59 +0530
Subject: [PATCH 13/64] chore: bump version to 0.6.4-beta-6
---
package-lock.json | 4 ++--
package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 988919486..54b54a3aa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-6",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 9a0153d39..91bb140d3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.4-beta-3",
+ "version": "0.6.4-beta-6",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
From 18d50f04fc9b67636b0d511cb6416aea7c636d97 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Wed, 6 Nov 2024 18:26:25 +0530
Subject: [PATCH 14/64] chore: version bump
---
package-lock.json | 4 ++--
package.json | 2 +-
.../CICDHistory/CiPipelineSourceConfig.tsx | 15 +++------------
src/Shared/Components/CICDHistory/types.tsx | 12 ++++++++++++
.../GitCommitInfoGeneric/GitCommitInfoGeneric.tsx | 6 +++---
5 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 4995bef46..1666d9d98 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5",
+ "version": "0.6.5-beta-1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5",
+ "version": "0.6.5-beta-1",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 8b3b3cf5e..728a8b490 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5",
+ "version": "0.6.5-beta-1",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
diff --git a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
index 2aef84f47..2215ade6c 100644
--- a/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
+++ b/src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
@@ -23,17 +23,7 @@ import branchIcon from '../../../Assets/Icon/ic-branch.svg'
import { ReactComponent as Info } from '../../../Assets/Icon/ic-info-outlined.svg'
import regexIcon from '../../../Assets/Icon/ic-regex.svg'
import { buildHoverHtmlForWebhook } from './utils'
-
-export interface CIPipelineSourceConfigInterface {
- sourceType
- sourceValue
- showTooltip?: boolean
- showIcons?: boolean
- baseText?: string
- regex?: any
- isRegex?: boolean
- primaryBranchAfterRegex?: string
-}
+import { CIPipelineSourceConfigInterface } from './types'
export const CiPipelineSourceConfig = ({
sourceType,
@@ -44,6 +34,7 @@ export const CiPipelineSourceConfig = ({
regex,
isRegex,
primaryBranchAfterRegex,
+ rootClassName = '',
}: CIPipelineSourceConfigInterface) => {
const _isWebhook = sourceType === SourceTypeMap.WEBHOOK
const _isRegex = sourceType === SourceTypeMap.BranchRegex || !!regex || isRegex
@@ -133,7 +124,7 @@ export const CiPipelineSourceConfig = ({
const isRegexOrBranchIcon = _isRegex ? regexIcon : branchIcon
return (
-
+
{loading && showIcons &&
loading}
{!loading && (
diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx
index 7c5963fe0..441ff3693 100644
--- a/src/Shared/Components/CICDHistory/types.tsx
+++ b/src/Shared/Components/CICDHistory/types.tsx
@@ -791,3 +791,15 @@ export type CreateMarkupPropsType =
export type TriggerHistoryFilterCriteriaType = `${string}|${string}|${string}`[]
export const terminalStatus = new Set(['error', 'healthy', 'succeeded', 'cancelled', 'failed', 'aborted'])
export const statusSet = new Set(['starting', 'running', 'pending'])
+
+export interface CIPipelineSourceConfigInterface {
+ sourceType
+ sourceValue
+ showTooltip?: boolean
+ showIcons?: boolean
+ baseText?: string
+ regex?: any
+ isRegex?: boolean
+ primaryBranchAfterRegex?: string
+ rootClassName?: string
+}
diff --git a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
index 900fdbaf1..3077b0661 100644
--- a/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
+++ b/src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx
@@ -215,7 +215,7 @@ const GitCommitInfoGeneric = ({
}
const renderWebhookTitle = () =>
- _webhookData.data.title ?
{_webhookData.data.title} : null
+ _webhookData.data.title ?
{_webhookData.data.title} : null
const renderPullRequestId = (pullRequestUrl: string) => {
const pullRequestId = pullRequestUrl.split('/').pop()
@@ -244,9 +244,9 @@ const GitCommitInfoGeneric = ({
{selectedCommitInfo ? (
{lowerCaseCommitInfo.isselected ? (
-
+
) : (
-
+
)}
) : null}
From d9dcd5177649eb401de24afa11704e565fc37108 Mon Sep 17 00:00:00 2001
From: shivani170
Date: Thu, 7 Nov 2024 14:02:01 +0530
Subject: [PATCH 15/64] chore: ui fixes for commint card in git info
---
package-lock.json | 4 +--
package.json | 2 +-
src/Assets/Icon/ic-pull-request.svg | 4 +--
src/Assets/Icon/ic-tag.svg | 5 ++-
src/Common/Helper.tsx | 33 ++++++++++++++++++-
.../CICDHistory/CiPipelineSourceConfig.tsx | 15 +++------
src/Shared/Components/CICDHistory/utils.tsx | 22 ++++++-------
.../MaterialHistory.component.tsx | 4 +--
8 files changed, 57 insertions(+), 32 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1666d9d98..f0fa5cb0d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5-beta-1",
+ "version": "0.6.5-beta-3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5-beta-1",
+ "version": "0.6.5-beta-3",
"license": "ISC",
"dependencies": {
"@types/react-dates": "^21.8.6",
diff --git a/package.json b/package.json
index 728a8b490..d57bc2f32 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
- "version": "0.6.5-beta-1",
+ "version": "0.6.5-beta-3",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
diff --git a/src/Assets/Icon/ic-pull-request.svg b/src/Assets/Icon/ic-pull-request.svg
index 9ba5cc629..695951ef5 100644
--- a/src/Assets/Icon/ic-pull-request.svg
+++ b/src/Assets/Icon/ic-pull-request.svg
@@ -14,6 +14,6 @@
- limitations under the License.
-->
-