File

operations/operations-list/operations-list.component.ts

Implements

ProductExperienceEventSource

Metadata

Index

Properties
Methods

Constructor

constructor(realtime: OperationRealtimeService, operationsListService: OperationsListService, route: ActivatedRoute)
Parameters :
Name Type Optional
realtime OperationRealtimeService No
operationsListService OperationsListService No
route ActivatedRoute No

Methods

compareOperations
compareOperations(operationA: IOperation, operationB: IOperation)
Parameters :
Name Type Optional
operationA IOperation No
operationB IOperation No
Returns : number
filter
filter(statusFilters: OperationStatusOption[])
Parameters :
Name Type Optional
statusFilters OperationStatusOption[] No
Returns : any
getOperations
getOperations(filter?)
Parameters :
Name Optional
filter Yes
Returns : any
Async ngOnInit
ngOnInit()
Returns : any

Properties

deviceId
Type : string | number
Default value : this.route.snapshot.parent.data.contextData?.id
isSmartRulesMicroserviceAvailable
Default value : false
OPERATION_STATUS_OPTIONS_MAP
Type : OperationStatusOptionsMapShared
Default value : OPERATION_STATUS_OPTIONS_MAP
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) )
productExperienceEvent
Type : ProductExperienceEvent
Default value : { eventName: !!this.deviceId ? SINGLE_OPERATION_EVENT_DEVICE_TAB : SINGLE_OPERATION_EVENT_OVERVIEW }
Public realtime
Type : OperationRealtimeService
refreshLoading
Default value : false
reload$
Type : BehaviorSubject<void>
Default value : new BehaviorSubject(null)
showOverviewBreadcrumbs
Default value : false
statusFilter
Type : StatusFilterComponent
Decorators :
@ViewChild('statusFilter', {static: true})
statusFilter$
Type : BehaviorSubject<OperationStatusOption[]>
Default value : new BehaviorSubject(null)
title
Type : string
<c8y-title>{{ title | translate }}</c8y-title>

<c8y-breadcrumb *ngIf="showOverviewBreadcrumbs">
  <c8y-breadcrumb-item
    [icon]="'c8y-overviews'"
    [label]="'Overviews' | translate"
  ></c8y-breadcrumb-item>
  <c8y-breadcrumb-item
    [icon]="'c8y-device-control'"
    [label]="'Device Control' | translate"
    [path]="'devicecontrol/single'"
  ></c8y-breadcrumb-item>
  <c8y-breadcrumb-item
    [icon]="'c8y-device-control'"
    [label]="'Single operations' | translate"
  ></c8y-breadcrumb-item>
</c8y-breadcrumb>

<c8y-action-bar-item
  [placement]="'left'"
  itemClass="navbar-form"
>
  <c8y-status-filter
    #statusFilter
    [options]="OPERATION_STATUS_OPTIONS_MAP"
    (onFilterChanged)="statusFilter$.next($event)"
    c8yProductExperience
    inherit
  ></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
      class="m-r-4"
      c8yIcon="refresh"
      [ngClass]="{ 'icon-spin': refreshLoading }"
    ></i>
    <span class="text-truncate">
      {{ 'Reload' | translate }}
    </span>
  </button>
</c8y-action-bar-item>

<c8y-help
  src="/docs/device-management-application/monitoring-and-controlling-devices/#to-view-single-operations"
></c8y-help>

<!-- 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
    class="btn btn-primary"
    title="{{ 'Reset filter' | translate }}"
    type="button"
    (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">
  <div
    class="page-sticky-header c8y-list__item c8y-list__item--double-actions hidden-xs"
    *ngIf="(operations$ | async)?.data.length"
  >
    <div class="c8y-list__item__block">
      <div class="c8y-list__item__icon">
        <i class="p-l-24"></i>
      </div>
      <div class="c8y-list__item__body text-truncate-wrap">
        <div 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 created' | translate }}
          </div>
        </div>
      </div>
      <div class="c8y-list__item__actions"></div>
    </div>
  </div>
  <div
    class="d-contents"
    *c8yFor="
      let op of operations$ | async;
      let i = index;
      realtime: realtime;
      realtimeOptions: { entityOrId: deviceId };
      comparator: compareOperations.bind(this);
      loadMore: 'auto'
    "
  >
    <c8y-operations-list-item
      class="d-contents"
      [operation]="op"
      [isSmartRulesMicroserviceAvailable]="isSmartRulesMicroserviceAvailable"
      (reload)="reload$.next()"
      c8yProductExperience
      inherit
    ></c8y-operations-list-item>
  </div>
</c8y-list-group>

results matching ""

    No results matching ""