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:
parent
f1b6793145
commit
b181c551a5
|
@ -75,11 +75,9 @@ export class ApplicationForm extends ModelForm<Application, string> {
|
|||
clearIcon = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated application.");
|
||||
} else {
|
||||
return msg("Successfully created application.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated application.")
|
||||
: msg("Successfully created application.");
|
||||
}
|
||||
|
||||
async send(data: Application): Promise<Application | void> {
|
||||
|
|
|
@ -44,11 +44,9 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated instance.");
|
||||
} else {
|
||||
return msg("Successfully created instance.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated instance.")
|
||||
: msg("Successfully created instance.");
|
||||
}
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
|
|
|
@ -19,11 +19,9 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated certificate-key pair.");
|
||||
} else {
|
||||
return msg("Successfully created certificate-key pair.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated certificate-key pair.")
|
||||
: msg("Successfully created certificate-key pair.");
|
||||
}
|
||||
|
||||
async send(data: CertificateKeyPair): Promise<CertificateKeyPair> {
|
||||
|
|
|
@ -37,11 +37,9 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated rule.");
|
||||
} else {
|
||||
return msg("Successfully created rule.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated rule.")
|
||||
: msg("Successfully created rule.");
|
||||
}
|
||||
|
||||
async send(data: NotificationRule): Promise<NotificationRule> {
|
||||
|
|
|
@ -36,11 +36,9 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
|||
showWebhook = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated transport.");
|
||||
} else {
|
||||
return msg("Successfully created transport.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated transport.")
|
||||
: msg("Successfully created transport.");
|
||||
}
|
||||
|
||||
async send(data: NotificationTransport): Promise<NotificationTransport> {
|
||||
|
|
|
@ -34,11 +34,9 @@ export class FlowForm extends ModelForm<Flow, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated flow.");
|
||||
} else {
|
||||
return msg("Successfully created flow.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated flow.")
|
||||
: msg("Successfully created flow.");
|
||||
}
|
||||
|
||||
@property({ type: Boolean })
|
||||
|
|
|
@ -46,11 +46,9 @@ export class GroupForm extends ModelForm<Group, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated group.");
|
||||
} else {
|
||||
return msg("Successfully created group.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated group.")
|
||||
: msg("Successfully created group.");
|
||||
}
|
||||
|
||||
async load(): Promise<void> {
|
||||
|
|
|
@ -79,11 +79,9 @@ export class OutpostForm extends ModelForm<Outpost, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated outpost.");
|
||||
} else {
|
||||
return msg("Successfully created outpost.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated outpost.")
|
||||
: msg("Successfully created outpost.");
|
||||
}
|
||||
|
||||
async send(data: Outpost): Promise<Outpost> {
|
||||
|
|
|
@ -21,11 +21,9 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated integration.");
|
||||
} else {
|
||||
return msg("Successfully created integration.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated integration.")
|
||||
: msg("Successfully created integration.");
|
||||
}
|
||||
|
||||
async send(data: DockerServiceConnection): Promise<DockerServiceConnection> {
|
||||
|
|
|
@ -25,11 +25,9 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated integration.");
|
||||
} else {
|
||||
return msg("Successfully created integration.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated integration.")
|
||||
: msg("Successfully created integration.");
|
||||
}
|
||||
|
||||
async send(data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> {
|
||||
|
|
11
web/src/admin/policies/BasePolicyForm.ts
Normal file
11
web/src/admin/policies/BasePolicyForm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
export abstract class BasePolicyForm<T> extends ModelForm<T, string> {
|
||||
getSuccessMessage(): string {
|
||||
return this.instance
|
||||
? msg("Successfully updated policy.")
|
||||
: msg("Successfully created policy.");
|
||||
}
|
||||
}
|
|
@ -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,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { DummyPolicy, PoliciesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-dummy-form")
|
||||
export class DummyPolicyForm extends ModelForm<DummyPolicy, string> {
|
||||
export class DummyPolicyForm extends BasePolicyForm<DummyPolicy> {
|
||||
loadInstance(pk: string): Promise<DummyPolicy> {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyRetrieve({
|
||||
policyUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: DummyPolicy): Promise<DummyPolicy> {
|
||||
if (this.instance) {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({
|
||||
|
|
|
@ -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 "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -20,21 +20,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-event-matcher-form")
|
||||
export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string> {
|
||||
export class EventMatcherPolicyForm extends BasePolicyForm<EventMatcherPolicy> {
|
||||
loadInstance(pk: string): Promise<EventMatcherPolicy> {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherRetrieve({
|
||||
policyUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: EventMatcherPolicy): Promise<EventMatcherPolicy> {
|
||||
if (data.action?.toString() === "") data.action = null;
|
||||
if (data.clientIp?.toString() === "") data.clientIp = null;
|
||||
|
|
|
@ -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,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { PasswordExpiryPolicy, PoliciesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-password-expiry-form")
|
||||
export class PasswordExpiryPolicyForm extends ModelForm<PasswordExpiryPolicy, string> {
|
||||
export class PasswordExpiryPolicyForm extends BasePolicyForm<PasswordExpiryPolicy> {
|
||||
loadInstance(pk: string): Promise<PasswordExpiryPolicy> {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryRetrieve({
|
||||
policyUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: PasswordExpiryPolicy): Promise<PasswordExpiryPolicy> {
|
||||
if (this.instance) {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { docLink } from "@goauthentik/common/global";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
|
@ -5,7 +6,6 @@ import "@goauthentik/elements/CodeMirror";
|
|||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
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";
|
||||
|
@ -15,21 +15,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { ExpressionPolicy, PoliciesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-expression-form")
|
||||
export class ExpressionPolicyForm extends ModelForm<ExpressionPolicy, string> {
|
||||
export class ExpressionPolicyForm extends BasePolicyForm<ExpressionPolicy> {
|
||||
loadInstance(pk: string): Promise<ExpressionPolicy> {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionRetrieve({
|
||||
policyUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: ExpressionPolicy): Promise<ExpressionPolicy> {
|
||||
if (this.instance) {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { PoliciesApi, ReputationPolicy } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-policy-reputation-form")
|
||||
export class ReputationPolicyForm extends ModelForm<ReputationPolicy, string> {
|
||||
export class ReputationPolicyForm extends BasePolicyForm<ReputationPolicy> {
|
||||
loadInstance(pk: string): Promise<ReputationPolicy> {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationRetrieve({
|
||||
policyUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated policy.");
|
||||
} else {
|
||||
return msg("Successfully created policy.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: ReputationPolicy): Promise<ReputationPolicy> {
|
||||
if (this.instance) {
|
||||
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({
|
||||
|
|
11
web/src/admin/property-mappings/BasePropertyMappingForm.ts
Normal file
11
web/src/admin/property-mappings/BasePropertyMappingForm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
export abstract class BasePropertyMappingForm<T> extends ModelForm<T, string> {
|
||||
getSuccessMessage(): string {
|
||||
return this.instance
|
||||
? msg("Successfully updated mapping.")
|
||||
: msg("Successfully created mapping.");
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { docLink } from "@goauthentik/common/global";
|
||||
import "@goauthentik/elements/CodeMirror";
|
||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { LDAPPropertyMapping, PropertymappingsApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-property-mapping-ldap-form")
|
||||
export class PropertyMappingLDAPForm extends ModelForm<LDAPPropertyMapping, string> {
|
||||
export class PropertyMappingLDAPForm extends BasePropertyMappingForm<LDAPPropertyMapping> {
|
||||
loadInstance(pk: string): Promise<LDAPPropertyMapping> {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapRetrieve({
|
||||
pmUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated mapping.");
|
||||
} else {
|
||||
return msg("Successfully created mapping.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: LDAPPropertyMapping): Promise<LDAPPropertyMapping> {
|
||||
if (this.instance) {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({
|
||||
|
|
|
@ -21,11 +21,9 @@ export class PropertyMappingNotification extends ModelForm<NotificationWebhookMa
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated mapping.");
|
||||
} else {
|
||||
return msg("Successfully created mapping.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated mapping.")
|
||||
: msg("Successfully created mapping.");
|
||||
}
|
||||
|
||||
async send(data: NotificationWebhookMapping): Promise<NotificationWebhookMapping> {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { docLink } from "@goauthentik/common/global";
|
||||
import "@goauthentik/elements/CodeMirror";
|
||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { PropertymappingsApi, SAMLPropertyMapping } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-property-mapping-saml-form")
|
||||
export class PropertyMappingSAMLForm extends ModelForm<SAMLPropertyMapping, string> {
|
||||
export class PropertyMappingSAMLForm extends BasePropertyMappingForm<SAMLPropertyMapping> {
|
||||
loadInstance(pk: string): Promise<SAMLPropertyMapping> {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlRetrieve({
|
||||
pmUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated mapping.");
|
||||
} else {
|
||||
return msg("Successfully created mapping.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: SAMLPropertyMapping): Promise<SAMLPropertyMapping> {
|
||||
if (this.instance) {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { docLink } from "@goauthentik/common/global";
|
||||
import "@goauthentik/elements/CodeMirror";
|
||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { PropertymappingsApi, SCIMMapping } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-property-mapping-scim-form")
|
||||
export class PropertyMappingSCIMForm extends ModelForm<SCIMMapping, string> {
|
||||
export class PropertyMappingSCIMForm extends BasePropertyMappingForm<SCIMMapping> {
|
||||
loadInstance(pk: string): Promise<SCIMMapping> {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimRetrieve({
|
||||
pmUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated mapping.");
|
||||
} else {
|
||||
return msg("Successfully created mapping.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: SCIMMapping): Promise<SCIMMapping> {
|
||||
if (this.instance) {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { docLink } from "@goauthentik/common/global";
|
||||
import "@goauthentik/elements/CodeMirror";
|
||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { PropertymappingsApi, ScopeMapping } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-property-mapping-scope-form")
|
||||
export class PropertyMappingScopeForm extends ModelForm<ScopeMapping, string> {
|
||||
export class PropertyMappingScopeForm extends BasePropertyMappingForm<ScopeMapping> {
|
||||
loadInstance(pk: string): Promise<ScopeMapping> {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeRetrieve({
|
||||
pmUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated mapping.");
|
||||
} else {
|
||||
return msg("Successfully created mapping.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: ScopeMapping): Promise<ScopeMapping> {
|
||||
if (this.instance) {
|
||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({
|
||||
|
|
11
web/src/admin/providers/BaseProviderForm.ts
Normal file
11
web/src/admin/providers/BaseProviderForm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
export abstract class BaseProviderForm<T> extends ModelForm<T, number> {
|
||||
getSuccessMessage(): string {
|
||||
return this.instance
|
||||
? msg("Successfully updated provider.")
|
||||
: msg("Successfully created provider.");
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search";
|
||||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import { rootInterface } from "@goauthentik/elements/Base";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
|
@ -25,21 +25,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-provider-ldap-form")
|
||||
export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
|
||||
export class LDAPProviderFormPage extends BaseProviderForm<LDAPProvider> {
|
||||
async loadInstance(pk: number): Promise<LDAPProvider> {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({
|
||||
id: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: LDAPProvider): Promise<LDAPProvider> {
|
||||
if (this.instance) {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/components/ak-radio-input";
|
||||
|
@ -7,7 +8,6 @@ import "@goauthentik/components/ak-text-input";
|
|||
import "@goauthentik/components/ak-textarea-input";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
@ -116,7 +116,7 @@ export const redirectUriHelp = html`${redirectUriHelpMessages.map(
|
|||
*/
|
||||
|
||||
@customElement("ak-provider-oauth2-form")
|
||||
export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
|
||||
export class OAuth2ProviderFormPage extends BaseProviderForm<OAuth2Provider> {
|
||||
propertyMappings?: PaginatedScopeMappingList;
|
||||
oauthSources?: PaginatedOAuthSourceList;
|
||||
|
||||
|
@ -143,14 +143,6 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
|
|||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: OAuth2Provider): Promise<OAuth2Provider> {
|
||||
if (this.instance) {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/components/ak-toggle-group";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
|
@ -30,7 +30,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-provider-proxy-form")
|
||||
export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
|
||||
export class ProxyProviderFormPage extends BaseProviderForm<ProxyProvider> {
|
||||
static get styles(): CSSResult[] {
|
||||
return [...super.styles, PFContent, PFList, PFSpacing];
|
||||
}
|
||||
|
@ -65,14 +65,6 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
|
|||
@state()
|
||||
mode: ProxyMode = ProxyMode.Proxy;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: ProxyProvider): Promise<ProxyProvider> {
|
||||
data.mode = this.mode;
|
||||
if (this.mode !== ProxyMode.ForwardDomain) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
||||
import { rootInterface } from "@goauthentik/elements/Base";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -14,21 +14,13 @@ import { customElement } from "lit/decorators.js";
|
|||
import { FlowsInstancesListDesignationEnum, ProvidersApi, RadiusProvider } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-provider-radius-form")
|
||||
export class RadiusProviderFormPage extends ModelForm<RadiusProvider, number> {
|
||||
export class RadiusProviderFormPage extends BaseProviderForm<RadiusProvider> {
|
||||
loadInstance(pk: number): Promise<RadiusProvider> {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusRetrieve({
|
||||
id: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: RadiusProvider): Promise<RadiusProvider> {
|
||||
if (this.instance) {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
@ -27,7 +27,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-provider-saml-form")
|
||||
export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
||||
export class SAMLProviderFormPage extends BaseProviderForm<SAMLProvider> {
|
||||
loadInstance(pk: number): Promise<SAMLProvider> {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersSamlRetrieve({
|
||||
id: pk,
|
||||
|
@ -44,14 +44,6 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
|||
|
||||
propertyMappings?: PaginatedSAMLPropertyMappingList;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: SAMLProvider): Promise<SAMLProvider> {
|
||||
if (this.instance) {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||
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 "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
|
@ -22,7 +22,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-provider-scim-form")
|
||||
export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
|
||||
export class SCIMProviderFormPage extends BaseProviderForm<SCIMProvider> {
|
||||
loadInstance(pk: number): Promise<SCIMProvider> {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersScimRetrieve({
|
||||
id: pk,
|
||||
|
@ -39,14 +39,6 @@ export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
|
|||
|
||||
propertyMappings?: PaginatedSCIMMappingList;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated provider.");
|
||||
} else {
|
||||
return msg("Successfully created provider.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: SCIMProvider): Promise<SCIMProvider> {
|
||||
if (this.instance) {
|
||||
return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({
|
||||
|
|
|
@ -21,11 +21,9 @@ export class RoleForm extends ModelForm<Role, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated role.");
|
||||
} else {
|
||||
return msg("Successfully created role.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated role.")
|
||||
: msg("Successfully created role.");
|
||||
}
|
||||
|
||||
async send(data: Role): Promise<Role> {
|
||||
|
|
11
web/src/admin/sources/BaseSourceForm.ts
Normal file
11
web/src/admin/sources/BaseSourceForm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
export abstract class BaseSourceForm<T> extends ModelForm<T, string> {
|
||||
getSuccessMessage(): string {
|
||||
return this.instance
|
||||
? msg("Successfully updated source.")
|
||||
: msg("Successfully created source.");
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import { placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||
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 "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -24,7 +24,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-ldap-form")
|
||||
export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||
export class LDAPSourceForm extends BaseSourceForm<LDAPSource> {
|
||||
loadInstance(pk: string): Promise<LDAPSource> {
|
||||
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapRetrieve({
|
||||
slug: pk,
|
||||
|
@ -41,14 +41,6 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
|||
|
||||
propertyMappings?: PaginatedLDAPPropertyMappingList;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: LDAPSource): Promise<LDAPSource> {
|
||||
if (this.instance) {
|
||||
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
|
@ -8,7 +9,6 @@ import "@goauthentik/elements/CodeMirror";
|
|||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -28,7 +28,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-oauth-form")
|
||||
export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||
export class OAuthSourceForm extends BaseSourceForm<OAuthSource> {
|
||||
async loadInstance(pk: string): Promise<OAuthSource> {
|
||||
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesOauthRetrieve({
|
||||
slug: pk,
|
||||
|
@ -61,14 +61,6 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
|||
@state()
|
||||
clearIcon = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: OAuthSource): Promise<OAuthSource> {
|
||||
data.providerType = (this.providerType?.slug || "") as ProviderTypeEnum;
|
||||
let source: OAuthSource;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
||||
|
@ -7,7 +8,6 @@ import { ascii_letters, digits, first, randomString } from "@goauthentik/common/
|
|||
import { rootInterface } from "@goauthentik/elements/Base";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -24,7 +24,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-plex-form")
|
||||
export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||
export class PlexSourceForm extends BaseSourceForm<PlexSource> {
|
||||
async loadInstance(pk: string): Promise<PlexSource> {
|
||||
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesPlexRetrieve({
|
||||
slug: pk,
|
||||
|
@ -50,14 +50,6 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
|||
} as PlexSource;
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: PlexSource): Promise<PlexSource> {
|
||||
data.plexToken = this.plexToken || "";
|
||||
let source: PlexSource;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import { rootInterface } from "@goauthentik/elements/Base";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
|
@ -29,7 +29,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-source-saml-form")
|
||||
export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||
export class SAMLSourceForm extends BaseSourceForm<SAMLSource> {
|
||||
@state()
|
||||
clearIcon = false;
|
||||
|
||||
|
@ -41,14 +41,6 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
|||
return source;
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated source.");
|
||||
} else {
|
||||
return msg("Successfully created source.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: SAMLSource): Promise<SAMLSource> {
|
||||
let source: SAMLSource;
|
||||
if (this.instance) {
|
||||
|
|
11
web/src/admin/stages/BaseStageForm.ts
Normal file
11
web/src/admin/stages/BaseStageForm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
||||
export abstract class BaseStageForm<T> extends ModelForm<T, string> {
|
||||
getSuccessMessage(): string {
|
||||
return this.instance
|
||||
? msg("Successfully updated stage.")
|
||||
: msg("Successfully created stage.");
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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 "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -21,21 +21,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-duo-form")
|
||||
export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage, string> {
|
||||
export class AuthenticatorDuoStageForm extends BaseStageForm<AuthenticatorDuoStage> {
|
||||
loadInstance(pk: string): Promise<AuthenticatorDuoStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticatorDuoStage): Promise<AuthenticatorDuoStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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 "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
|
@ -26,7 +26,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-sms-form")
|
||||
export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage, string> {
|
||||
export class AuthenticatorSMSStageForm extends BaseStageForm<AuthenticatorSMSStage> {
|
||||
loadInstance(pk: string): Promise<AuthenticatorSMSStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG)
|
||||
.stagesAuthenticatorSmsRetrieve({
|
||||
|
@ -45,14 +45,6 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
|
|||
@property({ attribute: false })
|
||||
authType?: AuthTypeEnum;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticatorSMSStage): Promise<AuthenticatorSMSStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -19,21 +19,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-static-form")
|
||||
export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticStage, string> {
|
||||
export class AuthenticatorStaticStageForm extends BaseStageForm<AuthenticatorStaticStage> {
|
||||
loadInstance(pk: string): Promise<AuthenticatorStaticStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticatorStaticStage): Promise<AuthenticatorStaticStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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 "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -21,21 +21,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-totp-form")
|
||||
export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage, string> {
|
||||
export class AuthenticatorTOTPStageForm extends BaseStageForm<AuthenticatorTOTPStage> {
|
||||
loadInstance(pk: string): Promise<AuthenticatorTOTPStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticatorTOTPStage): Promise<AuthenticatorTOTPStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
|
@ -20,7 +20,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-validate-form")
|
||||
export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValidateStage, string> {
|
||||
export class AuthenticatorValidateStageForm extends BaseStageForm<AuthenticatorValidateStage> {
|
||||
async loadInstance(pk: string): Promise<AuthenticatorValidateStage> {
|
||||
const stage = await new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateRetrieve({
|
||||
stageUuid: pk,
|
||||
|
@ -41,14 +41,6 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
|
|||
@property({ type: Boolean })
|
||||
showConfigurationStages = true;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticatorValidateStage): Promise<AuthenticatorValidateStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
|
@ -23,21 +23,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-authenticator-webauthn-form")
|
||||
export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuthnStage, string> {
|
||||
export class AuthenticateWebAuthnStageForm extends BaseStageForm<AuthenticateWebAuthnStage> {
|
||||
loadInstance(pk: string): Promise<AuthenticateWebAuthnStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorWebauthnRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: AuthenticateWebAuthnStage): Promise<AuthenticateWebAuthnStage> {
|
||||
if (data.authenticatorAttachment?.toString() === "") {
|
||||
data.authenticatorAttachment = null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
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";
|
||||
|
@ -11,21 +11,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { CaptchaStage, CaptchaStageRequest, StagesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-captcha-form")
|
||||
export class CaptchaStageForm extends ModelForm<CaptchaStage, string> {
|
||||
export class CaptchaStageForm extends BaseStageForm<CaptchaStage> {
|
||||
loadInstance(pk: string): Promise<CaptchaStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: CaptchaStage): Promise<CaptchaStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -12,7 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { ConsentStage, ConsentStageModeEnum, StagesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-consent-form")
|
||||
export class ConsentStageForm extends ModelForm<ConsentStage, string> {
|
||||
export class ConsentStageForm extends BaseStageForm<ConsentStage> {
|
||||
loadInstance(pk: string): Promise<ConsentStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG)
|
||||
.stagesConsentRetrieve({
|
||||
|
@ -27,14 +27,6 @@ export class ConsentStageForm extends ModelForm<ConsentStage, string> {
|
|||
@property({ type: Boolean })
|
||||
showExpiresIn = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: ConsentStage): Promise<ConsentStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { DenyStage, StagesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-deny-form")
|
||||
export class DenyStageForm extends ModelForm<DenyStage, string> {
|
||||
export class DenyStageForm extends BaseStageForm<DenyStage> {
|
||||
loadInstance(pk: string): Promise<DenyStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesDenyRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: DenyStage): Promise<DenyStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -11,21 +11,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { DummyStage, StagesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-dummy-form")
|
||||
export class DummyStageForm extends ModelForm<DummyStage, string> {
|
||||
export class DummyStageForm extends BaseStageForm<DummyStage> {
|
||||
loadInstance(pk: string): Promise<DummyStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesDummyRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: DummyStage): Promise<DummyStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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 { EmailStage, StagesApi, TypeCreate } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-email-form")
|
||||
export class EmailStageForm extends ModelForm<EmailStage, string> {
|
||||
export class EmailStageForm extends BaseStageForm<EmailStage> {
|
||||
async loadInstance(pk: string): Promise<EmailStage> {
|
||||
const stage = await new StagesApi(DEFAULT_CONFIG).stagesEmailRetrieve({
|
||||
stageUuid: pk,
|
||||
|
@ -30,14 +30,6 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
|
|||
@property({ type: Boolean })
|
||||
showConnectionSettings = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: EmailStage): Promise<EmailStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first, groupBy } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -23,7 +23,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-identification-form")
|
||||
export class IdentificationStageForm extends ModelForm<IdentificationStage, string> {
|
||||
export class IdentificationStageForm extends BaseStageForm<IdentificationStage> {
|
||||
loadInstance(pk: string): Promise<IdentificationStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationRetrieve({
|
||||
stageUuid: pk,
|
||||
|
@ -38,14 +38,6 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
|
|||
|
||||
sources?: PaginatedSourceList;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: IdentificationStage): Promise<IdentificationStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({
|
||||
|
|
|
@ -23,11 +23,9 @@ export class InvitationForm extends ModelForm<Invitation, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated invitation.");
|
||||
} else {
|
||||
return msg("Successfully created invitation.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated invitation.")
|
||||
: msg("Successfully created invitation.");
|
||||
}
|
||||
|
||||
async send(data: Invitation): Promise<Invitation> {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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";
|
||||
|
@ -11,21 +11,13 @@ import { customElement } from "lit/decorators.js";
|
|||
import { InvitationStage, StagesApi } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-invitation-form")
|
||||
export class InvitationStageForm extends ModelForm<InvitationStage, string> {
|
||||
export class InvitationStageForm extends BaseStageForm<InvitationStage> {
|
||||
loadInstance(pk: string): Promise<InvitationStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: InvitationStage): Promise<InvitationStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
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 "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -22,21 +22,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-password-form")
|
||||
export class PasswordStageForm extends ModelForm<PasswordStage, string> {
|
||||
export class PasswordStageForm extends BaseStageForm<PasswordStage> {
|
||||
loadInstance(pk: string): Promise<PasswordStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesPasswordRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: PasswordStage): Promise<PasswordStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({
|
||||
|
|
|
@ -90,11 +90,9 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated prompt.");
|
||||
} else {
|
||||
return msg("Successfully created prompt.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated prompt.")
|
||||
: msg("Successfully created prompt.");
|
||||
}
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import "@goauthentik/admin/stages/prompt/PromptForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import "@goauthentik/elements/forms/ModalForm";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -19,7 +19,7 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-prompt-form")
|
||||
export class PromptStageForm extends ModelForm<PromptStage, string> {
|
||||
export class PromptStageForm extends BaseStageForm<PromptStage> {
|
||||
loadInstance(pk: string): Promise<PromptStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesRetrieve({
|
||||
stageUuid: pk,
|
||||
|
@ -38,14 +38,6 @@ export class PromptStageForm extends ModelForm<PromptStage, string> {
|
|||
prompts?: PaginatedPromptList;
|
||||
policies?: PaginatedPolicyList;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: PromptStage): Promise<PromptStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { StagesApi, UserDeleteStage } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-user-delete-form")
|
||||
export class UserDeleteStageForm extends ModelForm<UserDeleteStage, string> {
|
||||
export class UserDeleteStageForm extends BaseStageForm<UserDeleteStage> {
|
||||
loadInstance(pk: string): Promise<UserDeleteStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: UserDeleteStage): Promise<UserDeleteStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import { first } from "@goauthentik/common/utils";
|
||||
import "@goauthentik/elements/Alert";
|
||||
import "@goauthentik/elements/forms/FormGroup";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
|
@ -13,21 +13,13 @@ import { customElement } from "lit/decorators.js";
|
|||
import { StagesApi, UserLoginStage } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-user-login-form")
|
||||
export class UserLoginStageForm extends ModelForm<UserLoginStage, string> {
|
||||
export class UserLoginStageForm extends BaseStageForm<UserLoginStage> {
|
||||
loadInstance(pk: string): Promise<UserLoginStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: UserLoginStage): Promise<UserLoginStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|||
import { StagesApi, UserLogoutStage } from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-user-logout-form")
|
||||
export class UserLogoutStageForm extends ModelForm<UserLogoutStage, string> {
|
||||
export class UserLogoutStageForm extends BaseStageForm<UserLogoutStage> {
|
||||
loadInstance(pk: string): Promise<UserLogoutStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: UserLogoutStage): Promise<UserLogoutStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||
import { UserCreationModeEnum } from "@goauthentik/api/dist/models/UserCreationModeEnum";
|
||||
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 "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
|
@ -22,21 +22,13 @@ import {
|
|||
} from "@goauthentik/api";
|
||||
|
||||
@customElement("ak-stage-user-write-form")
|
||||
export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
|
||||
export class UserWriteStageForm extends BaseStageForm<UserWriteStage> {
|
||||
loadInstance(pk: string): Promise<UserWriteStage> {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteRetrieve({
|
||||
stageUuid: pk,
|
||||
});
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated stage.");
|
||||
} else {
|
||||
return msg("Successfully created stage.");
|
||||
}
|
||||
}
|
||||
|
||||
async send(data: UserWriteStage): Promise<UserWriteStage> {
|
||||
if (this.instance) {
|
||||
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({
|
||||
|
|
|
@ -26,11 +26,9 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated tenant.");
|
||||
} else {
|
||||
return msg("Successfully created tenant.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated tenant.")
|
||||
: msg("Successfully created tenant.");
|
||||
}
|
||||
|
||||
async send(data: Tenant): Promise<Tenant> {
|
||||
|
|
|
@ -26,11 +26,9 @@ export class TokenForm extends ModelForm<Token, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated token.");
|
||||
} else {
|
||||
return msg("Successfully created token.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated token.")
|
||||
: msg("Successfully created token.");
|
||||
}
|
||||
|
||||
async send(data: Token): Promise<Token> {
|
||||
|
|
|
@ -21,11 +21,9 @@ export class UserTokenForm extends ModelForm<Token, string> {
|
|||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return msg("Successfully updated token.");
|
||||
} else {
|
||||
return msg("Successfully created token.");
|
||||
}
|
||||
return this.instance
|
||||
? msg("Successfully updated token.")
|
||||
: msg("Successfully created token.");
|
||||
}
|
||||
|
||||
async send(data: Token): Promise<Token> {
|
||||
|
|
Reference in a new issue