1414 * limitations under the License.
1515 */
1616
17- // @ts -nocheck - @TODO: Remove this by fixing the type issues
18- import React , { useEffect , useMemo , useState } from 'react'
19- import { useParams } from 'react-router-dom'
17+ import { useEffect , useMemo , useState } from 'react'
18+ import { Link , useParams } from 'react-router-dom'
2019import Tippy from '@tippyjs/react'
20+ import moment from 'moment'
2121import {
2222 ConditionalWrap ,
23+ DATE_TIME_FORMATS ,
2324 DeploymentAppTypes ,
2425 getIsManualApprovalConfigured ,
26+ handleUTCTime ,
2527 ReleaseMode ,
2628 showError ,
2729 Tooltip ,
2830} from '@devtron-labs/devtron-fe-common-lib'
31+ import { ReactComponent as ICCamera } from '@Icons/ic-camera.svg'
2932import { URLS } from '../../../../config'
3033import { EnvSelector } from './AppDetails'
3134import { DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
@@ -44,7 +47,6 @@ import { ReactComponent as RotateIcon } from '../../../../assets/icons/ic-arrows
4447import { ReactComponent as LinkIcon } from '../../../../assets/icons/ic-link.svg'
4548import { ReactComponent as Trash } from '../../../../assets/icons/ic-delete-dots.svg'
4649import { ReactComponent as ScaleDown } from '../../../../assets/icons/ic-scale-down.svg'
47- import { ConfigApplyStatusCard } from './ConfigApplyStatusCard'
4850import HelmAppConfigApplyStatusCard from '@Components/v2/appDetails/sourceInfo/environmentStatus/HelmAppConfigApplyStatusCard'
4951
5052const AppDetailsDownloadCard = importComponentFromFELibrary ( 'AppDetailsDownloadCard' )
@@ -83,6 +85,7 @@ export const SourceInfo = ({
8385 // helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
8486 const helmMigratedAppNotTriggered =
8587 appDetails ?. releaseMode === ReleaseMode . MIGRATE_HELM && ! appDetails ?. isPipelineTriggered
88+ const isIsolatedEnv = isVirtualEnvironment && ! ! appDetails ?. resourceTree
8689
8790 if (
8891 [ 'progressing' , 'degraded' ] . includes ( status ?. toLowerCase ( ) ) &&
@@ -167,6 +170,10 @@ export const SourceInfo = ({
167170 const renderDevtronAppsEnvironmentSelector = ( environment ) => {
168171 // If moving to a component then move getIsApprovalConfigured with it as well with memoization.
169172 const isApprovalConfigured = getIsApprovalConfigured ( )
173+ const relativeSnapshotTime = appDetails ?. resourceTree ?. lastSnapshotTime ? handleUTCTime (
174+ appDetails . resourceTree . lastSnapshotTime ,
175+ true ,
176+ ) : ''
170177
171178 return (
172179 < div className = "flex left w-100" >
@@ -183,17 +190,42 @@ export const SourceInfo = ({
183190 } `}
184191 >
185192 < div className = { `flex ${ ! appDetails . isVirtualEnvironment ? 'ml-16' : '' } ` } >
186- < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } />
193+ { /* TODO: verify what appType needs to be passed */ }
194+ < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } appType = { null } />
187195 </ div >
188196 </ Tooltip >
189197 ) }
190198 { isdeploymentAppDeleting && (
191- < div data-testid = "deleteing-argocd-pipeline" >
199+ < div data-testid = "deleteing-argocd-pipeline" className = "flex left" >
192200 < Trash className = "icon-dim-16 mr-8 ml-12" />
193201 < span className = "cr-5 fw-6" > Deleting deployment pipeline </ span >
194202 < span className = "dc__loading-dots cr-5" />
195203 </ div >
196204 ) }
205+ { /* Last snapshot time */ }
206+ { isIsolatedEnv && relativeSnapshotTime && (
207+ < Tooltip
208+ content = {
209+ < div className = "fw-4 lh-18 flexbox-col dc__ga-2" >
210+ < h6 className = "fs-12 fw-6 cn-0 m-0" > Last snapshot received</ h6 >
211+ < p className = "m-0 fs-12 cn-50" >
212+ { moment ( appDetails . resourceTree . lastSnapshotTime ) . format (
213+ DATE_TIME_FORMATS . TWELVE_HOURS_FORMAT ,
214+ ) }
215+ </ p >
216+ </ div >
217+ }
218+ alwaysShowTippyOnHover
219+ >
220+ < div className = "flex left" >
221+ < div className = "dc__divider h-20 mr-8 ml-8" />
222+ < div className = "flex left dc__gap-6 px-8 py-4" >
223+ < ICCamera className = "scn-9 dc__no-shrink icon-dim-16" />
224+ < p className = "m-0 fs-13 fw-4 lh-20 cn-9 dc__truncate" > { relativeSnapshotTime } </ p >
225+ </ div >
226+ </ div >
227+ </ Tooltip >
228+ ) }
197229 { ! loadingResourceTree && environment && (
198230 < >
199231 { ! isdeploymentAppDeleting && (
@@ -231,7 +263,7 @@ export const SourceInfo = ({
231263 < button
232264 data-testid = "app-details-rotate-pods-modal-button"
233265 className = "cta cta-with-img small cancel fs-12 fw-6 mr-6"
234- onClick = { setRotateModal }
266+ onClick = { ( ) => setRotateModal ( true ) }
235267 disabled = { isApprovalConfigured }
236268 >
237269 < RotateIcon className = "icon-dim-16 mr-6 icon-color-n7 scn-4" />
@@ -286,13 +318,15 @@ export const SourceInfo = ({
286318 environment && (
287319 < div className = "flex left w-100" >
288320 { status && (
289- < AppStatusCard
290- appDetails = { appDetails }
291- status = { status }
292- cardLoading = { cardLoading }
293- setDetailed = { setDetailed }
294- message = { message }
295- />
321+ < AppStatusCard
322+ // TODO: Fix and remove
323+ // @ts -ignore
324+ appDetails = { appDetails }
325+ status = { status }
326+ cardLoading = { cardLoading }
327+ setDetailed = { setDetailed }
328+ message = { message }
329+ />
296330 ) }
297331 { ! helmMigratedAppNotTriggered && (
298332 < >
@@ -304,21 +338,24 @@ export const SourceInfo = ({
304338 setDetailed = { setDetailed }
305339 />
306340 ) }
307- { isVirtualEnvironment && appDetails ?. resourceTree && (
341+ { isIsolatedEnv && (
308342 < HelmAppConfigApplyStatusCard
309343 cardLoading = { cardLoading }
310344 releaseStatus = { appDetails . resourceTree . releaseStatus }
311345 />
312346 ) }
313347 </ >
314348 ) }
315- { isVirtualEnvironment && renderGeneratedManifestDownloadCard ( ) }
349+ { isVirtualEnvironment && ! isIsolatedEnv && renderGeneratedManifestDownloadCard ( ) }
316350 { ! helmMigratedAppNotTriggered && (
317351 < >
318352 < DeploymentStatusCard
319353 deploymentStatusDetailsBreakdownData = { deploymentStatusDetailsBreakdownData }
320354 cardLoading = { cardLoading }
321- hideDetails = { appDetails ?. deploymentAppType === DeploymentAppTypes . HELM }
355+ hideDetails = {
356+ appDetails ?. deploymentAppType === DeploymentAppTypes . HELM ||
357+ isIsolatedEnv
358+ }
322359 isVirtualEnvironment = { isVirtualEnvironment }
323360 refetchDeploymentStatus = { refetchDeploymentStatus }
324361 />
0 commit comments