Skip to content
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
49ee3bd
Merge branch 'main' into feat/webhook-ui
shivani170 Oct 17, 2024
58eba54
chore: wip received playload
shivani170 Oct 17, 2024
cbcc969
feat: ui for tag & PR info card
shivani170 Oct 18, 2024
dc1b079
feat: commit info card ui modification
shivani170 Oct 18, 2024
0bda2bb
chore: code refactoring
shivani170 Oct 21, 2024
81a597a
Merge branch 'develop' into feat/webhook-ui
shivani170 Oct 21, 2024
b1c724d
chore: hrlpers utils refactoring
shivani170 Oct 21, 2024
3de590e
chore: code refactoring
shivani170 Oct 22, 2024
0464aa4
chore: getFormattedSchema added
shivani170 Oct 22, 2024
7cf8784
Merge branch 'develop' into feat/webhook-ui
shivani170 Oct 22, 2024
18aa6d6
chore: version bump
shivani170 Oct 22, 2024
96ddc7f
chore: version bump
shivani170 Oct 22, 2024
64e213c
chore: hash icon added
shivani170 Nov 4, 2024
e037f5b
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 4, 2024
3d74f3f
chore: version bump
shivani170 Nov 5, 2024
f2ff268
chore: version bump
shivani170 Nov 5, 2024
12b10e9
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 6, 2024
18d50f0
chore: version bump
shivani170 Nov 6, 2024
d9dcd51
chore: ui fixes for commint card in git info
shivani170 Nov 7, 2024
36f3a51
chore: version bump
shivani170 Nov 7, 2024
f5aff4c
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 7, 2024
e1efe70
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 8, 2024
212190e
chore: code refactoring
shivani170 Nov 8, 2024
378bae3
chore: version bump
shivani170 Nov 8, 2024
1191329
chore: overflow-issue fix
shivani170 Nov 11, 2024
47039cc
version bump
shivani170 Nov 11, 2024
ae81e5b
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 12, 2024
046e893
chore: version bump
shivani170 Nov 12, 2024
6251625
chore: copy icon added in pr tag
shivani170 Nov 12, 2024
51f0f41
chore: version bump
shivani170 Nov 12, 2024
f86f5cb
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 13, 2024
9dbcdc1
chore: version bump
shivani170 Nov 13, 2024
95013f6
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 14, 2024
dd84db6
chore: version bump
shivani170 Nov 14, 2024
65e2cb9
chore: version bump
shivani170 Nov 14, 2024
a740210
chore: removed see more see less view in info card
shivani170 Nov 15, 2024
0571ac0
chore: git info fix
shivani170 Nov 15, 2024
9781e4c
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 18, 2024
3bdfedc
chore: version bump to 1.0.5-beta-3
shivani170 Nov 18, 2024
3fdf3fc
chore: version bump 1.0.6
shivani170 Nov 18, 2024
f375263
chore: version bump to 1.0.7
shivani170 Nov 18, 2024
1e25064
Merge branch 'develop' into feat/webhook-ui
shivani170 Nov 18, 2024
d02d2c5
chore: version bump
shivani170 Nov 18, 2024
8ca0002
chore: version bump to 1.0.7
shivani170 Nov 18, 2024
343d223
chore: removed unused code
shivani170 Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Assets/Icon/ic-hash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Assets/Icon/ic-pull-request.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/Assets/Icon/ic-tag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions src/Common/Common.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -511,3 +511,19 @@ export function getWebhookEventsForEventId(eventId: string | number) {
const URL = `${ROUTES.GIT_HOST_EVENT}/${eventId}`
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('.git', '').replace(/\/$/, '') // Remove any trailing slash
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
}
17 changes: 17 additions & 0 deletions src/Common/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,20 @@ 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',
BITBUCKET = 'bitbucket',
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)
32 changes: 31 additions & 1 deletion src/Common/Helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ import {
ToastManager,
ToastVariantType,
versionComparatorBySortOrder,
WebhookEventNameType,
} from '../Shared'
import { ReactComponent as ArrowDown } from '../Assets/Icon/ic-chevron-down.svg'
import { ReactComponent as ArrowDown } from '@Icons/ic-chevron-down.svg'
import webhookIcon from '@Icons/ic-webhook.svg'
import branchIcon from '@Icons/ic-branch.svg'
import regexIcon from '@Icons/ic-regex.svg'
import pullRequest from '@Icons/ic-pull-request.svg'
import tagIcon from '@Icons/ic-tag.svg'
import { SourceTypeMap } from '@Common/Common.service'

