@@ -1016,97 +1016,101 @@ export const connectionTypes: ConnectionType[] = [
10161016 }
10171017 ] ,
10181018 convertToFormSpecificValue : ( data : Record < string , any > ) => {
1019- // Create a base Connection object with standard fields
1019+ // Create a base connection object with standard fields
10201020 const connection : Connection = {
10211021 ...data ,
10221022 name : data . name ,
10231023 namespace : data . namespace ,
10241024 type : ConnectionValueType . Kubernetes
10251025 } ;
10261026
1027- // Set the form values based on properties
1028- if ( data . properties ) {
1029- // Set connectionMethod
1030- if ( data . properties . connectionMethod ) {
1031- connection . connectionMethod = data . properties . connectionMethod ;
1032- }
1033-
1034- // Set kubeconfig fields
1035- if ( data . properties . kubeconfig ) {
1036- connection . kubeconfig = data . properties . kubeconfig ;
1037- }
1038-
1039- // Set EKS fields
1040- if ( data . properties . eksAwsConnection ) {
1041- connection . eksUseExistingConnection = true ;
1042- connection . eksAwsConnection = data . properties . eksAwsConnection ;
1043- }
1044-
1045- if ( data . properties . eksCluster ) {
1046- connection . eksCluster = data . properties . eksCluster ;
1047- }
1048-
1049- if ( data . properties . eksRegion ) {
1050- connection . eksRegion = data . properties . eksRegion ;
1051- }
1052-
1053- if ( data . properties . eksAccessKey ) {
1054- connection . eksAccessKey = data . properties . eksAccessKey ;
1055- }
1056-
1057- if ( data . properties . eksSecretKey ) {
1058- connection . eksSecretKey = data . properties . eksSecretKey ;
1059- }
1060-
1061- if ( data . properties . eksEndpoint ) {
1062- connection . eksEndpoint = data . properties . eksEndpoint ;
1063- }
1064-
1065- if ( data . properties . eksSkipTLSVerify ) {
1066- connection . eksSkipTLSVerify = data . properties . eksSkipTLSVerify ;
1067- }
1068-
1069- // Set GKE fields
1070- if ( data . properties . gkeGcpConnection ) {
1071- connection . gkeUseExistingConnection = true ;
1072- connection . gkeGcpConnection = data . properties . gkeGcpConnection ;
1073- }
1074-
1075- if ( data . properties . gkeCluster ) {
1076- connection . gkeCluster = data . properties . gkeCluster ;
1077- }
1078-
1079- if ( data . properties . gkeProject ) {
1080- connection . gkeProject = data . properties . gkeProject ;
1081- }
1082-
1083- if ( data . properties . gkeZone ) {
1084- connection . gkeZone = data . properties . gkeZone ;
1085- }
1086-
1087- if ( data . properties . gkeCredentials ) {
1088- connection . gkeCredentials = data . properties . gkeCredentials ;
1089- }
1090-
1091- if ( data . properties . gkeEndpoint ) {
1092- connection . gkeEndpoint = data . properties . gkeEndpoint ;
1093- }
1094-
1095- if ( data . properties . gkeSkipTLSVerify ) {
1096- connection . gkeSkipTLSVerify = data . properties . gkeSkipTLSVerify ;
1097- }
1098-
1099- // Set CNRM fields
1100- if ( data . properties . cnrmClusterResource ) {
1101- connection . cnrmClusterResource = data . properties . cnrmClusterResource ;
1102- }
1103-
1104- if ( data . properties . cnrmClusterResourceNamespace ) {
1105- connection . cnrmClusterResourceNamespace = data . properties . cnrmClusterResourceNamespace ;
1106- }
1027+ // Create a form values object to store all the Kubernetes-specific fields
1028+ const formValues : Record < string , any > = { } ;
1029+
1030+ // Set connection method from properties
1031+ if ( data . properties ?. connectionMethod ) {
1032+ formValues . connectionMethod = data . properties . connectionMethod ;
11071033 }
11081034
1109- return connection ;
1035+ // Handle kubeconfig
1036+ if ( data . properties ?. kubeconfig ) {
1037+ formValues . kubeconfig = data . properties . kubeconfig ;
1038+ }
1039+
1040+ // Handle EKS configuration
1041+ if ( data . properties ?. eksAwsConnection ) {
1042+ formValues . eksUseExistingConnection = true ;
1043+ formValues . eksAwsConnection = data . properties . eksAwsConnection ;
1044+ }
1045+
1046+ if ( data . properties ?. eksCluster ) {
1047+ formValues . eksCluster = data . properties . eksCluster ;
1048+ }
1049+
1050+ if ( data . properties ?. eksRegion ) {
1051+ formValues . eksRegion = data . properties . eksRegion ;
1052+ }
1053+
1054+ if ( data . properties ?. eksAccessKey ) {
1055+ formValues . eksAccessKey = data . properties . eksAccessKey ;
1056+ }
1057+
1058+ if ( data . properties ?. eksSecretKey ) {
1059+ formValues . eksSecretKey = data . properties . eksSecretKey ;
1060+ }
1061+
1062+ if ( data . properties ?. eksEndpoint ) {
1063+ formValues . eksEndpoint = data . properties . eksEndpoint ;
1064+ }
1065+
1066+ if ( data . properties ?. eksSkipTLSVerify ) {
1067+ formValues . eksSkipTLSVerify = data . properties . eksSkipTLSVerify ;
1068+ }
1069+
1070+ // Handle GKE configuration
1071+ if ( data . properties ?. gkeGcpConnection ) {
1072+ formValues . gkeUseExistingConnection = true ;
1073+ formValues . gkeGcpConnection = data . properties . gkeGcpConnection ;
1074+ }
1075+
1076+ if ( data . properties ?. gkeCluster ) {
1077+ formValues . gkeCluster = data . properties . gkeCluster ;
1078+ }
1079+
1080+ if ( data . properties ?. gkeProject ) {
1081+ formValues . gkeProject = data . properties . gkeProject ;
1082+ }
1083+
1084+ if ( data . properties ?. gkeZone ) {
1085+ formValues . gkeZone = data . properties . gkeZone ;
1086+ }
1087+
1088+ if ( data . properties ?. gkeCredentials ) {
1089+ formValues . gkeCredentials = data . properties . gkeCredentials ;
1090+ }
1091+
1092+ if ( data . properties ?. gkeEndpoint ) {
1093+ formValues . gkeEndpoint = data . properties . gkeEndpoint ;
1094+ }
1095+
1096+ if ( data . properties ?. gkeSkipTLSVerify ) {
1097+ formValues . gkeSkipTLSVerify = data . properties . gkeSkipTLSVerify ;
1098+ }
1099+
1100+ // Handle CNRM configuration
1101+ if ( data . properties ?. cnrmClusterResource ) {
1102+ formValues . cnrmClusterResource = data . properties . cnrmClusterResource ;
1103+ }
1104+
1105+ if ( data . properties ?. cnrmClusterResourceNamespace ) {
1106+ formValues . cnrmClusterResourceNamespace = data . properties . cnrmClusterResourceNamespace ;
1107+ }
1108+
1109+ // Merge the form values with the connection
1110+ return {
1111+ ...connection ,
1112+ ...formValues
1113+ } ;
11101114 } ,
11111115 preSubmitConverter : ( data : Record < string , string > ) => {
11121116 const connectionMethod = data . connectionMethod || "kubeconfig" ;
0 commit comments