14
14
* limitations under the License.
15
15
*/
16
16
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'
20
19
import Tippy from '@tippyjs/react'
20
+ import moment from 'moment'
21
21
import {
22
22
ConditionalWrap ,
23
+ DATE_TIME_FORMATS ,
23
24
DeploymentAppTypes ,
24
25
getIsManualApprovalConfigured ,
26
+ handleUTCTime ,
25
27
ReleaseMode ,
26
28
showError ,
27
29
Tooltip ,
28
30
} from '@devtron-labs/devtron-fe-common-lib'
31
+ import { ReactComponent as ICCamera } from '@Icons/ic-camera.svg'
29
32
import { URLS } from '../../../../config'
30
33
import { EnvSelector } from './AppDetails'
31
34
import { DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
@@ -44,7 +47,6 @@ import { ReactComponent as RotateIcon } from '../../../../assets/icons/ic-arrows
44
47
import { ReactComponent as LinkIcon } from '../../../../assets/icons/ic-link.svg'
45
48
import { ReactComponent as Trash } from '../../../../assets/icons/ic-delete-dots.svg'
46
49
import { ReactComponent as ScaleDown } from '../../../../assets/icons/ic-scale-down.svg'
47
- import { ConfigApplyStatusCard } from './ConfigApplyStatusCard'
48
50
import HelmAppConfigApplyStatusCard from '@Components/v2/appDetails/sourceInfo/environmentStatus/HelmAppConfigApplyStatusCard'
49
51
50
52
const AppDetailsDownloadCard = importComponentFromFELibrary ( 'AppDetailsDownloadCard' )
@@ -83,6 +85,7 @@ export const SourceInfo = ({
83
85
// helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
84
86
const helmMigratedAppNotTriggered =
85
87
appDetails ?. releaseMode === ReleaseMode . MIGRATE_HELM && ! appDetails ?. isPipelineTriggered
88
+ const isIsolatedEnv = isVirtualEnvironment && ! ! appDetails ?. resourceTree
86
89
87
90
if (
88
91
[ 'progressing' , 'degraded' ] . includes ( status ?. toLowerCase ( ) ) &&
@@ -167,6 +170,10 @@ export const SourceInfo = ({
167
170
const renderDevtronAppsEnvironmentSelector = ( environment ) => {
168
171
// If moving to a component then move getIsApprovalConfigured with it as well with memoization.
169
172
const isApprovalConfigured = getIsApprovalConfigured ( )
173
+ const relativeSnapshotTime = appDetails ?. resourceTree ?. lastSnapshotTime ? handleUTCTime (
174
+ appDetails . resourceTree . lastSnapshotTime ,
175
+ true ,
176
+ ) : ''
170
177
171
178
return (
172
179
< div className = "flex left w-100" >
@@ -183,17 +190,42 @@ export const SourceInfo = ({
183
190
} `}
184
191
>
185
192
< 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 } />
187
195
</ div >
188
196
</ Tooltip >
189
197
) }
190
198
{ isdeploymentAppDeleting && (
191
- < div data-testid = "deleteing-argocd-pipeline" >
199
+ < div data-testid = "deleteing-argocd-pipeline" className = "flex left" >
192
200
< Trash className = "icon-dim-16 mr-8 ml-12" />
193
201
< span className = "cr-5 fw-6" > Deleting deployment pipeline </ span >
194
202
< span className = "dc__loading-dots cr-5" />
195
203
</ div >
196
204
) }
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
+ ) }
197
229
{ ! loadingResourceTree && environment && (
198
230
< >
199
231
{ ! isdeploymentAppDeleting && (
@@ -231,7 +263,7 @@ export const SourceInfo = ({
231
263
< button
232
264
data-testid = "app-details-rotate-pods-modal-button"
233
265
className = "cta cta-with-img small cancel fs-12 fw-6 mr-6"
234
- onClick = { setRotateModal }
266
+ onClick = { ( ) => setRotateModal ( true ) }
235
267
disabled = { isApprovalConfigured }
236
268
>
237
269
< RotateIcon className = "icon-dim-16 mr-6 icon-color-n7 scn-4" />
@@ -286,13 +318,15 @@ export const SourceInfo = ({
286
318
environment && (
287
319
< div className = "flex left w-100" >
288
320
{ 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
+ />
296
330
) }
297
331
{ ! helmMigratedAppNotTriggered && (
298
332
< >
@@ -304,21 +338,24 @@ export const SourceInfo = ({
304
338
setDetailed = { setDetailed }
305
339
/>
306
340
) }
307
- { isVirtualEnvironment && appDetails ?. resourceTree && (
341
+ { isIsolatedEnv && (
308
342
< HelmAppConfigApplyStatusCard
309
343
cardLoading = { cardLoading }
310
344
releaseStatus = { appDetails . resourceTree . releaseStatus }
311
345
/>
312
346
) }
313
347
</ >
314
348
) }
315
- { isVirtualEnvironment && renderGeneratedManifestDownloadCard ( ) }
349
+ { isVirtualEnvironment && ! isIsolatedEnv && renderGeneratedManifestDownloadCard ( ) }
316
350
{ ! helmMigratedAppNotTriggered && (
317
351
< >
318
352
< DeploymentStatusCard
319
353
deploymentStatusDetailsBreakdownData = { deploymentStatusDetailsBreakdownData }
320
354
cardLoading = { cardLoading }
321
- hideDetails = { appDetails ?. deploymentAppType === DeploymentAppTypes . HELM }
355
+ hideDetails = {
356
+ appDetails ?. deploymentAppType === DeploymentAppTypes . HELM ||
357
+ isIsolatedEnv
358
+ }
322
359
isVirtualEnvironment = { isVirtualEnvironment }
323
360
refetchDeploymentStatus = { refetchDeploymentStatus }
324
361
/>
0 commit comments