You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/05/18 15:12:02 UTC

[incubator-apisix-dashboard] branch next updated: fix: show file when parse SSL file fail (#195)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git


The following commit(s) were added to refs/heads/next by this push:
     new e8bf5b5  fix: show file when parse SSL file fail (#195)
e8bf5b5 is described below

commit e8bf5b52c56149a025e795e49dd0edfcd0e7f732
Author: litesun <31...@users.noreply.github.com>
AuthorDate: Mon May 18 23:11:52 2020 +0800

    fix: show file when parse SSL file fail (#195)
    
    * feat: limit upload file
    
    * feat: intercept default upload api request
    
    * feat: limit upload file type
    
    * fix: show file when parse SSL file  fail
---
 .../create/components/CertificateUploader/index.tsx    | 18 +++++++++---------
 src/pages/SSLModule/create/components/Step2/index.tsx  |  4 ++--
 src/pages/SSLModule/create/index.tsx                   |  4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pages/SSLModule/create/components/CertificateUploader/index.tsx b/src/pages/SSLModule/create/components/CertificateUploader/index.tsx
index 9a617ca..9408862 100644
--- a/src/pages/SSLModule/create/components/CertificateUploader/index.tsx
+++ b/src/pages/SSLModule/create/components/CertificateUploader/index.tsx
@@ -16,11 +16,11 @@ export interface UploadPublicSuccessData {
   sni: string;
   cert: string;
   expireTime: Date;
-  publicKeyDefaultFileList: UploadFile[];
+  publicKeyFileList: UploadFile[];
 }
 export interface UploadPrivateSuccessData {
   key: string;
-  privateKeyDefaultFileList: UploadFile[];
+  privateKeyFileList: UploadFile[];
 }
 
 interface UploaderProps {
@@ -30,7 +30,7 @@ interface UploaderProps {
 }
 
 const CertificateUploader: React.FC<UploaderProps> = ({ onSuccess, onRemove, data }) => {
-  const { publicKeyDefaultFileList = [], privateKeyDefaultFileList = [] } = data;
+  const { publicKeyFileList = [], privateKeyFileList = [] } = data;
   const [form] = useForm();
 
   const genUploadFile = (name = ''): UploadFile => {
@@ -60,7 +60,7 @@ const CertificateUploader: React.FC<UploaderProps> = ({ onSuccess, onRemove, dat
             sni: altNames,
             cert: result,
             expireTime: cert.validity.notAfter,
-            publicKeyDefaultFileList: [genUploadFile(fileName)],
+            publicKeyFileList: [genUploadFile(fileName)],
           };
           onSuccess(uploadPublicData);
         } catch (error) {
@@ -69,7 +69,7 @@ const CertificateUploader: React.FC<UploaderProps> = ({ onSuccess, onRemove, dat
       } else {
         const uploadprivateData: UploadPrivateSuccessData = {
           key: result,
-          privateKeyDefaultFileList: [genUploadFile(fileName)],
+          privateKeyFileList: [genUploadFile(fileName)],
         };
         onSuccess(uploadprivateData);
       }
@@ -88,10 +88,10 @@ const CertificateUploader: React.FC<UploaderProps> = ({ onSuccess, onRemove, dat
           accept=".pem"
           className={styles.stepForm}
           onRemove={() => onRemove('PUBLIC_KEY')}
-          defaultFileList={publicKeyDefaultFileList}
+          fileList={publicKeyFileList}
           beforeUpload={(file, fileList) => beforeUpload(file, fileList, 'PUBLIC_KEY')}
         >
-          <Button disabled={publicKeyDefaultFileList.length === 1}>
+          <Button disabled={publicKeyFileList.length === 1}>
             <UploadOutlined /> 点击上传公钥
           </Button>
         </Upload>
@@ -101,10 +101,10 @@ const CertificateUploader: React.FC<UploaderProps> = ({ onSuccess, onRemove, dat
           accept=".key"
           className={styles.stepForm}
           onRemove={() => onRemove('PRIVATE_KEY')}
-          defaultFileList={privateKeyDefaultFileList}
+          fileList={privateKeyFileList}
           beforeUpload={(file, fileList) => beforeUpload(file, fileList, 'PRIVATE_KEY')}
         >
-          <Button disabled={privateKeyDefaultFileList.length === 1}>
+          <Button disabled={privateKeyFileList.length === 1}>
             <UploadOutlined /> 点击上传私钥
           </Button>
         </Upload>
diff --git a/src/pages/SSLModule/create/components/Step2/index.tsx b/src/pages/SSLModule/create/components/Step2/index.tsx
index 2346159..f6e80b9 100644
--- a/src/pages/SSLModule/create/components/Step2/index.tsx
+++ b/src/pages/SSLModule/create/components/Step2/index.tsx
@@ -47,14 +47,14 @@ const Step2: React.FC<StepProps> = ({ onStepChange, onFormChange, data }) => {
   const onRemove = (type: UploadType) => {
     if (type === 'PUBLIC_KEY') {
       onFormChange({
-        publicKeyDefaultFileList: [],
+        publicKeyFileList: [],
         cert: '',
         sni: '',
         expireTime: undefined,
       });
     } else {
       onFormChange({
-        privateKeyDefaultFileList: [],
+        privateKeyFileList: [],
         key: '',
       });
     }
diff --git a/src/pages/SSLModule/create/index.tsx b/src/pages/SSLModule/create/index.tsx
index 24a3655..2d2db9a 100644
--- a/src/pages/SSLModule/create/index.tsx
+++ b/src/pages/SSLModule/create/index.tsx
@@ -16,8 +16,8 @@ export interface FormData {
   cert?: string;
   key?: string;
   expireTime?: Date;
-  publicKeyDefaultFileList?: UploadFile[];
-  privateKeyDefaultFileList?: UploadFile[];
+  publicKeyFileList?: UploadFile[];
+  privateKeyFileList?: UploadFile[];
 }
 
 export interface StepProps {