diff --git a/web/src/pages/crypto/CertificateKeyPairForm.ts b/web/src/pages/crypto/CertificateKeyPairForm.ts index fa2b36980..e466c268d 100644 --- a/web/src/pages/crypto/CertificateKeyPairForm.ts +++ b/web/src/pages/crypto/CertificateKeyPairForm.ts @@ -7,15 +7,19 @@ import { Form } from "../../elements/forms/Form"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import "../../elements/CodeMirror"; +import { ModelForm } from "../../elements/forms/ModelForm"; @customElement("ak-crypto-certificate-form") -export class CertificateKeyPairForm extends Form { +export class CertificateKeyPairForm extends ModelForm { - @property({attribute: false}) - keyPair?: CertificateKeyPair; + loadInstance(pk: string): Promise { + return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsRead({ + kpUuid: pk, + }); + } getSuccessMessage(): string { - if (this.keyPair) { + if (this.instance) { return t`Successfully updated certificate-key pair.`; } else { return t`Successfully created certificate-key pair.`; @@ -23,9 +27,9 @@ export class CertificateKeyPairForm extends Form { } send = (data: CertificateKeyPair): Promise => { - if (this.keyPair) { + if (this.instance) { return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsPartialUpdate({ - kpUuid: this.keyPair.pk || "", + kpUuid: this.instance.pk || "", data: data }); } else { @@ -41,21 +45,21 @@ export class CertificateKeyPairForm extends Form { label=${t`Name`} name="name" ?required=${true}> - + - +

${t`PEM-encoded Certificate data.`}

- +

${t`Optional Private Key. If this is set, you can use this keypair for encryption.`}

`; diff --git a/web/src/pages/crypto/CertificateKeyPairListPage.ts b/web/src/pages/crypto/CertificateKeyPairListPage.ts index 5add00041..06e39bdac 100644 --- a/web/src/pages/crypto/CertificateKeyPairListPage.ts +++ b/web/src/pages/crypto/CertificateKeyPairListPage.ts @@ -70,7 +70,7 @@ export class CertificateKeyPairListPage extends TablePage { ${t`Update Certificate-Key Pair`} - +