web: implement bulk-delete form

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-12 22:03:13 +02:00
parent 9430a2eea2
commit d1403f6f7d
32 changed files with 365 additions and 367 deletions

View file

@ -4,7 +4,6 @@ import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import { Event, EventsApi } from "authentik-api";
import "../forms/DeleteForm";
import "../Tabs";
import "../buttons/ModalButton";
import "../buttons/SpinnerButton";

View file

@ -4,7 +4,6 @@ import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import { Event, EventsApi } from "authentik-api";
import "../forms/DeleteForm";
import "../Tabs";
import "../buttons/ModalButton";
import "../buttons/SpinnerButton";

View file

@ -12,29 +12,28 @@ import { Table, TableColumn } from "../table/Table";
import { AKResponse } from "../../api/Client";
import { PFSize } from "../Spinner";
export interface AKObject<T extends string | number> {
pk: T;
slug?: string;
name?: string;
[key: string]: unknown;
}
type BulkDeleteMetadata = { key: string; value: string }[];
@customElement("ak-delete-objects-table")
export class DeleteObjectsTable<ObjPkT extends string | number> extends Table<AKObject<ObjPkT>> {
export class DeleteObjectsTable<T> extends Table<T> {
expandable = true;
paginated = false;
@property({ attribute: false })
objects: AKObject<ObjPkT>[] = [];
objects: T[] = [];
@property({ attribute: false })
usedBy?: (item: AKObject<ObjPkT>) => Promise<UsedBy[]>;
metadata!: (item: T) => BulkDeleteMetadata;
@property({ attribute: false })
usedBy?: (item: T) => Promise<UsedBy[]>;
static get styles(): CSSResult[] {
return super.styles.concat(PFList);
}
apiEndpoint(page: number): Promise<AKResponse<AKObject<ObjPkT>>> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
apiEndpoint(page: number): Promise<AKResponse<T>> {
return Promise.resolve({
pagination: {
count: this.objects.length,
@ -48,77 +47,93 @@ export class DeleteObjectsTable<ObjPkT extends string | number> extends Table<AK
}
columns(): TableColumn[] {
return [new TableColumn(t`Name`), new TableColumn(t`ID`)];
return this.metadata(this.objects[0]).map((element) => {
return new TableColumn(element.key);
});
}
row(item: AKObject<ObjPkT>): TemplateResult[] {
return [html`${item.name}`, html`${item.pk}`];
row(item: T): TemplateResult[] {
return this.metadata(item).map((element) => {
return html`${element.value}`;
});
}
renderToolbarContainer(): TemplateResult {
return html``;
}
renderExpanded(item: AKObject<ObjPkT>): TemplateResult {
return html`${this.usedBy
? until(
this.usedBy(item).then((usedBy) => {
return this.renderUsedBy(item, usedBy);
}),
html`<ak-spinner size=${PFSize.XLarge}></ak-spinner>`,
)
: html``}`;
}
renderUsedBy(item: AKObject<ObjPkT>, usedBy: UsedBy[]): TemplateResult {
if (usedBy.length < 1) {
return html`<td role="cell" colspan="2">
<div class="pf-c-table__expandable-row-content">
<span>${t`Not used by any other object.`}</span>
</div>
</td>`;
}
renderExpanded(item: T): TemplateResult {
return html`<td role="cell" colspan="2">
<div class="pf-c-table__expandable-row-content">
<p>${t`The following objects use ${item.name}:`}</p>
<ul class="pf-c-list">
${usedBy.map((ub) => {
let consequence = "";
switch (ub.action) {
case UsedByActionEnum.Cascade:
consequence = t`object will be DELETED`;
break;
case UsedByActionEnum.CascadeMany:
consequence = t`connection will be deleted`;
break;
case UsedByActionEnum.SetDefault:
consequence = t`reference will be reset to default value`;
break;
case UsedByActionEnum.SetNull:
consequence = t`reference will be set to an empty value`;
break;
}
return html`<li>${t`${ub.name} (${consequence})`}</li>`;
})}
</ul>
${this.usedBy
? until(
this.usedBy(item).then((usedBy) => {
return this.renderUsedBy(usedBy);
}),
html`<ak-spinner size=${PFSize.XLarge}></ak-spinner>`,
)
: html``}
</div>
</td> `;
</td>`;
}
renderUsedBy(usedBy: UsedBy[]): TemplateResult {
if (usedBy.length < 1) {
return html` <span>${t`Not used by any other object.`}</span>`;
}
return html`<ul class="pf-c-list">
${usedBy.map((ub) => {
let consequence = "";
switch (ub.action) {
case UsedByActionEnum.Cascade:
consequence = t`object will be DELETED`;
break;
case UsedByActionEnum.CascadeMany:
consequence = t`connection will be deleted`;
break;
case UsedByActionEnum.SetDefault:
consequence = t`reference will be reset to default value`;
break;
case UsedByActionEnum.SetNull:
consequence = t`reference will be set to an empty value`;
break;
}
return html`<li>${t`${ub.name} (${consequence})`}</li>`;
})}
</ul>`;
}
}
@customElement("ak-forms-delete-bulk")
export class DeleteBulkForm<ObjPkT extends string | number> extends ModalButton {
export class DeleteBulkForm extends ModalButton {
@property({ attribute: false })
objects: AKObject<ObjPkT>[] = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
objects: any[] = [];
@property()
objectLabel?: string;
@property({ attribute: false })
usedBy?: (itemPk: AKObject<ObjPkT>) => Promise<UsedBy[]>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
metadata: (item: any) => BulkDeleteMetadata = (item: any) => {
const rec = item as Record<string, unknown>;
const meta = [];
if (Object.prototype.hasOwnProperty.call(rec, "name")) {
meta.push({ key: t`Name`, value: rec.name as string });
}
if (Object.prototype.hasOwnProperty.call(rec, "pk")) {
meta.push({ key: t`ID`, value: rec.pk as string });
}
return meta;
};
@property({ attribute: false })
delete!: (itemPk: AKObject<ObjPkT>) => Promise<unknown>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
usedBy?: (item: any) => Promise<UsedBy[]>;
@property({ attribute: false })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete!: (item: any) => Promise<any>;
confirm(): Promise<void> {
return Promise.all(
@ -170,7 +185,11 @@ export class DeleteBulkForm<ObjPkT extends string | number> extends ModalButton
</form>
</section>
<section class="pf-c-page__main-section">
<ak-delete-objects-table .objects=${this.objects} .usedBy=${this.usedBy}>
<ak-delete-objects-table
.objects=${this.objects}
.usedBy=${this.usedBy}
.metadata=${this.metadata}
>
</ak-delete-objects-table>
</section>
<footer class="pf-c-modal-box__footer">

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import "../forms/DeleteForm";
import "../forms/DeleteBulkForm";
import { PAGE_SIZE } from "../../constants";
import { ExpiringBaseGrantModel, Oauth2Api } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -34,17 +34,16 @@ export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Authorization Code`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Authorization Code(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: ExpiringBaseGrantModel) => {
return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: ExpiringBaseGrantModel) => {
return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesDestroy({
id: item.pk,
});
@ -53,7 +52,7 @@ export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: ExpiringBaseGrantModel): TemplateResult[] {

View file

@ -4,9 +4,9 @@ import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import PFFlex from "@patternfly/patternfly/layouts/Flex/flex.css";
import "../forms/DeleteForm";
import "../forms/DeleteBulkForm";
import { PAGE_SIZE } from "../../constants";
import { RefreshTokenModel, Oauth2Api } from "authentik-api";
import { RefreshTokenModel, Oauth2Api, ExpiringBaseGrantModel } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
@customElement("ak-user-oauth-refresh-list")
@ -57,17 +57,16 @@ export class UserOAuthRefreshList extends Table<RefreshTokenModel> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Refresh Code`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Refresh Code(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: ExpiringBaseGrantModel) => {
return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: ExpiringBaseGrantModel) => {
return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensDestroy({
id: item.pk,
});
@ -76,7 +75,7 @@ export class UserOAuthRefreshList extends Table<RefreshTokenModel> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: RefreshTokenModel): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import "../forms/DeleteForm";
import "../forms/DeleteBulkForm";
import { PAGE_SIZE } from "../../constants";
import { CoreApi, AuthenticatedSession } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -35,26 +35,25 @@ export class AuthenticatedSessionList extends Table<AuthenticatedSession> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Session`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Session(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: AuthenticatedSession) => {
return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsUsedByList({
uuid: item.uuid || "",
});
}}
.delete=${() => {
.delete=${(item: AuthenticatedSession) => {
return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsDestroy({
uuid: item.uuid || "",
});
}}
>
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete Session`}
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: AuthenticatedSession): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../table/Table";
import "../forms/DeleteForm";
import "../forms/DeleteBulkForm";
import { PAGE_SIZE } from "../../constants";
import { CoreApi, UserConsent } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -33,26 +33,25 @@ export class UserConsentList extends Table<UserConsent> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Consent`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Consent(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: UserConsent) => {
return new CoreApi(DEFAULT_CONFIG).coreUserConsentUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: UserConsent) => {
return new CoreApi(DEFAULT_CONFIG).coreUserConsentDestroy({
id: item.pk,
});
}}
>
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete Consent`}
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: UserConsent): TemplateResult[] {

View file

@ -284,7 +284,7 @@ msgstr ""
msgid "Are you sure you want to delete {0} {1}?"
msgstr "Are you sure you want to delete {0} {1}?"
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Are you sure you want to delete {0} {objName} ?"
msgstr "Are you sure you want to delete {0} {objName} ?"
@ -487,7 +487,7 @@ msgstr "Browser"
msgid "Build hash:"
msgstr "Build hash:"
#:
#:
#~ msgid "Build hash: {0}"
#~ msgstr "Build hash: {0}"
@ -518,7 +518,7 @@ msgstr "Can be in the format of 'unix://' when connecting to a local docker daem
#: src/elements/forms/ConfirmationForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/ModalForm.ts
#: src/pages/groups/MemberSelectModal.ts
#: src/pages/users/GroupSelectModal.ts
@ -1091,7 +1091,7 @@ msgid "Define how notifications are sent to users, like Email or Webhook."
msgstr "Define how notifications are sent to users, like Email or Webhook."
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/oauth/UserCodeList.ts
#: src/elements/oauth/UserRefreshList.ts
#: src/pages/applications/ApplicationListPage.ts
@ -1119,7 +1119,7 @@ msgstr "Define how notifications are sent to users, like Email or Webhook."
msgid "Delete"
msgstr "Delete"
#:
#:
#~ msgid "Delete Authorization Code"
#~ msgstr "Delete Authorization Code"
@ -1132,7 +1132,7 @@ msgstr "Delete Binding"
msgid "Delete Consent"
msgstr "Delete Consent"
#:
#:
#~ msgid "Delete Refresh Code"
#~ msgstr "Delete Refresh Code"
@ -1165,7 +1165,7 @@ msgstr ""
"confirmation. Use a consent stage to ensure the user is aware of their actions."
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Delete {0}"
msgstr "Delete {0}"
@ -1230,8 +1230,8 @@ msgstr "Digest algorithm"
msgid "Digits"
msgstr "Digits"
#:
#:
#:
#:
#~ msgid "Disable"
#~ msgstr "Disable"
@ -1382,8 +1382,8 @@ msgstr "Email: Text field with Email type."
msgid "Embedded outpost is not configured correctly."
msgstr "Embedded outpost is not configured correctly."
#:
#:
#:
#:
#~ msgid "Enable"
#~ msgstr "Enable"
@ -1607,7 +1607,7 @@ msgid "Failed to delete policy cache"
msgstr "Failed to delete policy cache"
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Failed to delete {0}: {1}"
msgstr "Failed to delete {0}: {1}"
@ -2702,7 +2702,7 @@ msgstr "Only fail the policy, don't invalidate user's password."
msgid "Only send notification once, for example when sending a webhook into a chat channel."
msgstr "Only send notification once, for example when sending a webhook into a chat channel."
#:
#:
#~ msgid "Open application"
#~ msgstr "Open application"
@ -2779,7 +2779,7 @@ msgstr "Outpost"
msgid "Outpost Deployment Info"
msgstr "Outpost Deployment Info"
#:
#:
#~ msgid "Outpost Service-connection"
#~ msgstr "Outpost Service-connection"
@ -3419,7 +3419,7 @@ msgstr "Select which transports should be used to notify the user. If none are s
msgid "Selected policies are executed when the stage is submitted to validate the data."
msgstr "Selected policies are executed when the stage is submitted to validate the data."
#:
#:
#~ msgid "Selecting a service-connection enables the management of the outpost by authentik."
#~ msgstr "Selecting a service-connection enables the management of the outpost by authentik."
@ -3476,7 +3476,7 @@ msgstr "Server name for which this provider's certificate is valid for."
msgid "Server validation of credential failed: {err}"
msgstr "Server validation of credential failed: {err}"
#:
#:
#~ msgid "Service Connections"
#~ msgstr "Service Connections"
@ -3484,8 +3484,8 @@ msgstr "Server validation of credential failed: {err}"
msgid "Service Provider Binding"
msgstr "Service Provider Binding"
#:
#:
#:
#:
#~ msgid "Service connection"
#~ msgstr "Service connection"
@ -3804,8 +3804,8 @@ msgstr "Successfully created provider."
msgid "Successfully created rule."
msgstr "Successfully created rule."
#:
#:
#:
#:
#~ msgid "Successfully created service-connection."
#~ msgstr "Successfully created service-connection."
@ -3854,7 +3854,7 @@ msgid "Successfully created user."
msgstr "Successfully created user."
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Successfully deleted {0} {1}"
msgstr "Successfully deleted {0} {1}"
@ -3958,8 +3958,8 @@ msgstr "Successfully updated provider."
msgid "Successfully updated rule."
msgstr "Successfully updated rule."
#:
#:
#:
#:
#~ msgid "Successfully updated service-connection."
#~ msgstr "Successfully updated service-connection."
@ -4151,7 +4151,7 @@ msgstr "The external URL you'll authenticate at. Can be the same domain as authe
msgid "The following objects use {0}:"
msgstr "The following objects use {0}:"
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "The following objects use {objName}"
msgstr "The following objects use {objName}"
@ -4396,7 +4396,7 @@ msgstr "Unhealthy outposts"
msgid "Unknown"
msgstr "Unknown"
#:
#:
#~ msgid "Unmanaged"
#~ msgstr "Unmanaged"
@ -4924,7 +4924,7 @@ msgstr "authentik Builtin Database"
msgid "authentik LDAP Backend"
msgstr "authentik LDAP Backend"
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "connecting object will be deleted"
msgstr "connecting object will be deleted"
@ -4937,17 +4937,17 @@ msgid "no tabs defined"
msgstr "no tabs defined"
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "object will be DELETED"
msgstr "object will be DELETED"
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "reference will be reset to default value"
msgstr "reference will be reset to default value"
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "reference will be set to an empty value"
msgstr "reference will be set to an empty value"
@ -4965,7 +4965,7 @@ msgid "{0} ({1})"
msgstr "{0} ({1})"
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "{0} ({consequence})"
msgstr "{0} ({consequence})"

View file

@ -280,7 +280,7 @@ msgstr ""
msgid "Are you sure you want to delete {0} {1}?"
msgstr ""
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Are you sure you want to delete {0} {objName} ?"
msgstr ""
@ -483,7 +483,7 @@ msgstr ""
msgid "Build hash:"
msgstr ""
#:
#:
#~ msgid "Build hash: {0}"
#~ msgstr ""
@ -514,7 +514,7 @@ msgstr ""
#: src/elements/forms/ConfirmationForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/ModalForm.ts
#: src/pages/groups/MemberSelectModal.ts
#: src/pages/users/GroupSelectModal.ts
@ -1085,7 +1085,7 @@ msgid "Define how notifications are sent to users, like Email or Webhook."
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/oauth/UserCodeList.ts
#: src/elements/oauth/UserRefreshList.ts
#: src/pages/applications/ApplicationListPage.ts
@ -1113,7 +1113,7 @@ msgstr ""
msgid "Delete"
msgstr ""
#:
#:
#~ msgid "Delete Authorization Code"
#~ msgstr ""
@ -1126,7 +1126,7 @@ msgstr ""
msgid "Delete Consent"
msgstr ""
#:
#:
#~ msgid "Delete Refresh Code"
#~ msgstr ""
@ -1157,7 +1157,7 @@ msgid ""
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Delete {0}"
msgstr ""
@ -1222,8 +1222,8 @@ msgstr ""
msgid "Digits"
msgstr ""
#:
#:
#:
#:
#~ msgid "Disable"
#~ msgstr ""
@ -1374,8 +1374,8 @@ msgstr ""
msgid "Embedded outpost is not configured correctly."
msgstr ""
#:
#:
#:
#:
#~ msgid "Enable"
#~ msgstr ""
@ -1599,7 +1599,7 @@ msgid "Failed to delete policy cache"
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Failed to delete {0}: {1}"
msgstr ""
@ -2694,7 +2694,7 @@ msgstr ""
msgid "Only send notification once, for example when sending a webhook into a chat channel."
msgstr ""
#:
#:
#~ msgid "Open application"
#~ msgstr ""
@ -2771,7 +2771,7 @@ msgstr ""
msgid "Outpost Deployment Info"
msgstr ""
#:
#:
#~ msgid "Outpost Service-connection"
#~ msgstr ""
@ -3411,7 +3411,7 @@ msgstr ""
msgid "Selected policies are executed when the stage is submitted to validate the data."
msgstr ""
#:
#:
#~ msgid "Selecting a service-connection enables the management of the outpost by authentik."
#~ msgstr ""
@ -3468,7 +3468,7 @@ msgstr ""
msgid "Server validation of credential failed: {err}"
msgstr ""
#:
#:
#~ msgid "Service Connections"
#~ msgstr ""
@ -3476,8 +3476,8 @@ msgstr ""
msgid "Service Provider Binding"
msgstr ""
#:
#:
#:
#:
#~ msgid "Service connection"
#~ msgstr ""
@ -3796,8 +3796,8 @@ msgstr ""
msgid "Successfully created rule."
msgstr ""
#:
#:
#:
#:
#~ msgid "Successfully created service-connection."
#~ msgstr ""
@ -3846,7 +3846,7 @@ msgid "Successfully created user."
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "Successfully deleted {0} {1}"
msgstr ""
@ -3950,8 +3950,8 @@ msgstr ""
msgid "Successfully updated rule."
msgstr ""
#:
#:
#:
#:
#~ msgid "Successfully updated service-connection."
#~ msgstr ""
@ -4143,7 +4143,7 @@ msgstr ""
msgid "The following objects use {0}:"
msgstr ""
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "The following objects use {objName}"
msgstr ""
@ -4381,7 +4381,7 @@ msgstr ""
msgid "Unknown"
msgstr ""
#:
#:
#~ msgid "Unmanaged"
#~ msgstr ""
@ -4907,7 +4907,7 @@ msgstr ""
msgid "authentik LDAP Backend"
msgstr ""
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "connecting object will be deleted"
msgstr ""
@ -4920,17 +4920,17 @@ msgid "no tabs defined"
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "object will be DELETED"
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "reference will be reset to default value"
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "reference will be set to an empty value"
msgstr ""
@ -4948,7 +4948,7 @@ msgid "{0} ({1})"
msgstr ""
#: src/elements/forms/DeleteBulkForm.ts
#: src/elements/forms/DeleteForm.ts
#: src/elements/forms/DeleteBulkForm.ts
msgid "{0} ({consequence})"
msgstr ""

View file

@ -5,7 +5,7 @@ import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage";
import "../../elements/forms/ModalForm";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/buttons/SpinnerButton";
import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
@ -69,17 +69,16 @@ export class ApplicationListPage extends TablePage<Application> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Application`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Application(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Application) => {
return new CoreApi(DEFAULT_CONFIG).coreApplicationsUsedByList({
slug: item.slug,
});
}}
.delete=${() => {
.delete=${(item: Application) => {
return new CoreApi(DEFAULT_CONFIG).coreApplicationsDestroy({
slug: item.slug,
});
@ -88,7 +87,7 @@ export class ApplicationListPage extends TablePage<Application> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Application): TemplateResult[] {

View file

@ -8,7 +8,7 @@ import { CryptoApi, CertificateKeyPair } from "authentik-api";
import "../../elements/forms/ModalForm";
import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "./CertificateKeyPairForm";
import "./CertificateGenerateForm";
import { TableColumn } from "../../elements/table/Table";
@ -59,17 +59,22 @@ export class CertificateKeyPairListPage extends TablePage<CertificateKeyPair> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Certificate-Key Pair`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Certificate-Key Pair(s)`}
.objects=${this.selectedElements}
.metadata=${(item: CertificateKeyPair) => {
return [
{ key: t`Name`, value: item.name },
{ key: t`Expiry`, value: item.certExpiry.toLocaleString() },
];
}}
.usedBy=${(item: CertificateKeyPair) => {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsUsedByList({
kpUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: CertificateKeyPair) => {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsDestroy({
kpUuid: item.pk,
});
@ -78,7 +83,7 @@ export class CertificateKeyPairListPage extends TablePage<CertificateKeyPair> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: CertificateKeyPair): TemplateResult[] {

View file

@ -10,7 +10,7 @@ import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
import { EventsApi, NotificationRule } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "./RuleForm";
@customElement("ak-event-rule-list")
@ -53,17 +53,16 @@ export class RuleListPage extends TablePage<NotificationRule> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Notification rule`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Notification rule(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: NotificationRule) => {
return new EventsApi(DEFAULT_CONFIG).eventsRulesUsedByList({
pbmUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: NotificationRule) => {
return new EventsApi(DEFAULT_CONFIG).eventsRulesDestroy({
pbmUuid: item.pk,
});
@ -72,7 +71,7 @@ export class RuleListPage extends TablePage<NotificationRule> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: NotificationRule): TemplateResult[] {

View file

@ -10,7 +10,7 @@ import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
import { EventsApi, NotificationTransport } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "./TransportForm";
@customElement("ak-event-transport-list")
@ -51,17 +51,16 @@ export class TransportListPage extends TablePage<NotificationTransport> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Notifications Transport`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Notification transports(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: NotificationTransport) => {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsUsedByList({
uuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: NotificationTransport) => {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsDestroy({
uuid: item.pk,
});
@ -70,7 +69,7 @@ export class TransportListPage extends TablePage<NotificationTransport> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: NotificationTransport): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../../elements/table/Table";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ProxyForm";
import "./StageBindingForm";
@ -44,26 +44,25 @@ export class BoundStagesList extends Table<FlowStageBinding> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Stage binding`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Stage binding(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: FlowStageBinding) => {
return new FlowsApi(DEFAULT_CONFIG).flowsBindingsUsedByList({
fsbUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: FlowStageBinding) => {
return new FlowsApi(DEFAULT_CONFIG).flowsBindingsDestroy({
fsbUuid: item.pk,
});
}}
>
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete Binding`}
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: FlowStageBinding): TemplateResult[] {

View file

@ -4,7 +4,7 @@ import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ConfirmationForm";
import "./FlowForm";
@ -55,17 +55,16 @@ export class FlowListPage extends TablePage<Flow> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Flow`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Flow(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Flow) => {
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesUsedByList({
slug: item.slug,
});
}}
.delete=${() => {
.delete=${(item: Flow) => {
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesDestroy({
slug: item.slug,
});
@ -74,7 +73,7 @@ export class FlowListPage extends TablePage<Flow> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Flow): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/buttons/SpinnerButton";
import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
@ -51,17 +51,16 @@ export class GroupListPage extends TablePage<Group> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Group`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Group(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Group) => {
return new CoreApi(DEFAULT_CONFIG).coreGroupsUsedByList({
groupUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Group) => {
return new CoreApi(DEFAULT_CONFIG).coreGroupsDestroy({
groupUuid: item.pk,
});
@ -70,7 +69,7 @@ export class GroupListPage extends TablePage<Group> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Group): TemplateResult[] {

View file

@ -12,7 +12,7 @@ import "./OutpostForm";
import "./OutpostDeploymentModal";
import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/ModalForm";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import { PAGE_SIZE } from "../../constants";
import { Outpost, OutpostsApi } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
@ -139,17 +139,16 @@ export class OutpostListPage extends TablePage<Outpost> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Outpost`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Outpost(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Outpost) => {
return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUsedByList({
uuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Outpost) => {
return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesDestroy({
uuid: item.pk,
});
@ -158,7 +157,7 @@ export class OutpostListPage extends TablePage<Outpost> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
renderToolbar(): TemplateResult {

View file

@ -8,7 +8,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "./OutpostHealth";
import "../../elements/buttons/SpinnerButton";
import "../../elements/buttons/Dropdown";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "./ServiceConnectionKubernetesForm";
import "./ServiceConnectionDockerForm";
@ -102,17 +102,16 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Outpost integration`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Outpost integration(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: ServiceConnection) => {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllUsedByList({
uuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: ServiceConnection) => {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllDestroy({
uuid: item.pk,
});
@ -121,7 +120,7 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
renderToolbar(): TemplateResult {

View file

@ -4,7 +4,7 @@ import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../../elements/table/Table";
import { PoliciesApi, PolicyBinding } from "authentik-api";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/Tabs";
import "../../elements/forms/ProxyForm";
import "../../elements/buttons/SpinnerButton";
@ -96,26 +96,25 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Policy binding`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Policy binding(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: PolicyBinding) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsUsedByList({
policyBindingUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: PolicyBinding) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsDestroy({
policyBindingUuid: item.pk,
});
}}
>
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete Binding`}
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: PolicyBinding): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ProxyForm";
import "../../elements/forms/ConfirmationForm";
@ -99,31 +99,25 @@ export class PolicyListPage extends TablePage<Policy> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Policy`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Policy / Policies`}
.objects=${this.selectedElements}
.usedBy=${(item: Policy) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllUsedByList({
policyUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Policy) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllDestroy({
policyUuid: item.pk,
});
}}
>
<button
?disabled=${disabled}
slot="trigger"
type="button"
class="pf-c-button pf-m-danger ${disabled && "pf-m-disabled"}"
>
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
renderToolbar(): TemplateResult {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../../elements/table/TablePage";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteForm";
import "../../../elements/forms/DeleteBulkForm";
import "../../../elements/forms/ModalForm";
import { TableColumn } from "../../../elements/table/Table";
import { PAGE_SIZE } from "../../../constants";
@ -50,17 +50,16 @@ export class IPReputationListPage extends TablePage<IPReputation> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`IP Reputation`}
.usedBy=${() => {
.objects=${this.selectedElements}
.usedBy=${(item: IPReputation) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: IPReputation) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsDestroy({
id: item.pk,
});
@ -69,7 +68,7 @@ export class IPReputationListPage extends TablePage<IPReputation> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: IPReputation): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../../elements/table/TablePage";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteForm";
import "../../../elements/forms/DeleteBulkForm";
import "../../../elements/forms/ModalForm";
import { TableColumn } from "../../../elements/table/Table";
import { PAGE_SIZE } from "../../../constants";
@ -46,17 +46,16 @@ export class UserReputationListPage extends TablePage<UserReputation> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`User Reputation`}
.usedBy=${() => {
.objects=${this.selectedElements}
.usedBy=${(item: UserReputation) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: UserReputation) => {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersDestroy({
id: item.pk,
});
@ -65,7 +64,7 @@ export class UserReputationListPage extends TablePage<UserReputation> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: UserReputation): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ProxyForm";
import "./PropertyMappingTestForm";
@ -61,17 +61,16 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html` <ak-forms-delete
.obj=${item}
objectLabel=${t`Property Mapping`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Property Mapping(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: PropertyMapping) => {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllUsedByList({
pmUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: PropertyMapping) => {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllDestroy({
pmUuid: item.pk,
});
@ -80,7 +79,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: PropertyMapping): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/SpinnerButton";
import "../../elements/buttons/Dropdown";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ProxyForm";
import "./ldap/LDAPProviderForm";
@ -59,17 +59,16 @@ export class ProviderListPage extends TablePage<Provider> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Provider`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Provider(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Provider) => {
return new ProvidersApi(DEFAULT_CONFIG).providersAllUsedByList({
id: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Provider) => {
return new ProvidersApi(DEFAULT_CONFIG).providersAllDestroy({
id: item.pk,
});
@ -78,7 +77,7 @@ export class ProviderListPage extends TablePage<Provider> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Provider): TemplateResult[] {

View file

@ -6,7 +6,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/SpinnerButton";
import "../../elements/buttons/Dropdown";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import "../../elements/forms/ProxyForm";
import { until } from "lit-html/directives/until";
@ -53,17 +53,16 @@ export class SourceListPage extends TablePage<Source> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Source`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Source(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Source) => {
return new SourcesApi(DEFAULT_CONFIG).sourcesAllUsedByList({
slug: item.slug,
});
}}
.delete=${() => {
.delete=${(item: Source) => {
return new SourcesApi(DEFAULT_CONFIG).sourcesAllDestroy({
slug: item.slug,
});
@ -72,7 +71,7 @@ export class SourceListPage extends TablePage<Source> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Source): TemplateResult[] {

View file

@ -6,7 +6,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/SpinnerButton";
import "../../elements/buttons/Dropdown";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ProxyForm";
import "../../elements/forms/ModalForm";
import { until } from "lit-html/directives/until";
@ -72,17 +72,16 @@ export class StageListPage extends TablePage<Stage> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${item?.verboseName}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Stage(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Stage) => {
return new StagesApi(DEFAULT_CONFIG).stagesAllUsedByList({
stageUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Stage) => {
return new StagesApi(DEFAULT_CONFIG).stagesAllDestroy({
stageUuid: item.pk,
});
@ -91,7 +90,7 @@ export class StageListPage extends TablePage<Stage> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Stage): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../../elements/table/TablePage";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteForm";
import "../../../elements/forms/DeleteBulkForm";
import "../../../elements/forms/ModalForm";
import "./InvitationForm";
import "./InvitationListLink";
@ -54,17 +54,16 @@ export class InvitationListPage extends TablePage<Invitation> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Invitation`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Invitation(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Invitation) => {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsUsedByList({
inviteUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Invitation) => {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsDestroy({
inviteUuid: item.pk,
});
@ -73,7 +72,7 @@ export class InvitationListPage extends TablePage<Invitation> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Invitation): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../../elements/table/TablePage";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteForm";
import "../../../elements/forms/DeleteBulkForm";
import "../../../elements/forms/ModalForm";
import "./PromptForm";
import { TableColumn } from "../../../elements/table/Table";
@ -54,17 +54,16 @@ export class PromptListPage extends TablePage<Prompt> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Prompt`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Prompt(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Prompt) => {
return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsUsedByList({
promptUuid: item.pk,
});
}}
.delete=${() => {
.delete=${(item: Prompt) => {
return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsDestroy({
promptUuid: item.pk,
});
@ -73,7 +72,7 @@ export class PromptListPage extends TablePage<Prompt> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Prompt): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { customElement, html, property, TemplateResult } from "lit-element";
import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import "../../elements/buttons/SpinnerButton";
import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
@ -50,17 +50,16 @@ export class TenantListPage extends TablePage<Tenant> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Tenant`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Tenant(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Tenant) => {
return new CoreApi(DEFAULT_CONFIG).coreTenantsUsedByList({
tenantUuid: item.tenantUuid,
});
}}
.delete=${() => {
.delete=${(item: Tenant) => {
return new CoreApi(DEFAULT_CONFIG).coreTenantsDestroy({
tenantUuid: item.tenantUuid,
});
@ -69,7 +68,7 @@ export class TenantListPage extends TablePage<Tenant> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Tenant): TemplateResult[] {

View file

@ -5,7 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/Dropdown";
import "../../elements/buttons/TokenCopyButton";
import "../../elements/forms/DeleteForm";
import "../../elements/forms/DeleteBulkForm";
import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants";
import { CoreApi, Token } from "authentik-api";
@ -51,17 +51,16 @@ export class TokenListPage extends TablePage<Token> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Token`}
.usedBy=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Token(s)`}
.objects=${this.selectedElements}
.usedBy=${(item: Token) => {
return new CoreApi(DEFAULT_CONFIG).coreTokensUsedByList({
identifier: item.identifier,
});
}}
.delete=${() => {
.delete=${(item: Token) => {
return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({
identifier: item.identifier,
});
@ -70,7 +69,7 @@ export class TokenListPage extends TablePage<Token> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Token): TemplateResult[] {

View file

@ -3,7 +3,7 @@ import { CSSResult, customElement, html, property, TemplateResult } from "lit-el
import { AKResponse } from "../../../api/Client";
import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";
import "../../../elements/forms/DeleteForm";
import "../../../elements/forms/DeleteBulkForm";
import "../../../elements/forms/ModalForm";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/Dropdown";
@ -96,12 +96,11 @@ export class UserTokenList extends Table<Token> {
}
renderToolbarSelected(): TemplateResult {
const disabled = this.selectedElements.length !== 1;
const item = this.selectedElements[0];
return html`<ak-forms-delete
.obj=${item}
objectLabel=${t`Token`}
.delete=${() => {
const disabled = this.selectedElements.length < 1;
return html`<ak-forms-delete-bulk
objectLabel=${t`Token(s)`}
.objects=${this.selectedElements}
.delete=${(item: Token) => {
return new CoreApi(DEFAULT_CONFIG).coreTokensDestroy({
identifier: item.identifier,
});
@ -110,7 +109,7 @@ export class UserTokenList extends Table<Token> {
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
${t`Delete`}
</button>
</ak-forms-delete>`;
</ak-forms-delete-bulk>`;
}
row(item: Token): TemplateResult[] {

View file

@ -75,14 +75,20 @@ export class UserListPage extends TablePage<User> {
return html` <ak-forms-delete-bulk
objectLabel=${t`User(s)`}
.objects=${this.selectedElements}
.usedBy=${(itemPk: number) => {
.metadata=${(item: User) => {
return [
{ key: t`Username`, value: item.username },
{ key: t`ID`, value: item.pk.toString() },
];
}}
.usedBy=${(item: User) => {
return new CoreApi(DEFAULT_CONFIG).coreUsersUsedByList({
id: itemPk,
id: item.pk,
});
}}
.delete=${(itemPk: number) => {
.delete=${(item: User) => {
return new CoreApi(DEFAULT_CONFIG).coreUsersDestroy({
id: itemPk,
id: item.pk,
});
}}
>