Skip to content

Commit a0fc3f3

Browse files
committed
feat: pass trigger id to fetch in deployment detail
1 parent 697e748 commit a0fc3f3

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/components/app/details/appDetails/AppDetails.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ export const Details: React.FC<DetailsType> = ({
426426
}
427427
IndexStore.publishAppDetails(appDetailsRef.current, AppType.DEVTRON_APP)
428428
setAppDetails(appDetailsRef.current)
429-
_getDeploymentStatusDetail(
430-
appDetailsRef.current.deploymentAppType,
431-
isVirtualEnvRef.current && appDetailsRef.current.resourceTree,
432-
)
429+
430+
const isIsolatedEnv = isVirtualEnvRef.current && !!appDetailsRef.current.resourceTree
431+
432+
_getDeploymentStatusDetail(appDetailsRef.current.deploymentAppType, isIsolatedEnv, isIsolatedEnv ? appDetailsRef.current?.resourceTree?.wfrId : null)
433433

434434
if (fetchExternalLinks && response.result?.clusterId) {
435435
getExternalLinksAndTools(response.result.clusterId)
@@ -474,14 +474,15 @@ export const Details: React.FC<DetailsType> = ({
474474
})
475475
}
476476

477-
function _getDeploymentStatusDetail(deploymentAppType: DeploymentAppTypes, isAirGappedIsolatedEnv: boolean) {
477+
function _getDeploymentStatusDetail(deploymentAppType: DeploymentAppTypes, isIsolatedEnv: boolean, triggerIdToFetch?: number) {
478478
const shouldFetchTimeline = shouldFetchTimelineRef.current
479479

480-
getDeploymentStatusDetail(params.appId, params.envId, shouldFetchTimeline)
480+
// triggerIdToFetch represents the wfrId to fetch for any specific deployment
481+
getDeploymentStatusDetail(params.appId, params.envId, shouldFetchTimeline, triggerIdToFetch?.toString())
481482
.then((deploymentStatusDetailRes) => {
482483
if (deploymentStatusDetailRes.result) {
483484
// Timelines are not applicable for helm deployments and air gapped envs
484-
if (deploymentAppType === DeploymentAppTypes.HELM || isAirGappedIsolatedEnv) {
485+
if (deploymentAppType === DeploymentAppTypes.HELM || isIsolatedEnv) {
485486
setDeploymentStatusDetailsBreakdownData({
486487
...deploymentStatusDetailsBreakdownData,
487488
deploymentStatus:

src/components/app/details/appDetails/SourceInfo.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const SourceInfo = ({
8585
// helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
8686
const helmMigratedAppNotTriggered =
8787
appDetails?.releaseMode === ReleaseMode.MIGRATE_HELM && !appDetails?.isPipelineTriggered
88-
const isAirGappedIsolatedEnv = isVirtualEnvironment && !!appDetails?.resourceTree
88+
const isIsolatedEnv = isVirtualEnvironment && !!appDetails?.resourceTree
8989

9090
if (
9191
['progressing', 'degraded'].includes(status?.toLowerCase()) &&
@@ -203,7 +203,7 @@ export const SourceInfo = ({
203203
</div>
204204
)}
205205
{/* Last snapshot time */}
206-
{isAirGappedIsolatedEnv && relativeSnapshotTime && (
206+
{isIsolatedEnv && relativeSnapshotTime && (
207207
<Tooltip
208208
content={
209209
<div className="fw-4 lh-18 flexbox-col dc__ga-2">
@@ -338,23 +338,23 @@ export const SourceInfo = ({
338338
setDetailed={setDetailed}
339339
/>
340340
)}
341-
{isAirGappedIsolatedEnv && (
341+
{isIsolatedEnv && (
342342
<HelmAppConfigApplyStatusCard
343343
cardLoading={cardLoading}
344344
releaseStatus={appDetails.resourceTree.releaseStatus}
345345
/>
346346
)}
347347
</>
348348
)}
349-
{isVirtualEnvironment && !isAirGappedIsolatedEnv && renderGeneratedManifestDownloadCard()}
349+
{isVirtualEnvironment && !isIsolatedEnv && renderGeneratedManifestDownloadCard()}
350350
{!helmMigratedAppNotTriggered && (
351351
<>
352352
<DeploymentStatusCard
353353
deploymentStatusDetailsBreakdownData={deploymentStatusDetailsBreakdownData}
354354
cardLoading={cardLoading}
355355
hideDetails={
356356
appDetails?.deploymentAppType === DeploymentAppTypes.HELM ||
357-
isAirGappedIsolatedEnv
357+
isIsolatedEnv
358358
}
359359
isVirtualEnvironment={isVirtualEnvironment}
360360
refetchDeploymentStatus={refetchDeploymentStatus}

src/components/app/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ interface ResourceTree {
193193
status: string
194194
podMetadata: PodMetadatum[]
195195
conditions?: any
196-
lastSnapshotTime?: string
197196
releaseStatus?: HelmReleaseStatus
197+
// lastSnapshotTime and wfrId are only available for isolated
198+
lastSnapshotTime?: string
199+
wfrId?: number
198200
}
199201

200202
interface Node {

0 commit comments

Comments
 (0)