@@ -107,13 +107,6 @@ const NodeDetailComponent = ({
107
107
[ k8SObjectMapRaw , params . nodeType ] ,
108
108
)
109
109
110
- const showDesiredAndCompareManifest =
111
- ! isResourceBrowserView &&
112
- appDetails . appType === AppType . EXTERNAL_HELM_CHART &&
113
- ! appDetails . resourceTree . nodes . filter (
114
- ( data ) => data . name === params . podName && data . kind . toLowerCase ( ) === params . nodeType ,
115
- ) [ 0 ] ?. [ 'parentRefs' ] ?. length
116
-
117
110
const selectedResource = {
118
111
clusterId : + params . clusterId ,
119
112
kind : _selectedResource ?. gvk . Kind as string ,
@@ -130,6 +123,11 @@ const NodeDetailComponent = ({
130
123
( data ) => data . name === params . podName && data . kind . toLowerCase ( ) === params . nodeType ,
131
124
) [ 0 ]
132
125
126
+ const showDesiredAndCompareManifest =
127
+ ! isResourceBrowserView &&
128
+ appDetails . appType === AppType . EXTERNAL_HELM_CHART &&
129
+ ! currentResource ?. [ 'parentRefs' ] ?. length
130
+
133
131
const isResourceMissing =
134
132
appDetails . appType === AppType . EXTERNAL_HELM_CHART && currentResource ?. [ 'health' ] ?. status === 'Missing'
135
133
@@ -366,6 +364,69 @@ const NodeDetailComponent = ({
366
364
)
367
365
}
368
366
367
+ const renderManifestTabHeader = ( ) => (
368
+ < >
369
+ { ( isExternalApp ||
370
+ isResourceBrowserView ||
371
+ ( appDetails . deploymentAppType === DeploymentAppTypes . GITOPS &&
372
+ appDetails . deploymentAppDeleteRequest ) ) &&
373
+ manifestCodeEditorMode &&
374
+ ! showManifestCompareView &&
375
+ ! isResourceMissing && (
376
+ < >
377
+ < div className = "ml-4 mr-12 tab-cell-border" />
378
+ { manifestCodeEditorMode === ManifestCodeEditorMode . EDIT ? (
379
+ < div className = "flex dc__gap-12" >
380
+ < button
381
+ type = "button"
382
+ className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
383
+ onClick = { handleManifestApplyChanges }
384
+ >
385
+ < >
386
+ < ICCheck className = "icon-dim-16 scb-5" />
387
+ < span > Apply changes</ span >
388
+ </ >
389
+ </ button >
390
+ < button
391
+ type = "button"
392
+ className = "dc__unset-button-styles fs-12 lh-1-5 fw-6 flex cn-6"
393
+ onClick = { handleManifestCancel }
394
+ >
395
+ Cancel
396
+ </ button >
397
+ </ div >
398
+ ) : (
399
+ < button
400
+ type = "button"
401
+ className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
402
+ onClick = { handleManifestEdit }
403
+ >
404
+ < >
405
+ < ICPencil className = "icon-dim-16 scb-5" />
406
+ < span > Edit live manifest</ span >
407
+ </ >
408
+ </ button >
409
+ ) }
410
+ </ >
411
+ ) }
412
+ { manifestCodeEditorMode === ManifestCodeEditorMode . READ &&
413
+ ! showManifestCompareView &&
414
+ ( showDesiredAndCompareManifest || isResourceMissing ) && (
415
+ < >
416
+ < div className = "ml-12 mr-12 tab-cell-border" />
417
+ < button
418
+ type = "button"
419
+ className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
420
+ onClick = { handleManifestCompareWithDesired }
421
+ >
422
+ < ICArrowsLeftRight className = "icon-dim-16 scb-5" />
423
+ < span > Compare with desired</ span >
424
+ </ button >
425
+ </ >
426
+ ) }
427
+ </ >
428
+ )
429
+
369
430
return (
370
431
< >
371
432
< div
@@ -430,68 +491,7 @@ const NodeDetailComponent = ({
430
491
</ div >
431
492
</ >
432
493
) }
433
- { selectedTabName === NodeDetailTab . MANIFEST && (
434
- < >
435
- { ( isExternalApp ||
436
- isResourceBrowserView ||
437
- ( appDetails . deploymentAppType === DeploymentAppTypes . GITOPS &&
438
- appDetails . deploymentAppDeleteRequest ) ) &&
439
- manifestCodeEditorMode &&
440
- ! showManifestCompareView &&
441
- ! isResourceMissing && (
442
- < >
443
- < div className = "ml-4 mr-12 tab-cell-border" />
444
- { manifestCodeEditorMode === ManifestCodeEditorMode . EDIT ? (
445
- < div className = "flex dc__gap-12" >
446
- < button
447
- type = "button"
448
- className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
449
- onClick = { handleManifestApplyChanges }
450
- >
451
- < >
452
- < ICCheck className = "icon-dim-16 scb-5" />
453
- < span > Apply changes</ span >
454
- </ >
455
- </ button >
456
- < button
457
- type = "button"
458
- className = "dc__unset-button-styles fs-12 lh-1-5 fw-6 flex cn-6"
459
- onClick = { handleManifestCancel }
460
- >
461
- Cancel
462
- </ button >
463
- </ div >
464
- ) : (
465
- < button
466
- type = "button"
467
- className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
468
- onClick = { handleManifestEdit }
469
- >
470
- < >
471
- < ICPencil className = "icon-dim-16 scb-5" />
472
- < span > Edit live manifest</ span >
473
- </ >
474
- </ button >
475
- ) }
476
- </ >
477
- ) }
478
- { manifestCodeEditorMode === ManifestCodeEditorMode . READ &&
479
- ! showManifestCompareView &&
480
- ( showDesiredAndCompareManifest || isResourceMissing ) && (
481
- < >
482
- < div className = "ml-12 mr-12 tab-cell-border" />
483
- < button
484
- type = "button"
485
- className = "dc__unset-button-styles cb-5 fs-12 lh-1-5 fw-6 flex dc__gap-4"
486
- onClick = { handleManifestCompareWithDesired }
487
- >
488
- < ICArrowsLeftRight className = "icon-dim-16 scb-5" />
489
- < span > Compare with desired</ span >
490
- </ button >
491
- </ >
492
- ) }
493
- </ >
494
- ) }
494
+ { selectedTabName === NodeDetailTab . MANIFEST && renderManifestTabHeader ( ) }
495
495
</ div >
496
496
{ isResourceBrowserView &&
497
497
! hideDeleteButton && ( // hide delete button if resource is deleted or user is not authorized
0 commit comments