web: expressing success (#7830)
* web: expressing success Ever see an idiom that just, I dunno, *annoyed* you? Automated tools for the win. * web: repetition, repetition, repetition! [throws chair] * web: giving the de-duplication treatment to policy mappings. * Created a BaseStageForm with success message and canonical primary key type for for Providers, Sources, and Stages.
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
@ -12,7 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||
import { PasswordPolicy, PoliciesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-password-form")
|
||||
export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
|
||||
export class PasswordPolicyForm extends BasePolicyForm<PasswordPolicy> {
|
||||
@state()
|
||||
showStatic = true;
|
||||
|
||||
@ -32,14 +32,6 @@ export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
|
||||
return policy;
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: PasswordPolicy): Promise<PasswordPolicy> {
|
||||
if (this.instance) {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({
|
||||
|
||||
Reference in New Issue
Block a user