From dfd1fd9db6f56ac3c9e413b980c0a61f0424b28a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 8 Nov 2019 10:37:21 -0500 Subject: [PATCH] LP1851831 Group perm editor null descriptions OK Avoid assuming a permission description value is non-NULL in the permission group editor interfaces since values are not required in the database. Fixes: ERROR TypeError: "l.description(...) is null" Similarly repair the permission list title attributes so they display the permission code (instead of an empty string) for titles when no description is available. Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp --- .../src/app/staff/admin/server/perm-group-map-dialog.component.ts | 2 +- .../eg2/src/app/staff/admin/server/perm-group-tree.component.html | 5 ++++- .../src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-map-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-map-dialog.component.ts index 2d472d70f7..c71f25f3b0 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-map-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-map-dialog.component.ts @@ -64,7 +64,7 @@ export class PermGroupMapDialogComponent const entries: ComboboxEntry[] = []; this.trimmedPerms.forEach(p => { if (p.code().toLowerCase().includes(term) || - p.description().toLowerCase().includes(term)) { + (p.description() || '').toLowerCase().includes(term)) { entries.push({id: p.id(), label: p.code()}); } }); diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html index 6e1770abe3..d906400232 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html @@ -148,7 +148,10 @@
- {{map.perm().code()}} + + {{map.perm().code()}} +
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts index 3302c31b8b..da97bca4f7 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts @@ -104,8 +104,10 @@ export class PermGroupTreeComponent implements OnInit { const parts = this.filterText.toLowerCase().split(' '); maps = maps.filter(m => { - const target = m.perm().code().toLowerCase() - + ' ' + m.perm().description().toLowerCase(); + const desc = m.perm().description() || ''; // null-able + + const target = + m.perm().code().toLowerCase() + ' ' + desc.toLowerCase(); for (let i = 0; i < parts.length; i++) { const part = parts[i]; -- 2.11.0