export function showError(serverError, showToastOnUnknownError = true, hideAccessError = false) {
if (serverError instanceof ServerErrors && Array.isArray(serverError.errors)) {
Expand Down Expand Up @@ -956,6 +963,29 @@ export const throttle = <T extends (...args: unknown[]) => unknown>(
}
}

/**
*
* @param sourceType - SourceTypeMap
* @param _isRegex - boolean
* @param webhookEventName - WebhookEventNameType
* @returns - Icon
*/
export const getBranchIcon = (sourceType, _isRegex?: boolean, webhookEventName?: string) => {
if (sourceType === SourceTypeMap.WEBHOOK) {
if (webhookEventName === WebhookEventNameType.PULL_REQUEST) {
return pullRequest
}
if (webhookEventName === WebhookEventNameType.TAG_CREATION) {
return tagIcon
}
return webhookIcon
}
if (sourceType === SourceTypeMap.BranchRegex || _isRegex) {
return regexIcon
}
return branchIcon
}

// TODO: Might need to expose sandbox and referrer policy
export const getSanitizedIframe = (iframeString: string) =>
DOMPurify.sanitize(iframeString, {
Expand Down
32 changes: 9 additions & 23 deletions src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,11 @@

import { useState, useEffect, ReactNode } from 'react'
import Tippy from '@tippyjs/react'
import { getWebhookEventsForEventId, SourceTypeMap } from '../../../Common'
import { ReactComponent as Info } from '@Icons/ic-info-outlined.svg'
import { getBranchIcon, getWebhookEventsForEventId, SourceTypeMap } from '../../../Common'
import { GIT_BRANCH_NOT_CONFIGURED, DEFAULT_GIT_BRANCH_VALUE } from './constants'
import webhookIcon from '../../../Assets/Icon/ic-webhook.svg'
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,
Expand All @@ -44,11 +31,12 @@ export const CiPipelineSourceConfig = ({
regex,
isRegex,
primaryBranchAfterRegex,
rootClassName = '',
}: CIPipelineSourceConfigInterface) => {
const _isWebhook = sourceType === SourceTypeMap.WEBHOOK
const _isRegex = sourceType === SourceTypeMap.BranchRegex || !!regex || isRegex

const [sourceValueBase, setSourceValueBase] = useState<ReactNode>('')
const [sourceValueBase, setSourceValueBase] = useState('')
const [sourceValueAdv, setSourceValueAdv] = useState<ReactNode>('')
const [loading, setLoading] = useState(!!_isWebhook)

Expand Down Expand Up @@ -97,7 +85,7 @@ export const CiPipelineSourceConfig = ({
)}
</>
)
// for non webhook case, data is already set in use state initialisation
// for non webhook case, data is already set in use state initialization
function _init() {
if (!_isWebhook) {
return
Expand Down Expand Up @@ -130,16 +118,14 @@ export const CiPipelineSourceConfig = ({
regexTippyContent()
}, [])

const isRegexOrBranchIcon = _isRegex ? regexIcon : branchIcon

return (
<div className={`flex left ${showTooltip ? 'branch-name' : ''}`}>
<div className={`flex left ${showTooltip ? 'fw-5' : ''} ${rootClassName}`}>
{loading && showIcons && <span className="dc__loading-dots">loading</span>}
{!loading && (
<div className="flex dc__gap-4">
{showIcons && (
<img
src={_isWebhook ? webhookIcon : isRegexOrBranchIcon}
src={getBranchIcon(sourceType, _isRegex, sourceValueBase)}
alt="branch"
className="icon-dim-12"
/>
Expand Down Expand Up @@ -170,7 +156,7 @@ export const CiPipelineSourceConfig = ({
</>
)}
{baseText && (
<span className="cursor" style={{ borderBottom: '1px solid #3b444c' }}>
<span className="dc__border-dashed--n3-bottom fw-6 fs-13 lh-19-imp">
{baseText}
</span>
)}
Expand Down
12 changes: 12 additions & 0 deletions src/Shared/Components/CICDHistory/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: string
sourceValue: any // TODO: need to make source value consistent
showTooltip?: boolean
showIcons?: boolean
baseText?: string
regex?: any
isRegex?: boolean
primaryBranchAfterRegex?: string
rootClassName?: string
}
22 changes: 11 additions & 11 deletions src/Shared/Components/CICDHistory/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
import { TIMELINE_STATUS } from '@Shared/constants'
import { ReactComponent as ICAborted } from '@Icons/ic-aborted.svg'
import { ReactComponent as ICErrorCross } from '@Icons/ic-error-cross.svg'
import { ReactComponent as Close } from '@Icons/ic-close.svg'
import { ReactComponent as Check } from '@Icons/ic-check-grey.svg'
import { ReactComponent as ICHelpOutline } from '@Icons/ic-help-outline.svg'
import { ReactComponent as Error } from '@Icons/ic-error-exclamation.svg'
import { ReactComponent as Timer } from '@Icons/ic-timer.svg'
import { ReactComponent as Disconnect } from '@Icons/ic-disconnected.svg'
import { ReactComponent as TimeOut } from '@Icons/ic-timeout-red.svg'
import { ReactComponent as ICCheck } from '@Icons/ic-check.svg'
import { ReactComponent as ICInProgress } from '@Icons/ic-in-progress.svg'
import { TERMINAL_STATUS_MAP } from './constants'
import { ResourceKindType } from '../../types'
import {
TriggerHistoryFilterCriteriaProps,
DeploymentHistoryResultObject,
DeploymentHistory,
TriggerHistoryFilterCriteriaType,
StageStatusType,
} from './types'
import { ResourceKindType } from '../../types'
import { ReactComponent as Close } from '../../../Assets/Icon/ic-close.svg'
import { ReactComponent as Check } from '../../../Assets/Icon/ic-check-grey.svg'
import { ReactComponent as ICHelpOutline } from '../../../Assets/Icon/ic-help-outline.svg'
import { ReactComponent as Error } from '../../../Assets/Icon/ic-error-exclamation.svg'
import { ReactComponent as Timer } from '../../../Assets/Icon/ic-timer.svg'
import { ReactComponent as Disconnect } from '../../../Assets/Icon/ic-disconnected.svg'
import { ReactComponent as TimeOut } from '../../../Assets/Icon/ic-timeout-red.svg'
import { ReactComponent as ICCheck } from '../../../Assets/Icon/ic-check.svg'
import { ReactComponent as ICInProgress } from '../../../Assets/Icon/ic-in-progress.svg'
import { TERMINAL_STATUS_MAP } from './constants'

export const getTriggerHistoryFilterCriteria = ({
appId,
Expand Down
Loading