Skip to content

Commit 2172f3d

Browse files
committed
feat: add last fetched time
1 parent 9a7baf0 commit 2172f3d

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ export const Details: React.FC<DetailsType> = ({
295295
const appDetailsAbortRef = useRef(null)
296296
const shouldFetchTimelineRef = useRef(false)
297297

298-
const isAirGappedIsolatedEnv = isVirtualEnvRef.current && appDetails?.resourceTree
299298

300299
const [deploymentStatusDetailsBreakdownData, setDeploymentStatusDetailsBreakdownData] =
301300
useState<DeploymentStatusDetailsBreakdownDataType>({
@@ -427,7 +426,10 @@ export const Details: React.FC<DetailsType> = ({
427426
}
428427
IndexStore.publishAppDetails(appDetailsRef.current, AppType.DEVTRON_APP)
429428
setAppDetails(appDetailsRef.current)
430-
_getDeploymentStatusDetail(appDetailsRef.current.deploymentAppType)
429+
_getDeploymentStatusDetail(
430+
appDetailsRef.current.deploymentAppType,
431+
isVirtualEnvRef.current && appDetailsRef.current.resourceTree,
432+
)
431433

432434
if (fetchExternalLinks && response.result?.clusterId) {
433435
getExternalLinksAndTools(response.result.clusterId)
@@ -472,7 +474,7 @@ export const Details: React.FC<DetailsType> = ({
472474
})
473475
}
474476

475-
function _getDeploymentStatusDetail(deploymentAppType: DeploymentAppTypes) {
477+
function _getDeploymentStatusDetail(deploymentAppType: DeploymentAppTypes, isAirGappedIsolatedEnv: boolean) {
476478
const shouldFetchTimeline = shouldFetchTimelineRef.current
477479

478480
getDeploymentStatusDetail(params.appId, params.envId, shouldFetchTimeline)
@@ -490,10 +492,9 @@ export const Details: React.FC<DetailsType> = ({
490492
deploymentTriggerTime: deploymentStatusDetailRes.result.deploymentStartedOn,
491493
deploymentEndTime: deploymentStatusDetailRes.result.deploymentFinishedOn,
492494
triggeredBy: deploymentStatusDetailRes.result.triggeredBy,
493-
statusLastFetchedAt: deploymentStatusDetailRes.result.statusLastFetchedAt ? handleUTCTime(
494-
deploymentStatusDetailRes.result.statusLastFetchedAt,
495-
true,
496-
) : '',
495+
statusLastFetchedAt: deploymentStatusDetailRes.result.statusLastFetchedAt
496+
? handleUTCTime(deploymentStatusDetailRes.result.statusLastFetchedAt, true)
497+
: '',
497498
})
498499
} else {
499500
processDeploymentStatusData(deploymentStatusDetailRes.result)
@@ -740,7 +741,6 @@ export const Details: React.FC<DetailsType> = ({
740741
ciArtifactId={appDetails?.ciArtifactId}
741742
setErrorsList={setErrorsList}
742743
deploymentUserActionState={deploymentUserActionState}
743-
isAirGappedIsolatedEnv={isAirGappedIsolatedEnv}
744744
/>
745745
</div>
746746
{!loadingDetails && !loadingResourceTree && !appDetails?.deploymentAppDeleteRequest && (

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const SourceInfo = ({
7171
setErrorsList,
7272
filteredEnvIds,
7373
deploymentUserActionState,
74-
isAirGappedIsolatedEnv,
7574
}: SourceInfoType) => {
7675
const [showVulnerabilitiesCard, setShowVulnerabilitiesCard] = useState<boolean>(false)
7776
const isdeploymentAppDeleting = appDetails?.deploymentAppDeleteRequest || false
@@ -85,6 +84,7 @@ export const SourceInfo = ({
8584
// helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
8685
const helmMigratedAppNotTriggered =
8786
appDetails?.releaseMode === ReleaseMode.MIGRATE_HELM && !appDetails?.isPipelineTriggered
87+
const isAirGappedIsolatedEnv = isVirtualEnvironment && !!appDetails?.resourceTree
8888

8989
if (
9090
['progressing', 'degraded'].includes(status?.toLowerCase()) &&
@@ -197,21 +197,26 @@ export const SourceInfo = ({
197197
</div>
198198
)}
199199
{/* Last snapshot time */}
200-
{isAirGappedIsolatedEnv && deploymentStatusDetailsBreakdownData.statusLastFetchedAt && (
200+
{isAirGappedIsolatedEnv && deploymentStatusDetailsBreakdownData?.statusLastFetchedAt && (
201201
<Tooltip
202202
content={
203-
<div className="fs-12 fw-4 lh-18">
204-
<h6 className="fw-6 cn-0 m-0">Last snapshot received</h6>
205-
<p className="m-0 cn-50">{deploymentStatusDetailsBreakdownData.statusLastFetchedAt}</p>
203+
<div className="fw-4 lh-18 flexbox-col dc__ga-2">
204+
<h6 className="fs-12 fw-6 cn-0 m-0">Last snapshot received</h6>
205+
<p className="m-0 fs-12 cn-50">
206+
{deploymentStatusDetailsBreakdownData.statusLastFetchedAt}
207+
</p>
206208
</div>
207209
}
210+
alwaysShowTippyOnHover
208211
>
209-
<div className="dc__divider h-20 mx-8" />
210-
<div className="flex left dc__gap-6 px-8 py-4">
211-
<ICCamera className="scn-9 dc__no-shrink icon-dim-16" />
212-
<p className="m-0 fs-13 fw-4 lh-20 cn-9 dc__truncate">
213-
{deploymentStatusDetailsBreakdownData.statusLastFetchedAt}
214-
</p>
212+
<div className="flex left">
213+
<div className="dc__divider h-20 mr-8 ml-8" />
214+
<div className="flex left dc__gap-6 px-8 py-4">
215+
<ICCamera className="scn-9 dc__no-shrink icon-dim-16" />
216+
<p className="m-0 fs-13 fw-4 lh-20 cn-9 dc__truncate">
217+
{deploymentStatusDetailsBreakdownData.statusLastFetchedAt}
218+
</p>
219+
</div>
215220
</div>
216221
</Tooltip>
217222
)}

src/components/app/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ export interface SourceInfoType {
590590
setErrorsList?: React.Dispatch<React.SetStateAction<ErrorItem[]>>
591591
filteredEnvIds?: string
592592
deploymentUserActionState?: ACTION_STATE
593-
isAirGappedIsolatedEnv?: boolean
594593
}
595594

596595
export interface AppDetailsCDButtonType

0 commit comments

Comments
 (0)