Skip to content

Commit

Permalink
Merge pull request primefaces#293 from Nanitor/activity-log
Browse files Browse the repository at this point in the history
Don't display a huge number of array values in the activity log list.
  • Loading branch information
Gunnsteinn Hall authored Sep 19, 2019
2 parents 9fe30c1 + e9e03ba commit 160fb61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h2>{{ rowData.event_name }}</h2>
<li *ngFor="let item of eventData(rowData.event_data)">
<b>{{item.key}}:</b>
<span *ngIf="typeOf(item.value) == 'other'"> {{item.value}}</span>
<span *ngIf="typeOf(item.value) == 'array'"> {{item.value.join(', ')}}</span>
<span *ngIf="typeOf(item.value) == 'array'"> {{joinArray(item.value)}}</span>
<ul *ngIf="typeOf(item.value) == 'object'" class="event-data">
<li *ngFor="let subitem of eventData(item.value)">
<b>{{subitem.key}}:</b> {{subitem.value}}
Expand Down
7 changes: 7 additions & 0 deletions src/organization/activity_log/activity_log_list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export class ActivityLogListComponent extends BaseList implements OnInit, AfterV
return ret;
}

joinArray(value) {
if (value.length > 10) {
return value.slice(0, 10).join(', ') + ' ...';
}
return value.join(', ');
}

typeOf(value) {
if (value && typeof value == 'object') {
if (Array.isArray(value)) {
Expand Down

0 comments on commit 160fb61

Please sign in to comment.