sources: prevent deletion of built-in source (#12914)
* web: sources: disable "delete" button for built-in source * poetry doesn't like that I use python 3.13 / implement check on backend too * fix ruff i think Signed-off-by: Dominic R <git@sdko.org> * nvm Signed-off-by: Dominic R <git@sdko.org> * reformat * check by managed attribute Signed-off-by: Jens Langhammer <jens@goauthentik.io> * like this? --------- Signed-off-by: Dominic R <git@sdko.org> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Dominic R <git@sdko.org> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -57,10 +57,13 @@ export class SourceListPage extends TablePage<Source> {
|
||||
}
|
||||
|
||||
renderToolbarSelected(): TemplateResult {
|
||||
const disabled = this.selectedElements.length < 1;
|
||||
const disabled =
|
||||
this.selectedElements.length < 1 ||
|
||||
this.selectedElements.some((item) => item.component === "");
|
||||
const nonBuiltInSources = this.selectedElements.filter((item) => item.component !== "");
|
||||
return html`<ak-forms-delete-bulk
|
||||
objectLabel=${msg("Source(s)")}
|
||||
.objects=${this.selectedElements}
|
||||
.objects=${nonBuiltInSources}
|
||||
.usedBy=${(item: Source) => {
|
||||
return new SourcesApi(DEFAULT_CONFIG).sourcesAllUsedByList({
|
||||
slug: item.slug,
|
||||
|
||||
Reference in New Issue
Block a user