@@ -6,8 +6,9 @@ import { DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP } from '@Shared/constants'
66import { YAMLStringify } from '@Common/Helper'
77import { SortingOrder } from '@Common/Constants'
88import {
9- AppEnvDeploymentConfigListParams ,
109 DeploymentConfigDiffProps ,
10+ DeploymentHistorySingleValue ,
11+ AppEnvDeploymentConfigListParams ,
1112 DiffHeadingDataType ,
1213 prepareHistoryData ,
1314} from '@Shared/Components'
@@ -77,6 +78,20 @@ export const mergeConfigDataArraysByName = (
7778 return Array . from ( dataMap . values ( ) )
7879}
7980
81+ /**
82+ * Checks if the given secret is an external Kubernetes secret.
83+ *
84+ * @param secret - The secret data object to check.
85+ * @returns `true` if the secret is an external Kubernetes secret else `false` \
86+ * or `null` if the secret is invalid.
87+ */
88+ const isExternalKubernetesSecret = ( secret : ConfigMapSecretDataConfigDatumDTO ) => {
89+ if ( ! secret ) {
90+ return null
91+ }
92+ return secret . subPath && secret . external && secret . externalType === 'KubernetesSecret'
93+ }
94+
8095/**
8196 * Retrieves data for a given configuration, depending on the type.
8297 *
@@ -179,8 +194,8 @@ const getCodeEditorData = (
179194 const compareToConfigData = getConfigData ( compareToValue , type )
180195 const compareWithConfigData = getConfigData ( compareWithValue , type )
181196
182- let compareToCodeEditorData
183- let compareWithCodeEditorData
197+ let compareToCodeEditorData : DeploymentHistorySingleValue
198+ let compareWithCodeEditorData : DeploymentHistorySingleValue
184199
185200 if ( type === ConfigResourceType . Secret ) {
186201 const { compareToObfuscatedData, compareWithObfuscatedData } = getObfuscatedData (
@@ -192,12 +207,26 @@ const getCodeEditorData = (
192207
193208 compareToCodeEditorData = {
194209 displayName : 'data' ,
195- value : JSON . stringify ( compareToObfuscatedData ) || '' ,
210+ ...( isExternalKubernetesSecret ( compareToValue )
211+ ? {
212+ value : null ,
213+ resolvedValue : JSON . stringify ( compareToObfuscatedData ) || '' ,
214+ }
215+ : {
216+ value : JSON . stringify ( compareToObfuscatedData ) || '' ,
217+ } ) ,
196218 }
197219
198220 compareWithCodeEditorData = {
199221 displayName : 'data' ,
200- value : JSON . stringify ( compareWithObfuscatedData ) || '' ,
222+ ...( isExternalKubernetesSecret ( compareWithValue )
223+ ? {
224+ value : null ,
225+ resolvedValue : JSON . stringify ( compareWithObfuscatedData ) || '' ,
226+ }
227+ : {
228+ value : JSON . stringify ( compareWithObfuscatedData ) || '' ,
229+ } ) ,
201230 }
202231 } else {
203232 compareToCodeEditorData = {
0 commit comments