}
if (this.includeDescendants.value) {
- // can result in duplicate workstation org IDs... meh
this.options.orgIds = this.options.orgIds.concat(
this.org.descendants(this.options.primaryOrgId, true));
}
+ // Using ancestors() and descendants() can result in
+ // duplicate org ID's. Be nice and uniqify.
+ const hash: any = {};
+ this.options.orgIds.forEach(id => hash[id] = true);
+ this.options.orgIds = Object.keys(hash).map(id => Number(id));
+
this.propagateChange(this.options);
};
-
}
writeValue(value: OrgFamily) {
<div class="card-text">
<eg-org-family-select
formControlName="badOrgSelector"
- labelText="Choose the worst libraries">
+ labelText="Choose the fanciest libraries">
</eg-org-family-select>
- <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
+ <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
<span class="material-icons">error</span>
- <span i18n>Too many bad libraries!</span>
+ <span i18n>Too many fancy libraries!</span>
</div>
</div>
</div>
{'id': 4, 'includeAncestors': false, 'includeDescendants': true}, (c: FormControl) => {
// An Angular custom validator
if (c.value.orgIds && c.value.orgIds.length > 5) {
- return { tooMany: 'That\'s too many bad libraries!' };
+ return { tooMany: 'That\'s too many fancy libraries!' };
} else {
return null;
}
});
this.badOrgForm.get('badOrgSelector').valueChanges.subscribe(bad => {
- this.toast.danger('The worst libraries are: ' + JSON.stringify(bad.orgIds));
+ this.toast.danger('The fanciest libraries are: ' + JSON.stringify(bad.orgIds));
});
this.gridDataSource.data = [