Skip to content

Commit 197a513

Browse files
committed
feat: add support for showing environment name and target info
1 parent 8f50463 commit 197a513

File tree

7 files changed

+75
-6
lines changed

7 files changed

+75
-6
lines changed

src/Assets/Icon/ic-arrow-right.svg

Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { getDeploymentStageTitle } from './utils'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { DeploymentStageType } from '@Shared/constants'
2+
3+
export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
4+
switch (stage) {
5+
case DeploymentStageType.PRE:
6+
return 'pre-deployment'
7+
case DeploymentStageType.POST:
8+
return 'post-deployment'
9+
case DeploymentStageType.DEPLOY:
10+
return 'deployment'
11+
default:
12+
return '-'
13+
}
14+
}

src/Pages/App/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './AppConfigurations'

src/Pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
export * from './GlobalConfigurations'
1818
export * from './ResourceBrowser'
1919
export * from './CDPipeline'
20+
export * from './App'

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { ImageChipCell } from '@Shared/Components/ImageChipCell'
2424
import { CommitChipCell } from '@Shared/Components/CommitChipCell'
2525
import { ReactComponent as ICLines } from '@Icons/ic-lines.svg'
2626
import { ReactComponent as ICPulsateStatus } from '@Icons/ic-pulsate-status.svg'
27+
import { ReactComponent as ICArrowRight } from '@Icons/ic-arrow-right.svg'
28+
import { getDeploymentStageTitle } from '@Pages/App'
2729
import {
2830
ConfirmationDialog,
2931
DATE_TIME_FORMATS,
@@ -284,16 +286,33 @@ const StartDetails = ({
284286
isJobView,
285287
triggerMetadata,
286288
renderDeploymentHistoryTriggerMetaText,
289+
renderTargetConfigInfo,
290+
stage,
287291
}: StartDetailsType): JSX.Element => {
288292
const { url } = useRouteMatch()
289293
const { pathname } = useLocation()
290294

291295
return (
292296
<div className="w-100 pr-20 flex column left dc__border-bottom-n1">
293297
<div className="flexbox dc__gap-8 dc__align-items-center pb-12">
294-
<span className="cn-9 fs-13 fw-6 lh-20" data-testid="deployment-history-start-heading">
295-
Start
296-
</span>
298+
<div className="flex left dc__gap-4 cn-9 fs-13 fw-6 lh-20">
299+
<div className="flex left dc__no-shrink dc__gap-4" data-testid="deployment-history-start-heading">
300+
<div>Start</div>
301+
{stage && (
302+
<>
303+
<div className="dc__bullet" />
304+
<div className="dc__first-letter-capitalize">{getDeploymentStageTitle(stage)}</div>
305+
</>
306+
)}
307+
</div>
308+
{environmentName && (
309+
<>
310+
<ICArrowRight className="icon-dim-14 scn-9 dc__no-shrink" />
311+
<span className="dc__truncate">{environmentName}</span>
312+
</>
313+
)}
314+
{renderTargetConfigInfo?.()}
315+
</div>
297316

298317
<time className="cn-7 fs-13">
299318
{moment(startedOn, 'YYYY-MM-DDTHH:mm:ssZ').format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT)}
@@ -417,6 +436,7 @@ export const TriggerDetails = React.memo(
417436
workerPodName,
418437
triggerMetadata,
419438
renderDeploymentHistoryTriggerMetaText,
439+
renderTargetConfigInfo,
420440
}: TriggerDetailsType): JSX.Element => (
421441
<div className="trigger-details flexbox-col pb-12">
422442
<div className="display-grid trigger-details__grid py-12">
@@ -436,6 +456,8 @@ export const TriggerDetails = React.memo(
436456
isJobView={isJobView}
437457
triggerMetadata={triggerMetadata}
438458
renderDeploymentHistoryTriggerMetaText={renderDeploymentHistoryTriggerMetaText}
459+
renderTargetConfigInfo={renderTargetConfigInfo}
460+
stage={stage}
439461
/>
440462

441463
<CurrentStatus
@@ -657,6 +679,7 @@ const TriggerOutput = ({
657679
resourceId,
658680
scrollToTop,
659681
scrollToBottom,
682+
renderTargetConfigInfo,
660683
}: TriggerOutputProps) => {
661684
const { appId, triggerId, envId, pipelineId } = useParams<{
662685
appId: string
@@ -686,12 +709,15 @@ const TriggerOutput = ({
686709
const appliedFiltersTimestamp = triggerHistory.get(syncTriggerId)?.appliedFiltersTimestamp
687710
const promotionApprovalMetadata = triggerHistory.get(syncTriggerId)?.promotionApprovalMetadata
688711
const runSource = triggerHistory.get(syncTriggerId)?.runSource
712+
const targetConfig = triggerHistory.get(syncTriggerId)?.targetConfig
713+
689714
// These changes are not subject to change after refresh, add data which will not change
690715
const additionalDataObject = {
691716
...(appliedFilters.length ? { appliedFilters } : {}),
692717
...(appliedFiltersTimestamp ? { appliedFiltersTimestamp } : {}),
693718
...(promotionApprovalMetadata ? { promotionApprovalMetadata } : {}),
694719
...(runSource ? { runSource } : {}),
720+
...(targetConfig ? { targetConfig } : {}),
695721
}
696722
setTriggerHistory((newTriggerHistory) => {
697723
newTriggerHistory.set(syncTriggerId, { ...syncTriggerDetail, ...additionalDataObject })
@@ -808,6 +834,8 @@ const TriggerOutput = ({
808834
artifact={triggerDetails.artifact}
809835
triggerMetadata={triggerDetails.triggerMetadata}
810836
renderDeploymentHistoryTriggerMetaText={renderDeploymentHistoryTriggerMetaText}
837+
environmentName={selectedEnvironmentName}
838+
renderTargetConfigInfo={renderTargetConfigInfo}
811839
/>
812840
<ul className="pl-50 pr-20 pt-8 tab-list tab-list--nodes dc__border-bottom dc__position-sticky dc__top-0 bcn-0 dc__zi-3">
813841
{triggerDetails.stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes.HELM && (

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { CSSProperties } from 'react'
17+
import { CSSProperties, ReactElement } from 'react'
1818
import {
1919
OptionType,
2020
UserApprovalMetadataType,
@@ -82,6 +82,17 @@ export interface CICDSidebarFilterOptionType extends OptionType {
8282
deploymentAppDeleteRequest?: boolean
8383
}
8484

85+
// The values can be undefined because of old data
86+
export interface TargetConfigType {
87+
tenantIcon?: string
88+
tenantId?: string
89+
tenantName?: string
90+
installationId?: string
91+
installationName?: string
92+
releaseChannelId?: string
93+
releaseChannelName?: string
94+
}
95+
8596
export interface History {
8697
id: number
8798
name: string
@@ -116,6 +127,7 @@ export interface History {
116127
promotionApprovalMetadata?: PromotionApprovalMetadataType
117128
triggerMetadata?: string
118129
runSource?: RunSourceType
130+
targetConfig?: TargetConfigType
119131
}
120132

121133
export interface DeploymentHistoryResultObject {
@@ -199,9 +211,14 @@ export interface StartDetailsType {
199211
isJobView?: boolean
200212
triggerMetadata?: string
201213
renderDeploymentHistoryTriggerMetaText: (triggerMetaData: string) => JSX.Element
214+
/**
215+
* Callback handler for showing the target config
216+
*/
217+
renderTargetConfigInfo?: () => ReactElement
218+
stage: DeploymentStageType
202219
}
203220

204-
export interface TriggerDetailsType {
221+
export interface TriggerDetailsType extends Pick<StartDetailsType, 'renderTargetConfigInfo'> {
205222
status: string
206223
startedOn: string
207224
finishedOn: string
@@ -356,7 +373,7 @@ export interface VirtualHistoryArtifactProps {
356373
workflowId: number
357374
}
358375
}
359-
export interface TriggerOutputProps extends RenderRunSourceType {
376+
export interface TriggerOutputProps extends RenderRunSourceType, Pick<TriggerDetailsType, 'renderTargetConfigInfo'> {
360377
fullScreenView: boolean
361378
triggerHistory: Map<number, History>
362379
setFullScreenView: React.Dispatch<React.SetStateAction<boolean>>

0 commit comments

Comments
 (0)