File
Methods
compareOperations
|
compareOperations(operationA: IOperation, operationB: IOperation)
|
Parameters :
Name |
Type |
Optional |
operationA |
IOperation
|
No
|
operationB |
IOperation
|
No
|
|
getOperations
|
getOperations(filter?)
|
|
deviceId
|
Type : string | number
|
Default value : this.route.snapshot.parent.data.contextData?.id
|
operations$
|
Type : Observable<IResultList<IOperation>>
|
Default value : combineLatest(
this.statusFilter$,
this.reload$
).pipe(
tap(() => {
this.refreshLoading = true;
}),
switchMap(([statusFilters]) => this.filter(statusFilters)),
tap(() => {
this.refreshLoading = false;
}),
shareReplay(1)
)
|
refreshLoading
|
Type : boolean
|
Default value : false
|
reload$
|
Type : BehaviorSubject<void>
|
Default value : new BehaviorSubject(null)
|
<c8y-title> {{ title | translate }}</c8y-title>
<c8y-action-bar-item [placement]="'left'" itemClass="navbar-form">
<c8y-status-filter
#statusFilter
[options]="OPERATION_STATUS_OPTIONS_MAP"
(onFilterChanged)="statusFilter$.next($event)"
></c8y-status-filter>
</c8y-action-bar-item>
<c8y-action-bar-item [placement]="'right'">
<c8y-realtime-btn [service]="realtime"></c8y-realtime-btn>
</c8y-action-bar-item>
<c8y-action-bar-item [placement]="'right'">
<button
class="btn btn-link d-flex a-i-center"
title="{{ 'Reload' | translate }}"
(click)="reload$.next()"
>
<i c8yIcon="refresh" [ngClass]="{ 'icon-spin': refreshLoading }" class="m-r-4"></i>
<span class="text-truncate">
{{ 'Reload' | translate }}
</span>
</button>
</c8y-action-bar-item>
<!-- Empty state -->
<c8y-ui-empty-state
[icon]="'c8y-energy'"
[title]="'No items to display.' | translate"
[subtitle]="'Operations will be displayed here.' | translate"
*ngIf="(operations$ | async)?.data.length === 0 && !(statusFilter$ | async)"
></c8y-ui-empty-state>
<!-- No results empty state -->
<c8y-ui-empty-state
[icon]="'search'"
[title]="'No results to display.' | translate"
[subtitle]="'Adjust or reset the filter.' | translate"
*ngIf="(operations$ | async)?.data.length === 0 && (statusFilter$ | async)"
>
<button
type="button"
title="{{ 'Reset filter' | translate }}"
class="btn btn-primary"
(click)="statusFilter.reset()"
translate
>
Reset filter
</button>
</c8y-ui-empty-state>
<!-- Detailed list of operations + load more button -->
<c8y-list-group class="m-b-24" [ngClass]="{ 'dd-low': (operations$ | async)?.data.length < 10 }">
<c8y-li
class="page-sticky-header c8y-list__item--empty-actions hidden-xs"
*ngIf="(operations$ | async)?.data.length"
>
<c8y-li-icon>
<i class="p-l-24"></i>
</c8y-li-icon>
<c8y-li-body class="content-flex-57">
<div class="col-5">
{{ 'Operation' | translate }}
</div>
<div class="flex-grow" *ngIf="!deviceId">
{{ 'Device' | translate }}
</div>
<div class="col-4">
{{ 'Date' | translate }}
</div>
</c8y-li-body>
</c8y-li>
<div
class="d-contents"
*c8yFor="
let op of operations$ | async;
let i = index;
realtime: realtime;
comparator: compareOperations.bind(this);
loadMore: 'auto'
"
>
<c8y-operations-list-item [operation]="op" (reload)="reload$.next()" class="d-contents">
</c8y-operations-list-item>
</div>
</c8y-list-group>