From 1e74881c80d879904971e694426c538c65cd1cb0 Mon Sep 17 00:00:00 2001 From: loganhz Date: Fri, 29 Dec 2017 22:52:08 +0800 Subject: [PATCH 1/2] Update certificates page --- app/certificates/index/controller.js | 25 ++++++------------- app/certificates/new/template.hbs | 1 + .../components/certificate-row/template.hbs | 23 +++-------------- .../components/input-certificate/template.hbs | 22 +++++----------- .../modal-edit-certificate/template.hbs | 1 + translations/en-us.yaml | 2 ++ 6 files changed, 21 insertions(+), 53 deletions(-) diff --git a/app/certificates/index/controller.js b/app/certificates/index/controller.js index 3f483efb8..fd781d0b0 100644 --- a/app/certificates/index/controller.js +++ b/app/certificates/index/controller.js @@ -4,27 +4,16 @@ export default Controller.extend({ sortBy: 'name', headers: [ { - name: 'state', - sort: ['sortState','name','id'], - translationKey: 'certificatesPage.index.table.header.state', - width: 125, - }, - { - name: 'name', - sort: ['name','id'], + name: 'name', + sort: ['name', 'id'], translationKey: 'certificatesPage.index.table.header.name', }, { - name: 'cn', - searchField: ['CN'], - sort: ['CN','id'], - translationKey: 'certificatesPage.index.table.header.domain', - }, - { - name: 'expires', - sort: ['expiresDate','id'], - translationKey: 'certificatesPage.index.table.header.expires', - width: 120, + name: 'created', + sort: ['created', 'id'], + classNames: 'text-right pr-20', + searchField: 'created', + translationKey: 'certificatesPage.index.table.header.created', }, ], }); diff --git a/app/certificates/new/template.hbs b/app/certificates/new/template.hbs index 08b5c0360..586263bc6 100644 --- a/app/certificates/new/template.hbs +++ b/app/certificates/new/template.hbs @@ -6,6 +6,7 @@ {{form-name-description model=primaryResource nameRequired=true + descriptionShown=false namePlaceholder="certificatesPage.new.form.name.placeholder" descriptionPlaceholder="certificatesPage.new.form.description.placeholder" }} diff --git a/lib/shared/addon/components/certificate-row/template.hbs b/lib/shared/addon/components/certificate-row/template.hbs index 89036b535..2fc822558 100644 --- a/lib/shared/addon/components/certificate-row/template.hbs +++ b/lib/shared/addon/components/certificate-row/template.hbs @@ -1,24 +1,9 @@ - - {{badge-state model=model}} - - {{#link-to "certificates.detail" model.id}}{{model.displayName}}{{/link-to}} + {{model.displayName}} - - {{#if model.CN}} - {{model.CN}} - {{#if model.countableSans.length}} - + {{model.countableSans.length}} other{{if (eq model.countableSans.length 1) "" "s"}} - {{/if}} - {{else}} - None - {{/if}} - - - - {{date-from-now model.expiresDate}} - + + {{date-calendar model.created}} {{action-menu model=model}} - + \ No newline at end of file diff --git a/lib/shared/addon/components/input-certificate/template.hbs b/lib/shared/addon/components/input-certificate/template.hbs index 60da0488d..a77777b00 100644 --- a/lib/shared/addon/components/input-certificate/template.hbs +++ b/lib/shared/addon/components/input-certificate/template.hbs @@ -1,4 +1,4 @@ -
+
@@ -11,28 +11,18 @@ }}
-
+
+ + {{t 'inputCertificate.cert.protip'}} +
{{input-text-file - value=model.cert + value=model.certs accept="application/x-x509-ca-cert,text/plain,.pem,.crt" minHeight=60 placeholder="inputCertificate.cert.placeholder" showUploadLabel=false }}
- -
-
- -
- {{input-text-file - value=model.certChain - accept="application/x-x509-ca-cert,text/plain,.pem,.crt" - minHeight=60 - placeholder="inputCertificate.certChain.placeholder" - showUploadLabel=false - }} -
diff --git a/lib/shared/addon/components/modal-edit-certificate/template.hbs b/lib/shared/addon/components/modal-edit-certificate/template.hbs index b2b292bf9..3d60ccef1 100644 --- a/lib/shared/addon/components/modal-edit-certificate/template.hbs +++ b/lib/shared/addon/components/modal-edit-certificate/template.hbs @@ -4,6 +4,7 @@ {{form-name-description model=primaryResource nameRequired=true + descriptionShown=false namePlaceholder="editCertificate.name.placeholder" descriptionPlaceholder="editCertificate.description.placeholder" }} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index a51a34e7c..cbc48765c 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -540,6 +540,7 @@ certificatesPage: name: Name domain: Domain Name expires: Expires + created: Created body: noData: You do not have any certificates yet. new: @@ -2834,6 +2835,7 @@ inputCertificate: cert: label: Certificate placeholder: "Paste in the primary certificate, starting with -----BEGIN CERTIFICATE-----" + protip: Please include any chain certificates that are needed. certChain: label: Chain Certs placeholder: "Optional; Paste in the additional chained certificates, starting with -----BEGIN CERTIFICATE-----" From 6d7ef3c105f683a622597071a1a8eca6319317f8 Mon Sep 17 00:00:00 2001 From: loganhz Date: Tue, 2 Jan 2018 10:03:38 +0800 Subject: [PATCH 2/2] Add expiresDate and CN back --- app/certificates/detail/template.hbs | 4 ++-- app/certificates/index/controller.js | 12 ++++++++++++ app/models/certificate.js | 14 +++++++------- .../components/certificate-row/template.hbs | 17 ++++++++++++++++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/certificates/detail/template.hbs b/app/certificates/detail/template.hbs index eae00d3de..c9c3a4636 100644 --- a/app/certificates/detail/template.hbs +++ b/app/certificates/detail/template.hbs @@ -61,8 +61,8 @@
    - {{#if model.certificate.CN}} -
  • {{model.certificate.CN}} (CN)
  • + {{#if model.certificate.cn}} +
  • {{model.certificate.cn}} (CN)
  • {{#each model.certificate.displaySans as |san|}}
  • {{san}}
  • {{/each}} diff --git a/app/certificates/index/controller.js b/app/certificates/index/controller.js index fd781d0b0..8550a3194 100644 --- a/app/certificates/index/controller.js +++ b/app/certificates/index/controller.js @@ -8,6 +8,18 @@ export default Controller.extend({ sort: ['name', 'id'], translationKey: 'certificatesPage.index.table.header.name', }, + { + name: 'cn', + searchField: ['cn'], + sort: ['cn','id'], + translationKey: 'certificatesPage.index.table.header.domain', + }, + { + name: 'expires', + sort: ['expiresDate','id'], + translationKey: 'certificatesPage.index.table.header.expires', + width: 120, + }, { name: 'created', sort: ['created', 'id'], diff --git a/app/models/certificate.js b/app/models/certificate.js index b470202cb..02387dd5e 100644 --- a/app/models/certificate.js +++ b/app/models/certificate.js @@ -49,17 +49,17 @@ export default Resource.extend({ // subjectAlternativeNames can be null: return (this.get('subjectAlternativeNames')||[]) .slice() - .removeObject(this.get('CN')) + .removeObject(this.get('cn')) .filter((san) => { return (san+'').indexOf('@') === -1; }); - }.property('CN','subjectAlternativeNames.[]'), + }.property('cn','subjectAlternativeNames.[]'), countableSans: function() { var sans = this.get('displaySans').slice(); - if ( this.get('CN') ) + if ( this.get('cn') ) { - sans.pushObject(this.get('CN')); + sans.pushObject(this.get('cn')); } var commonBases = sans.filter((name) => { @@ -69,12 +69,12 @@ export default Resource.extend({ }); return this.get('displaySans').slice().removeObjects(commonBases); - }.property('displaySans.[]','CN'), + }.property('displaySans.[]','cn'), displayDetailedName: function() { var name = (this.get('name') || '('+this.get('id')+')'); var str = name; - var cn = this.get('CN'); + var cn = this.get('cn'); var sans = this.get('countableSans.length'); var more = ''; @@ -97,5 +97,5 @@ export default Resource.extend({ } return str; - }.property('id','name','CN','countableSans.length') + }.property('id','name','cn','countableSans.length') }); diff --git a/lib/shared/addon/components/certificate-row/template.hbs b/lib/shared/addon/components/certificate-row/template.hbs index 2fc822558..20660739e 100644 --- a/lib/shared/addon/components/certificate-row/template.hbs +++ b/lib/shared/addon/components/certificate-row/template.hbs @@ -1,5 +1,20 @@ - {{model.displayName}} + {{#link-to "certificates.detail" model.id}}{{model.displayName}}{{/link-to}} + + + {{#if model.cn}} + {{model.cn}} + {{#if model.countableSans.length}} + + {{model.countableSans.length}} other{{if (eq model.countableSans.length 1) "" "s"}} + {{/if}} + {{else}} + {{t 'generic.none'}} + {{/if}} + + + + {{date-from-now model.expiresDate}} + {{date-calendar model.created}}