1717import React , { useCallback , useEffect , useMemo , useState } from "react" ;
1818import debounce from "lodash/debounce" ;
1919import get from "lodash/get" ;
20- import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper" ;
2120import Grid from "@material-ui/core/Grid" ;
2221import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper" ;
2322import { Button , LinearProgress , Paper , Typography } from "@material-ui/core" ;
@@ -27,10 +26,7 @@ import TableCell from "@material-ui/core/TableCell";
2726import TableRow from "@material-ui/core/TableRow" ;
2827import api from "../../../../common/api" ;
2928import { createStyles , Theme , withStyles } from "@material-ui/core/styles" ;
30- import {
31- containerForHeader ,
32- modalBasic ,
33- } from "../../Common/FormComponents/common/styleLibrary" ;
29+ import { modalBasic } from "../../Common/FormComponents/common/styleLibrary" ;
3430import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper" ;
3531import SelectWrapper from "../../Common/FormComponents/SelectWrapper/SelectWrapper" ;
3632import {
@@ -268,6 +264,7 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
268264 vaultCert : "" ,
269265 vaultCA : "" ,
270266 gemaltoCA : "" ,
267+ gcpPrivateKey : "" ,
271268 } ) ;
272269
273270 // Files States
@@ -299,6 +296,7 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
299296 const [ vaultCertVal , setVaultCertVal ] = useState < string > ( "" ) ;
300297 const [ vaultCAVal , setVaultCAVal ] = useState < string > ( "" ) ;
301298 const [ gemaltoCAVal , setGemaltoCAVal ] = useState < string > ( "" ) ;
299+ const [ gcpPrivateKeyVal , setGcpPrivateKeyVal ] = useState < string > ( "" ) ;
302300
303301 // Flow
304302
@@ -853,17 +851,6 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
853851 ] ;
854852 }
855853
856- if ( encryptionType === "gcp" ) {
857- encryptionValidation = [
858- ...encryptionValidation ,
859- {
860- fieldKey : "gcp_project_id" ,
861- required : true ,
862- value : gcpProjectID ,
863- } ,
864- ] ;
865- }
866-
867854 if ( encryptionType === "aws" ) {
868855 encryptionValidation = [
869856 ...encryptionValidation ,
@@ -1100,7 +1087,13 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
11001087 } ,
11011088 } ;
11021089 break ;
1103- case "GCP" :
1090+ case "gcp" :
1091+ // let gcpPrivateKey = {};
1092+ // if (filesBase64.gcpPrivateKey !== "") {
1093+ // gcpPrivateKey = {
1094+ // private_key: filesBase64.gcpPrivateKey,
1095+ // };
1096+ // }
11041097 insertEncrypt = {
11051098 gcp : {
11061099 secretmanager : {
@@ -1111,6 +1104,7 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
11111104 client_id : gcpClientID ,
11121105 private_key_id : gcpPrivateKeyID ,
11131106 private_key : gcpPrivateKey ,
1107+ // ...gcpPrivateKey,
11141108 } ,
11151109 } ,
11161110 } ,
@@ -2311,12 +2305,9 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
23112305 name = "gcp_project_id"
23122306 onChange = { ( e : React . ChangeEvent < HTMLInputElement > ) => {
23132307 setGcpProjectID ( e . target . value ) ;
2314- clearValidationError ( "gcp_project_id" ) ;
23152308 } }
23162309 label = "Project ID"
23172310 value = { gcpProjectID }
2318- error = { validationErrors [ "gcp_project_id" ] || "" }
2319- required
23202311 />
23212312 </ Grid >
23222313 < Grid item xs = { 12 } >
@@ -2375,6 +2366,20 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
23752366 value = { gcpPrivateKey }
23762367 />
23772368 </ Grid >
2369+ { /*<Grid item xs={12}>*/ }
2370+ { /* <FileSelector*/ }
2371+ { /* onChange={(encodedValue, fileName) => {*/ }
2372+ { /* storeCertInObject("gcpPrivateKey", encodedValue);*/ }
2373+ { /* setGcpPrivateKeyVal(fileName);*/ }
2374+ { /* clearValidationError("gcp_private_key");*/ }
2375+ { /* }}*/ }
2376+ { /* accept=".key,.pem"*/ }
2377+ { /* id="gcp_private_key"*/ }
2378+ { /* name="gcp_private_key"*/ }
2379+ { /* label="Private Key"*/ }
2380+ { /* value={gcpPrivateKeyVal}*/ }
2381+ { /* />*/ }
2382+ { /*</Grid>*/ }
23782383 </ React . Fragment >
23792384 ) }
23802385 { encryptionType === "aws" && (
0 commit comments