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' )
@@ -82,6 +84,7 @@ export const SourceInfo = ({
8284 // helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
8385 const helmMigratedAppNotTriggered =
8486 appDetails ?. releaseMode === ReleaseMode . MIGRATE_HELM && ! appDetails ?. isPipelineTriggered
87+ const isIsolatedEnv = isVirtualEnvironment && ! ! appDetails ?. resourceTree
8588
8689 if (
8790 [ 'progressing' , 'degraded' ] . includes ( status ?. toLowerCase ( ) ) &&
@@ -142,6 +145,10 @@ export const SourceInfo = ({
142145 const renderDevtronAppsEnvironmentSelector = ( environment ) => {
143146 // If moving to a component then move getIsApprovalConfigured with it as well with memoization.
144147 const isApprovalConfigured = getIsApprovalConfigured ( )
148+ const relativeSnapshotTime = appDetails ?. resourceTree ?. lastSnapshotTime ? handleUTCTime (
149+ appDetails . resourceTree . lastSnapshotTime ,
150+ true ,
151+ ) : ''
145152
146153 return (
147154 < div className = "flex left w-100" >
@@ -158,17 +165,42 @@ export const SourceInfo = ({
158165 } `}
159166 >
160167 < div className = { `flex ${ ! appDetails . isVirtualEnvironment ? 'ml-16' : '' } ` } >
161- < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } />
168+ { /* TODO: verify what appType needs to be passed */ }
169+ < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } appType = { null } />
162170 </ div >
163171 </ Tooltip >
164172 ) }
165173 { isdeploymentAppDeleting && (
166- < div data-testid = "deleteing-argocd-pipeline" >
174+ < div data-testid = "deleteing-argocd-pipeline" className = "flex left" >
167175 < Trash className = "icon-dim-16 mr-8 ml-12" />
168176 < span className = "cr-5 fw-6" > Deleting deployment pipeline </ span >
169177 < span className = "dc__loading-dots cr-5" />
170178 </ div >
171179 ) }
180+ { /* Last snapshot time */ }
181+ { isIsolatedEnv && relativeSnapshotTime && (
182+ < Tooltip
183+ content = {
184+ < div className = "fw-4 lh-18 flexbox-col dc__ga-2" >
185+ < h6 className = "fs-12 fw-6 cn-0 m-0" > Last snapshot received</ h6 >
186+ < p className = "m-0 fs-12 cn-50" >
187+ { moment ( appDetails . resourceTree . lastSnapshotTime ) . format (
188+ DATE_TIME_FORMATS . TWELVE_HOURS_FORMAT ,
189+ ) }
190+ </ p >
191+ </ div >
192+ }
193+ alwaysShowTippyOnHover
194+ >
195+ < div className = "flex left" >
196+ < div className = "dc__divider h-20 mr-8 ml-8" />
197+ < div className = "flex left dc__gap-6 px-8 py-4" >
198+ < ICCamera className = "scn-9 dc__no-shrink icon-dim-16" />
199+ < p className = "m-0 fs-13 fw-4 lh-20 cn-9 dc__truncate" > { relativeSnapshotTime } </ p >
200+ </ div >
201+ </ div >
202+ </ Tooltip >
203+ ) }
172204 { ! loadingResourceTree && environment && (
173205 < >
174206 { ! isdeploymentAppDeleting && (
@@ -206,7 +238,7 @@ export const SourceInfo = ({
206238 < button
207239 data-testid = "app-details-rotate-pods-modal-button"
208240 className = "cta cta-with-img small cancel fs-12 fw-6 mr-6"
209- onClick = { setRotateModal }
241+ onClick = { ( ) => setRotateModal ( true ) }
210242 disabled = { isApprovalConfigured }
211243 >
212244 < RotateIcon className = "icon-dim-16 mr-6 icon-color-n7 scn-4" />
@@ -261,13 +293,15 @@ export const SourceInfo = ({
261293 environment && (
262294 < div className = "flex left w-100" >
263295 { status && (
264- < AppStatusCard
265- appDetails = { appDetails }
266- status = { status }
267- cardLoading = { cardLoading }
268- setDetailed = { setDetailed }
269- message = { message }
270- />
296+ < AppStatusCard
297+ // TODO: Fix and remove
298+ // @ts -ignore
299+ appDetails = { appDetails }
300+ status = { status }
301+ cardLoading = { cardLoading }
302+ setDetailed = { setDetailed }
303+ message = { message }
304+ />
271305 ) }
272306 { ! helmMigratedAppNotTriggered && (
273307 < >
@@ -279,21 +313,24 @@ export const SourceInfo = ({
279313 setDetailed = { setDetailed }
280314 />
281315 ) }
282- { isVirtualEnvironment && appDetails ?. resourceTree && (
316+ { isIsolatedEnv && (
283317 < HelmAppConfigApplyStatusCard
284318 cardLoading = { cardLoading }
285319 releaseStatus = { appDetails . resourceTree . releaseStatus }
286320 />
287321 ) }
288322 </ >
289323 ) }
290- { isVirtualEnvironment && renderGeneratedManifestDownloadCard ( ) }
324+ { isVirtualEnvironment && ! isIsolatedEnv && renderGeneratedManifestDownloadCard ( ) }
291325 { ! helmMigratedAppNotTriggered && (
292326 < >
293327 < DeploymentStatusCard
294328 deploymentStatusDetailsBreakdownData = { deploymentStatusDetailsBreakdownData }
295329 cardLoading = { cardLoading }
296- hideDetails = { appDetails ?. deploymentAppType === DeploymentAppTypes . HELM }
330+ hideDetails = {
331+ appDetails ?. deploymentAppType === DeploymentAppTypes . HELM ||
332+ isIsolatedEnv
333+ }
297334 isVirtualEnvironment = { isVirtualEnvironment }
298335 refetchDeploymentStatus = { refetchDeploymentStatus }
299336 />
0 commit comments