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 ,
29
+ Tooltip ,
27
30
} from '@devtron-labs/devtron-fe-common-lib'
31
+ import { ReactComponent as ICCamera } from '@Icons/ic-camera.svg'
28
32
import { URLS } from '../../../../config'
29
33
import { EnvSelector } from './AppDetails'
30
34
import { DeploymentAppTypeNameMapping } from '../../../../config/constantMessaging'
@@ -43,6 +47,7 @@ import { ReactComponent as RotateIcon } from '../../../../assets/icons/ic-arrows
43
47
import { ReactComponent as LinkIcon } from '../../../../assets/icons/ic-link.svg'
44
48
import { ReactComponent as Trash } from '../../../../assets/icons/ic-delete-dots.svg'
45
49
import { ReactComponent as ScaleDown } from '../../../../assets/icons/ic-scale-down.svg'
50
+ import HelmAppConfigApplyStatusCard from '@Components/v2/appDetails/sourceInfo/environmentStatus/HelmAppConfigApplyStatusCard'
46
51
47
52
const AppDetailsDownloadCard = importComponentFromFELibrary ( 'AppDetailsDownloadCard' )
48
53
const DeploymentWindowStatusCard = importComponentFromFELibrary ( 'DeploymentWindowStatusCard' )
@@ -79,6 +84,7 @@ export const SourceInfo = ({
79
84
// helmMigratedAppNotTriggered means the app is migrated from a helm release and has not been deployed yet i.e. CD Pipeline has not been triggered
80
85
const helmMigratedAppNotTriggered =
81
86
appDetails ?. releaseMode === ReleaseMode . MIGRATE_HELM && ! appDetails ?. isPipelineTriggered
87
+ const isIsolatedEnv = isVirtualEnvironment && ! ! appDetails ?. resourceTree
82
88
83
89
if (
84
90
[ 'progressing' , 'degraded' ] . includes ( status ?. toLowerCase ( ) ) &&
@@ -139,6 +145,10 @@ export const SourceInfo = ({
139
145
const renderDevtronAppsEnvironmentSelector = ( environment ) => {
140
146
// If moving to a component then move getIsApprovalConfigured with it as well with memoization.
141
147
const isApprovalConfigured = getIsApprovalConfigured ( )
148
+ const relativeSnapshotTime = appDetails ?. resourceTree ?. lastSnapshotTime ? handleUTCTime (
149
+ appDetails . resourceTree . lastSnapshotTime ,
150
+ true ,
151
+ ) : ''
142
152
143
153
return (
144
154
< div className = "flex left w-100" >
@@ -147,26 +157,50 @@ export const SourceInfo = ({
147
157
disabled = { loadingDetails || loadingResourceTree || ( params . envId && ! showCommitInfo ) }
148
158
/>
149
159
{ appDetails ?. deploymentAppType && (
150
- < Tippy
151
- className = "default-tt"
152
- arrow = { false }
160
+ < Tooltip
153
161
placement = "top"
162
+ alwaysShowTippyOnHover = { ! appDetails . isVirtualEnvironment }
154
163
content = { `Deployed using ${
155
164
isArgoCdApp ? DeploymentAppTypeNameMapping . GitOps : DeploymentAppTypeNameMapping . Helm
156
165
} `}
157
166
>
158
- < div className = "flex" >
159
- < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } />
167
+ < div className = { `flex ${ ! appDetails . isVirtualEnvironment ? 'ml-16' : '' } ` } >
168
+ { /* TODO: verify what appType needs to be passed */ }
169
+ < DeploymentTypeIcon deploymentAppType = { appDetails ?. deploymentAppType } appType = { null } />
160
170
</ div >
161
- </ Tippy >
171
+ </ Tooltip >
162
172
) }
163
173
{ isdeploymentAppDeleting && (
164
- < div data-testid = "deleteing-argocd-pipeline" >
174
+ < div data-testid = "deleteing-argocd-pipeline" className = "flex left" >
165
175
< Trash className = "icon-dim-16 mr-8 ml-12" />
166
176
< span className = "cr-5 fw-6" > Deleting deployment pipeline </ span >
167
177
< span className = "dc__loading-dots cr-5" />
168
178
</ div >
169
179
) }
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
+ ) }
170
204
{ ! loadingResourceTree && environment && (
171
205
< >
172
206
{ ! isdeploymentAppDeleting && (
@@ -204,7 +238,7 @@ export const SourceInfo = ({
204
238
< button
205
239
data-testid = "app-details-rotate-pods-modal-button"
206
240
className = "cta cta-with-img small cancel fs-12 fw-6 mr-6"
207
- onClick = { setRotateModal }
241
+ onClick = { ( ) => setRotateModal ( true ) }
208
242
disabled = { isApprovalConfigured }
209
243
>
210
244
< RotateIcon className = "icon-dim-16 mr-6 icon-color-n7 scn-4" />
@@ -258,16 +292,17 @@ export const SourceInfo = ({
258
292
: ! isdeploymentAppDeleting &&
259
293
environment && (
260
294
< div className = "flex left w-100" >
261
- { ! isVirtualEnvironment && (
262
- < AppStatusCard
263
- appDetails = { appDetails }
264
- status = { status }
265
- cardLoading = { cardLoading }
266
- setDetailed = { setDetailed }
267
- message = { message }
268
- />
295
+ { status && (
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
+ />
269
305
) }
270
- { isVirtualEnvironment && renderGeneratedManifestDownloadCard ( ) }
271
306
{ ! helmMigratedAppNotTriggered && (
272
307
< >
273
308
{ ! loadingResourceTree && (
@@ -278,10 +313,24 @@ export const SourceInfo = ({
278
313
setDetailed = { setDetailed }
279
314
/>
280
315
) }
316
+ { isIsolatedEnv && (
317
+ < HelmAppConfigApplyStatusCard
318
+ cardLoading = { cardLoading }
319
+ releaseStatus = { appDetails . resourceTree . releaseStatus }
320
+ />
321
+ ) }
322
+ </ >
323
+ ) }
324
+ { isVirtualEnvironment && ! isIsolatedEnv && renderGeneratedManifestDownloadCard ( ) }
325
+ { ! helmMigratedAppNotTriggered && (
326
+ < >
281
327
< DeploymentStatusCard
282
328
deploymentStatusDetailsBreakdownData = { deploymentStatusDetailsBreakdownData }
283
329
cardLoading = { cardLoading }
284
- hideDetails = { appDetails ?. deploymentAppType === DeploymentAppTypes . HELM }
330
+ hideDetails = {
331
+ appDetails ?. deploymentAppType === DeploymentAppTypes . HELM ||
332
+ isIsolatedEnv
333
+ }
285
334
isVirtualEnvironment = { isVirtualEnvironment }
286
335
refetchDeploymentStatus = { refetchDeploymentStatus }
287
336
/>
0 commit comments