This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/pages/users/UserActiveForm.ts
Jens Langhammer e621eb7455 web: cleanup message API, use enum for level
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-03-27 23:11:44 +01:00

68 lines
2.3 KiB
TypeScript

import { gettext } from "django";
import { customElement, html, TemplateResult } from "lit-element";
import { DeleteForm } from "../../elements/forms/DeleteForm";
import { MessageLevel } from "../../elements/messages/Message";
import { showMessage } from "../../elements/messages/MessageContainer";
@customElement("ak-user-active-form")
export class UserActiveForm extends DeleteForm {
onSuccess(): void {
showMessage({
message: gettext(`Successfully updated ${this.objectLabel} ${this.obj?.name}`),
level: MessageLevel.success,
});
}
onError(e: Error): void {
showMessage({
message: gettext(`Failed to update ${this.objectLabel}: ${e.toString()}`),
level: MessageLevel.error,
});
}
renderModalInner(): TemplateResult {
return html`<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1 class="pf-c-title pf-m-2xl">
${gettext(`Update ${this.objectLabel}`)}
</h1>
</div>
</section>
<section class="pf-c-page__main-section">
<div class="pf-l-stack">
<div class="pf-l-stack__item">
<div class="pf-c-card">
<div class="pf-c-card__body">
<form class="pf-c-form pf-m-horizontal">
<p>
${gettext(
`Are you sure you want to update ${this.objectLabel} '${this.obj?.name}'?`
)}
</p>
</form>
</div>
</div>
</div>
</div>
</section>
<footer class="pf-c-modal-box__footer">
<ak-spinner-button
.callAction=${() => {
this.confirm();
}}
class="pf-m-warning">
${gettext("Update")}
</ak-spinner-button>&nbsp;
<ak-spinner-button
.callAction=${() => {
this.open = false;
}}
class="pf-m-secondary">
${gettext("Cancel")}
</ak-spinner-button>
</footer>`;
}
}