Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
web: Prepare label helpers.
  • Loading branch information
GirlBossRush committed Nov 19, 2025
commit ac9b1aa5f50e639c860a1e3f4be588be7dfa5ad9
5 changes: 2 additions & 3 deletions web/src/admin/admin-settings/AdminSettingsForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ export class AdminSettingsForm extends Form<SettingsRequest> {
@property({ attribute: false })
public settings!: Settings;

getSuccessMessage(): string {
return msg("Successfully updated settings.");
}
protected override readonly actionName = "save";
protected override entityLabel = msg("settings");

async send(settingsRequest: SettingsRequest): Promise<Settings> {
const result = await new AdminApi(DEFAULT_CONFIG).adminSettingsUpdate({
Expand Down
6 changes: 3 additions & 3 deletions web/src/admin/applications/ApplicationCheckAccessForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export class ApplicationCheckAccessForm extends Form<{ forUser: number }> {
@property({ attribute: false })
request?: number;

getSuccessMessage(): string {
return msg("Successfully sent test-request.");
}
protected override readonly actionName = "send";

protected override entityLabel = msg("test-request");

async send(data: { forUser: number }): Promise<PolicyTestResult> {
this.request = data.forUser;
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/applications/ApplicationForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ export class ApplicationForm extends WithCapabilitiesConfig(ModelForm<Applicatio
@property({ type: Boolean })
public clearIcon = false;

protected override getSuccessMessage(): string {
return this.instance
? msg("Successfully updated application.")
: msg("Successfully created application.");
}
protected override entityLabel = msg("application");

public override async send(applicationRequest: Application): Promise<Application | void> {
applicationRequest.backchannelProviders = this.backchannelProviders.map((p) => p.pk);
Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/applications/ApplicationListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export class ApplicationListPage extends WithBrandConfig(TablePage<Application>)
renderToolbar(): TemplateResult {
return html` ${super.renderToolbar()}
<ak-forms-confirm
successMessage=${msg("Successfully cleared application cache")}
errorMessage=${msg("Failed to delete application cache")}
success-message=${msg("Successfully cleared application cache")}
error-message=${msg("Failed to delete application cache")}
action=${msg("Clear cache")}
.onConfirm=${() => {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllCacheClearCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ export class ApplicationEntitlementForm extends ModelForm<ApplicationEntitlement
@property()
targetPk?: string;

getSuccessMessage(): string {
if (this.instance?.pbmUuid) {
return msg("Successfully updated entitlement.");
}
return msg("Successfully created entitlement.");
}
protected override entityLabel = msg("entitlement");

static styles: CSSResult[] = [...super.styles, PFContent];

Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/blueprints/BlueprintForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
return inst;
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated instance.")
: msg("Successfully created instance.");
}
protected override entityLabel = msg("instance");

static styles: CSSResult[] = [...super.styles, PFContent];

Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/brands/BrandForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export class BrandForm extends ModelForm<Brand, string> {
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated brand.")
: msg("Successfully created brand.");
}
protected override entityLabel = msg("brand");

async send(data: Brand): Promise<Brand> {
data.attributes ??= {};
Expand Down
5 changes: 2 additions & 3 deletions web/src/admin/crypto/CertificateGenerateForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import { customElement } from "lit/decorators.js";

@customElement("ak-crypto-certificate-generate-form")
export class CertificateKeyPairForm extends Form<CertificateGenerationRequest> {
getSuccessMessage(): string {
return msg("Successfully generated certificate-key pair.");
}
protected override readonly actionName = "generate";
protected override entityLabel = msg("certificate-key pair");

async send(data: CertificateGenerationRequest): Promise<CertificateKeyPair> {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsGenerateCreate({
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/crypto/CertificateKeyPairForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated certificate-key pair.")
: msg("Successfully created certificate-key pair.");
}
protected override entityLabel = msg("certificate-key pair");

async send(data: CertificateKeyPair): Promise<CertificateKeyPair> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/enterprise/EnterpriseLicenseForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ export class EnterpriseLicenseForm extends ModelForm<License, string> {
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated license.")
: msg("Successfully created license.");
}
protected override entityLabel = msg("license");

async load(): Promise<void> {
this.installID = (
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/events/RuleForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated rule.")
: msg("Successfully created rule.");
}
protected override entityLabel = msg("rule");

async send(data: NotificationRule): Promise<NotificationRule> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/events/TransportForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
@property({ type: Boolean })
showEmail = false;

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated transport.")
: msg("Successfully created transport.");
}
protected override entityLabel = msg("transport");

async send(data: NotificationTransport): Promise<NotificationTransport> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/flows/FlowForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
return flow;
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated flow.")
: msg("Successfully created flow.");
}
protected override entityLabel = msg("flow");

@property({ type: Boolean })
clearBackground = false;
Expand Down
6 changes: 3 additions & 3 deletions web/src/admin/flows/FlowImportForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export class FlowImportForm extends Form<Flow> {
@state()
result?: FlowImportResult;

getSuccessMessage(): string {
return msg("Successfully imported flow.");
}
protected override readonly actionName = "$import";

protected override entityLabel = msg("flow");

static styles: CSSResult[] = [...super.styles, PFDescriptionList];

Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/flows/FlowListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export class FlowListPage extends TablePage<Flow> {
return html`
${super.renderToolbar()}
<ak-forms-confirm
successMessage=${msg("Successfully cleared flow cache")}
errorMessage=${msg("Failed to delete flow cache")}
success-message=${msg("Successfully cleared flow cache")}
error-message=${msg("Failed to delete flow cache")}
action=${msg("Clear cache")}
.onConfirm=${() => {
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesCacheClearCreate();
Expand Down
7 changes: 1 addition & 6 deletions web/src/admin/flows/StageBindingForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ export class StageBindingForm extends ModelForm<FlowStageBinding, string> {
@state()
defaultOrder = 0;

getSuccessMessage(): string {
if (this.instance?.pk) {
return msg("Successfully updated binding.");
}
return msg("Successfully created binding.");
}
protected override entityLabel = msg("binding");

send(data: FlowStageBinding): Promise<unknown> {
if (this.instance?.pk) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/groups/GroupForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ export class GroupForm extends ModelForm<Group, string> {
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated group.")
: msg("Successfully created group.");
}
protected override entityLabel = msg("group");

async send(data: Group): Promise<Group> {
data.attributes ??= {};
Expand Down
6 changes: 5 additions & 1 deletion web/src/admin/groups/GroupListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "#elements/forms/ModalForm";
import "@patternfly/elements/pf-tooltip/pf-tooltip.js";

import { DEFAULT_CONFIG } from "#common/api/config";
import { EntityLabel } from "#common/i18n/nouns";

import { PaginatedResponse, TableColumn } from "#elements/table/Table";
import { TablePage } from "#elements/table/TablePage";
Expand All @@ -22,8 +23,11 @@ export class GroupListPage extends TablePage<Group> {
checkbox = true;
clearOnRefresh = true;
protected override searchEnabled = true;
protected override entityLabel: EntityLabel = {
singular: msg("group"),
plural: msg("groups"),
};
public searchPlaceholder = msg("Search for a group by name…");
public searchLabel = msg("Group Search");
public pageTitle = msg("Groups");
public pageDescription = msg(
"Group users together and give them permissions based on the membership.",
Expand Down
7 changes: 6 additions & 1 deletion web/src/admin/groups/MemberSelectModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "#components/ak-status-label";
import "#elements/buttons/SpinnerButton/index";

import { DEFAULT_CONFIG } from "#common/api/config";
import { EntityLabel } from "#common/i18n/nouns";

import { PaginatedResponse, TableColumn, Timestamp } from "#elements/table/Table";
import { TableModal } from "#elements/table/TableModal";
Expand All @@ -22,8 +23,12 @@ type UserListRequestFilter = Partial<Pick<CoreUsersListRequest, "isActive">>;

@customElement("ak-group-member-select-table")
export class MemberSelectTable extends TableModal<User> {
protected override entityLabel: EntityLabel = {
singular: msg("user"),
plural: msg("users"),
};

public override searchPlaceholder = msg("Search for users by username or display name...");
public override searchLabel = msg("Search Users");
public override label = msg("Select Users");
static styles = [
...super.styles,
Expand Down
6 changes: 3 additions & 3 deletions web/src/admin/groups/RelatedGroupList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export class RelatedGroupAdd extends Form<{ groups: string[] }> {
@state()
groupsToAdd: Group[] = [];

getSuccessMessage(): string {
return msg("Successfully added user to group(s).");
}
protected override readonly actionName = "add";

protected override entityLabel = msg("user to group(s)");

async send(data: { groups: string[] }): Promise<unknown> {
await Promise.all(
Expand Down
7 changes: 3 additions & 4 deletions web/src/admin/groups/RelatedUserList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export class RelatedUserAdd extends Form<{ users: number[] }> {
@state()
usersToAdd: User[] = [];

getSuccessMessage(): string {
return msg("Successfully added user(s).");
}
protected override readonly actionName = "add";

protected override entityLabel = msg("user(s)");

async send(data: { users: number[] }): Promise<{ users: number[] }> {
await Promise.all(
Expand Down Expand Up @@ -124,7 +124,6 @@ export class RelatedUserAdd extends Form<{ users: number[] }> {
@customElement("ak-user-related-list")
export class RelatedUserList extends WithBrandConfig(WithCapabilitiesConfig(Table<User>)) {
public override searchPlaceholder = msg("Search for users by username or display name...");
public override searchLabel = msg("Group User Search");
public override label = msg("Group Users");

expandable = true;
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/outposts/OutpostForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
this.providers = providerProvider(this.type);
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated outpost.")
: msg("Successfully created outpost.");
}
protected override entityLabel = msg("outpost");

async send(data: Outpost): Promise<Outpost> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/outposts/ServiceConnectionDockerForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated integration.")
: msg("Successfully created integration.");
}
protected override entityLabel = msg("integration");

async send(data: DockerServiceConnection): Promise<DockerServiceConnection> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/outposts/ServiceConnectionKubernetesForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
});
}

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated integration.")
: msg("Successfully created integration.");
}
protected override entityLabel = msg("integration");

async send(data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> {
if (this.instance) {
Expand Down
6 changes: 1 addition & 5 deletions web/src/admin/policies/BasePolicyForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ import { ModelForm } from "#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.");
}
protected override entityLabel = msg("policy");
}
7 changes: 1 addition & 6 deletions web/src/admin/policies/PolicyBindingForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ export class PolicyBindingForm extends ModelForm<PolicyBinding, string> {
@state()
defaultOrder = 0;

getSuccessMessage(): string {
if (this.instance?.pk) {
return msg("Successfully updated binding.");
}
return msg("Successfully created binding.");
}
protected override entityLabel = msg("policy binding");

static styles: CSSResult[] = [...super.styles, PFContent];

Expand Down
4 changes: 2 additions & 2 deletions web/src/admin/policies/PolicyListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export class PolicyListPage extends TablePage<Policy> {
renderToolbar(): TemplateResult {
return html` ${super.renderToolbar()}
<ak-forms-confirm
successMessage=${msg("Successfully cleared policy cache")}
errorMessage=${msg("Failed to delete policy cache")}
success-message=${msg("Successfully cleared policy cache")}
error-message=${msg("Failed to delete policy cache")}
action=${msg("Clear cache")}
.onConfirm=${() => {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllCacheClearCreate();
Expand Down
6 changes: 3 additions & 3 deletions web/src/admin/policies/PolicyTestForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export class PolicyTestForm extends Form<PolicyTestRequest> {
@property({ attribute: false })
request?: PolicyTestRequest;

getSuccessMessage(): string {
return msg("Successfully sent test-request.");
}
protected override readonly actionName = "send";

protected override entityLabel = msg("test-request");

async send(data: PolicyTestRequest): Promise<PolicyTestResult> {
this.request = data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ export abstract class BasePropertyMappingForm<T extends PropertyMapping> extends
> {
protected docLink: string | URL = "/add-secure-apps/providers/property-mappings/expression";

getSuccessMessage(): string {
return this.instance
? msg("Successfully updated mapping.")
: msg("Successfully created mapping.");
}
protected override entityLabel = msg("mapping");

renderExtraFields(): SlottedTemplateResult {
return nothing;
Expand Down
Loading