@@ -20,7 +20,7 @@ import (
20
20
"context"
21
21
"encoding/json"
22
22
"errors"
23
- "strings "
23
+ globalUtil "github.com/devtron-labs/devtron/util "
24
24
"time"
25
25
26
26
"github.com/devtron-labs/devtron/internal/sql/repository/chartConfig"
@@ -490,7 +490,7 @@ func (impl ConfigMapHistoryServiceImpl) GetHistoryForDeployedCMCSById(ctx contex
490
490
SubPath : & config .SubPath ,
491
491
FilePermission : config .FilePermission ,
492
492
CodeEditorValue : & HistoryDetailConfig {
493
- DisplayName : "Data" ,
493
+ DisplayName : DataDisplayName ,
494
494
Value : string (config .Data ),
495
495
VariableSnapshot : variableSnapshotMap ,
496
496
ResolvedValue : resolvedTemplate ,
@@ -521,13 +521,27 @@ func (impl ConfigMapHistoryServiceImpl) GetHistoryForDeployedCMCSById(ctx contex
521
521
}
522
522
historyDto .ExternalSecretType = config .ExternalSecretType
523
523
historyDto .RoleARN = config .RoleARN
524
+ historyDto .ESOSubPath = config .ESOSubPath
524
525
if config .External {
525
- externalSecretData , err := json .Marshal (config .ExternalSecret )
526
- if err != nil {
527
- impl .logger .Errorw ("error in marshaling external secret data" , "err" , err )
528
- }
529
- if len (externalSecretData ) > 0 {
530
- historyDto .CodeEditorValue .Value = string (externalSecretData )
526
+ if config .ExternalSecretType == globalUtil .KubernetesSecret {
527
+ externalSecretData , err := json .Marshal (config .ExternalSecret )
528
+ if err != nil {
529
+ impl .logger .Errorw ("error in marshaling external secret data" , "err" , err )
530
+ }
531
+ if len (externalSecretData ) > 0 {
532
+ historyDto .CodeEditorValue .DisplayName = ExternalSecretDisplayName
533
+ historyDto .CodeEditorValue .Value = string (externalSecretData )
534
+ }
535
+ } else if config .IsESOExternalSecretType () {
536
+ externalSecretDataBytes , jErr := json .Marshal (config .ESOSecretData )
537
+ if jErr != nil {
538
+ impl .logger .Errorw ("error in marshaling eso secret data" , "esoSecretData" , config .ESOSecretData , "err" , jErr )
539
+ return nil , jErr
540
+ }
541
+ if len (externalSecretDataBytes ) > 0 {
542
+ historyDto .CodeEditorValue .DisplayName = ESOSecretDataDisplayName
543
+ historyDto .CodeEditorValue .Value = string (externalSecretDataBytes )
544
+ }
531
545
}
532
546
}
533
547
}
@@ -593,7 +607,7 @@ func (impl ConfigMapHistoryServiceImpl) ConvertConfigDataToComponentLevelDto(con
593
607
SubPath : & config .SubPath ,
594
608
FilePermission : config .FilePermission ,
595
609
CodeEditorValue : & HistoryDetailConfig {
596
- DisplayName : "Data" ,
610
+ DisplayName : DataDisplayName ,
597
611
Value : string (config .Data ),
598
612
},
599
613
}
@@ -623,22 +637,27 @@ func (impl ConfigMapHistoryServiceImpl) ConvertConfigDataToComponentLevelDto(con
623
637
}
624
638
historyDto .ExternalSecretType = config .ExternalSecretType
625
639
historyDto .RoleARN = config .RoleARN
640
+ historyDto .ESOSubPath = config .ESOSubPath
626
641
if config .External {
627
642
var externalSecretData []byte
628
- if strings .HasPrefix (config .ExternalSecretType , "ESO" ) {
643
+ displayName := historyDto .CodeEditorValue .DisplayName
644
+ if config .IsESOExternalSecretType () {
645
+ displayName = ESOSecretDataDisplayName
629
646
externalSecretData , err = json .Marshal (config .ESOSecretData )
630
647
if err != nil {
631
648
impl .logger .Errorw ("error in marshaling external secret data" , "err" , err )
632
649
return nil , err
633
650
}
634
651
} else {
652
+ displayName = ExternalSecretDisplayName
635
653
externalSecretData , err = json .Marshal (config .ExternalSecret )
636
654
if err != nil {
637
655
impl .logger .Errorw ("error in marshaling external secret data" , "err" , err )
638
656
return nil , err
639
657
}
640
658
}
641
659
if len (externalSecretData ) > 0 {
660
+ historyDto .CodeEditorValue .DisplayName = displayName
642
661
historyDto .CodeEditorValue .Value = string (externalSecretData )
643
662
}
644
663
}
0 commit comments