File

tracking/tracking.component.ts

Implements

OnInit AfterViewInit

Metadata

Index

Properties
Methods

Constructor

constructor(service: TrackingService, realtime: EventRealtimeService, contextRouteService: ContextRouteService, activatedRoute: ActivatedRoute)
Parameters :
Name Type Optional
service TrackingService No
realtime EventRealtimeService No
contextRouteService ContextRouteService No
activatedRoute ActivatedRoute No

Methods

Async ngAfterViewInit
ngAfterViewInit()
Returns : any
Async ngOnInit
ngOnInit()
Returns : any
toggleMarker
toggleMarker(event: IEvent)
Parameters :
Name Type Optional
event IEvent No
Returns : void
togglePositionRealtime
togglePositionRealtime(active: boolean)
Parameters :
Name Type Optional
active boolean No
Returns : void
toggleRealtime
toggleRealtime(interval: TimeInterval)
Parameters :
Name Type Optional
interval TimeInterval No
Returns : void

Properties

activeMarkers
Type : literal type
Default value : {}
config
Type : MapConfig
Default value : { realtime: false, follow: false, zoomLevel: 12, fitBoundsOptions: { padding: [50, 50] } }
dateRangePickerConfig
Type : DateRangePickerConfig
Default value : { adaptivePosition: true, showPreviousMonth: true, preventChangeToNextMonth: true }
device
Type : PositionManagedObject
loadMoreComponent
Type : LoadMoreComponent
map
Type : MapComponent
Decorators :
@ViewChild(MapComponent)
maxDate
Default value : new Date()
Public realtime
Type : EventRealtimeService
realtimeDisabled
Default value : false
Public service
Type : TrackingService
<c8y-action-bar-item
  [placement]="'right'"
  [priority]="100"
>
  <c8y-realtime-btn
    [service]="realtime"
    [disabled]="realtimeDisabled"
    (onToggle)="togglePositionRealtime($event)"
  ></c8y-realtime-btn>
</c8y-action-bar-item>
<c8y-action-bar-item
  [placement]="'right'"
  [priority]="60"
>
  <c8y-time-interval
    [maxCustomDate]="maxDate"
    [dateRangePickerConfig]="dateRangePickerConfig"
    (interval)="service.setInterval($event); toggleRealtime($event)"
  ></c8y-time-interval>
</c8y-action-bar-item>

<div class="card card--grid content-fullpage d-grid grid__col--8-4--md">
  <div class="bg-white p-relative">
    <c8y-map
      [config]="config"
      [assets]="device"
      [polyline$]="service.polyline$"
      [polylineOptions]="{ color: 'darkblue' }"
    >
      <div *c8yMapPopup="let context">
        <c8y-tracking-marker-popup [context]="context"></c8y-tracking-marker-popup>
      </div>
    </c8y-map>
  </div>

  <div class="d-flex d-col bg-inherit content-fullpage bg-gray-white">
    <div class="card-header large-padding separator sticky-top">
      <span
        class="card-title"
        translate
      >
        Tracking events
      </span>
    </div>
    <div class="inner-scroll">
      <c8y-list-group class="c8y-list__group--strip">
        <ng-template
          c8yFor
          let-event
          [c8yForOf]="service.events$"
          [c8yForPipe]="service.pipe"
          [c8yForRealtime]="realtime"
          [c8yForRealtimeOptions]="{ entityOrId: device }"
          [c8yForLoadMore]="'hidden'"
          [c8yForNotFound]="empty"
          (c8yForLoadMoreComponent)="
            loadMoreComponent = $event; loadMoreComponent.useIntersection = false
          "
        >
          <c8y-li
            class="pointer"
            [ngClass]="{ 'text-primary text-bold': activeMarkers['p' + event?.id] }"
            (click)="toggleMarker(event)"
          >
            <c8y-li-icon [ngClass]="{ 'text-primary': activeMarkers['p' + event?.id] }">
              <i c8yIcon="c8y-location"></i>
            </c8y-li-icon>
            <c8y-li-body>
              <div class="d-flex">
                <span>
                  {{ event.time | date: 'mediumDate' }}
                </span>
                <span class="m-l-auto">
                  {{ event.time | date: 'mediumTime' }}
                </span>
              </div>
            </c8y-li-body>
          </c8y-li>
        </ng-template>
      </c8y-list-group>
    </div>

    <!-- empty state -->
    <ng-template #empty>
      <c8y-ui-empty-state
        icon="c8y-location"
        [title]="'No tracking events found.' | translate"
        [subtitle]="'Select another time range.' | translate"
        *ngIf="!service.hasEvents"
        [horizontal]="true"
      ></c8y-ui-empty-state>
    </ng-template>

    <div *ngIf="loadMoreComponent?.hasMore">
      <button
        class="btn btn-link fit-w sticky-bottom separator-top"
        [title]="'Load more' | translate"
        type="button"
        [disabled]="loadMoreComponent?.isLoading"
        (click)="loadMoreComponent.loadMore()"
      >
        {{ 'Load more' | translate }}
      </button>
    </div>

    <div class="card-footer separator">
      <button
        class="btn btn-default"
        [title]="'Deselect all markers' | translate"
        type="button"
        [disabled]="(activeMarkers | json) === '{}'"
        (click)="map.clearMarkers('event'); activeMarkers = {}"
      >
        {{ 'Deselect all markers' | translate }}
      </button>
    </div>
  </div>
</div>

results matching ""

    No results matching ""