Fix SelectAccount didn't always get values into options correctly

This commit is contained in:
nathan 2022-12-12 13:10:53 -07:00
parent 9acda4b390
commit 34172704dc
2 changed files with 7 additions and 1 deletions

View File

@ -75,7 +75,7 @@ export class Et2SelectAccount extends SelectAccountMixin(Et2Select)
{ {
return []; return [];
} }
let select_options : Array<SelectOption> = [...this.__select_options] || []; let select_options : Array<SelectOption> = [...super.select_options] || [];
// for primary_group we only display owngroups == own memberships, not other groups // for primary_group we only display owngroups == own memberships, not other groups
if (type === 'primary_group' && this.accountType !== 'accounts') if (type === 'primary_group' && this.accountType !== 'accounts')
{ {

View File

@ -54,6 +54,12 @@ export const SelectAccountMixin = <T extends Constructor<LitElement>>(superclass
let val = Array.isArray(this.value) ? this.value : [this.value]; let val = Array.isArray(this.value) ? this.value : [this.value];
for(let id of val) for(let id of val)
{ {
// Don't add if it's already there
if(this.account_options.findIndex(o => o.value == id) != -1)
{
continue;
}
let account_name = null; let account_name = null;
let option = <SelectOption>{value: id, label: id + " ..."}; let option = <SelectOption>{value: id, label: id + " ..."};
this.account_options.push(option); this.account_options.push(option);