From 650743e18fa8b8b63e6b4f10e6c72c8dbd19a4c8 Mon Sep 17 00:00:00 2001 From: Kianna <30884335+kiannaquach@users.noreply.github.com> Date: Wed, 3 May 2023 13:00:46 -0700 Subject: [PATCH] UI: PKI error handling + some small bugs! (#20478) --- ui/app/adapters/pki/issuer.js | 10 +- ui/app/styles/core/tag.scss | 4 + .../components/pki/config-pki-ca.hbs | 264 ------------------ .../addon/components/page/pki-issuer-list.hbs | 22 +- ui/lib/pki/addon/components/pki-role-form.hbs | 2 +- ui/lib/pki/addon/routes/error.js | 3 +- ui/lib/pki/addon/routes/roles/create.js | 8 +- ui/lib/pki/addon/routes/roles/role/edit.js | 8 +- .../pki/pki-engine-workflow-test.js | 4 +- 9 files changed, 44 insertions(+), 281 deletions(-) delete mode 100644 ui/app/templates/components/pki/config-pki-ca.hbs diff --git a/ui/app/adapters/pki/issuer.js b/ui/app/adapters/pki/issuer.js index 08267c052..9f15ff11a 100644 --- a/ui/app/adapters/pki/issuer.js +++ b/ui/app/adapters/pki/issuer.js @@ -6,7 +6,7 @@ import ApplicationAdapter from '../application'; import { encodePath } from 'vault/utils/path-encoding-helpers'; import { all } from 'rsvp'; -import { verifyCertificates } from 'vault/utils/parse-pki-cert'; +import { verifyCertificates, parseCertificate } from 'vault/utils/parse-pki-cert'; export default class PkiIssuerAdapter extends ApplicationAdapter { namespace = 'v1'; @@ -39,7 +39,13 @@ export default class PkiIssuerAdapter extends ApplicationAdapter { const issuerRecord = await this.queryRecord(store, type, { id, backend: query.backend }); const { data } = issuerRecord; const isRoot = await verifyCertificates(data.certificate, data.certificate); - return { ...keyInfo, ...data, isRoot }; + const parsedCertificate = parseCertificate(data.certificate); + return { + ...keyInfo, + ...data, + isRoot, + parsedCertificate: { common_name: parsedCertificate.common_name }, + }; } catch (e) { return { ...keyInfo, issuer_id: id }; } diff --git a/ui/app/styles/core/tag.scss b/ui/app/styles/core/tag.scss index 9ecac0c80..5f55d7167 100644 --- a/ui/app/styles/core/tag.scss +++ b/ui/app/styles/core/tag.scss @@ -53,6 +53,10 @@ border: 1px solid $grey-light; } + &.is-transparent { + background-color: transparent; + } + &.is-small { height: auto; } diff --git a/ui/app/templates/components/pki/config-pki-ca.hbs b/ui/app/templates/components/pki/config-pki-ca.hbs deleted file mode 100644 index 33408972d..000000000 --- a/ui/app/templates/components/pki/config-pki-ca.hbs +++ /dev/null @@ -1,264 +0,0 @@ -{{#if this.replaceCA}} - -

- {{#if this.needsConfig}} - Configure CA Certificate - {{else}} - {{#if this.model.certificate}} - Generated Certificate - {{else}} - Add CA Certificate - {{/if}} - {{/if}} -

- {{#if (or this.model.certificate this.model.csr)}} - {{#if (eq this.model.canParse false)}} - - {{/if}} - {{#each this.model.attrs as |attr|}} - {{#if (and attr.options.masked (get this.model attr.name))}} - - - - {{else if (and (get this.model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} - - {{else}} - - {{/if}} - {{/each}} -
-
- - Copy - {{if this.model.certificate "Certificate" "CSR"}} - -
-
- -
-
- {{else}} -
- - -
-
-
- -
-
- -
-
-
- - {{/if}} -{{else if this.signIntermediate}} - {{#if (or this.model.certificate)}} - - {{#each this.model.attrs as |attr|}} - {{#if (and attr.options.masked (get this.model attr.name))}} - - - - {{else if (and (get this.model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} - - {{else}} - - {{/if}} - {{/each}} -
-
- - Copy Certificate - -
-
- -
-
- {{else}} -

Sign intermediate

- - -
- -
-
- -
-
- -
-
- - {{/if}} -{{else if this.setSignedIntermediate}} -

Set signed intermediate

- - -

- Submit a signed CA certificate corresponding to a generated private key. -

-
-
- -
-