web/admin: select all password stage backends by default
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -156,11 +156,20 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
|
||||
.sourcesAllList({})
|
||||
.then((sources) => {
|
||||
return sources.results.map((source) => {
|
||||
const selected = Array.from(
|
||||
let selected = Array.from(
|
||||
this.instance?.sources || [],
|
||||
).some((su) => {
|
||||
return su == source.pk;
|
||||
});
|
||||
// Creating a new instance, auto-select built-in source
|
||||
// Only when no other sources exist
|
||||
if (
|
||||
!this.instance &&
|
||||
source.component === "" &&
|
||||
sources.results.length < 2
|
||||
) {
|
||||
selected = true;
|
||||
}
|
||||
return html`<option
|
||||
value=${ifDefined(source.pk)}
|
||||
?selected=${selected}
|
||||
|
||||
@ -46,8 +46,11 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> {
|
||||
};
|
||||
|
||||
isBackendSelected(field: BackendsEnum): boolean {
|
||||
if (!this.instance) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
(this.instance?.backends || []).filter((isField) => {
|
||||
this.instance.backends.filter((isField) => {
|
||||
return field === isField;
|
||||
}).length > 0
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user