File
Metadata
selector |
c8y-select-device-profile-step |
templateUrl |
select-device-profile-step.component.html |
Index
Properties
|
|
Methods
|
|
Outputs
|
|
Outputs
deviceProfile
|
$event Type: EventEmitter<IManagedObject>
|
Methods
getDeviceTypeTitle
|
getDeviceTypeTitle(deviceProfile: IManagedObject)
|
Parameters :
Name |
Type |
Optional |
deviceProfile |
IManagedObject
|
No
|
|
loadDeviceTypes
|
loadDeviceTypes()
|
|
ngOnDestroy
|
ngOnDestroy()
|
|
selectDeviceProfile
|
selectDeviceProfile(deviceProfile: IManagedObject)
|
Parameters :
Name |
Type |
Optional |
deviceProfile |
IManagedObject
|
No
|
|
Readonly
DEVICE_TYPE_NOT_DEFINED
|
DEVICE_TYPE_NOT_DEFINED:
|
Default value : gettext('Device type not defined')
|
deviceProfile$
|
deviceProfile$: Observable<IResultList<IManagedObject>>
|
Type : Observable<IResultList<IManagedObject>>
|
Default value : combineLatest(
this.textFilter$,
this.deviceType$
).pipe(
switchMap(([name, deviceType]) => this.getDeviceProfiles(name, deviceType)),
shareReplay(1)
)
|
deviceType$
|
deviceType$: BehaviorSubject<string>
|
Type : BehaviorSubject<string>
|
Default value : new BehaviorSubject('')
|
deviceTypes
|
deviceTypes: []
|
Type : []
|
Default value : []
|
selectedDeviceType
|
selectedDeviceType: object
|
Type : object
|
Default value : { name: '' }
|
textFilter$
|
textFilter$: BehaviorSubject<string>
|
Type : BehaviorSubject<string>
|
Default value : new BehaviorSubject('')
|
<div class="card-block p-t-0 overflow-visible flex-no-shrink separator-bottom col-xs-12">
<div class="row p-b-16">
<div class="col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
<h4 class="text-center m-b-16">{{ 'Select device profile' | translate }}</h4>
<div class="row">
<div class="col-md-6">
<div class="input-group input-group-search">
<input
type="search"
class="form-control"
title="{{ 'Filter device profiles…' | translate }}"
placeholder="{{ 'Filter device profiles…' | translate }}"
[ngModel]="textFilter$ | async"
(ngModelChange)="textFilter$.next($event)"
/>
<span class="input-group-addon">
<i c8yIcon="filter" *ngIf="(textFilter$ | async).length === 0"></i>
<i
c8yIcon="times"
class="text-muted"
*ngIf="(textFilter$ | async).length"
(click)="textFilter$.next('')"
></i>
</span>
</div>
</div>
<div class="col-md-6">
<c8y-form-group class="m-0">
<c8y-typeahead
name="deviceType"
[(ngModel)]="selectedDeviceType"
placeholder="{{ 'Type to filter device types…' | translate }}"
(onSearch)="deviceType$.next($event)"
[allowFreeEntries]="false"
>
<c8y-li
class="p-l-8 p-r-8 c8y-list__item--link"
(click)="selectedDeviceType = {name: ''}; deviceType$.next('')"
>
<span>{{'All device types' | translate }}</span>
</c8y-li>
<c8y-li
*ngFor="let deviceType of deviceTypes"
class="p-l-8 p-r-8 c8y-list__item--link"
(click)="selectedDeviceType = deviceType; deviceType$.next(deviceType.name)"
[active]="selectedDeviceType === deviceType"
>
<c8y-highlight
[text]="deviceType.name"
[pattern]="deviceType$ | async"
></c8y-highlight>
</c8y-li>
</c8y-typeahead>
<c8y-messages
><c8y-message
name="notExisting"
[text]="'Select one of the existing device types.' | translate"
></c8y-message>
</c8y-messages>
</c8y-form-group>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 flex-grow no-gutter">
<div class="card-inner-scroll fit-h">
<div class="card-block p-t-0 p-b-0">
<c8y-list-group>
<c8y-li *c8yFor="let deviceProfile of deviceProfile$ | async; loadMore: 'auto'">
<c8y-li-radio (onSelect)="selectDeviceProfile(deviceProfile)"></c8y-li-radio>
<c8y-li-icon>
<i c8yIcon="c8y-device-profile"></i>
</c8y-li-icon>
<c8y-li-body class="content-flex-60">
<div class="col-5">
<div class="text-truncate" title="{{ deviceProfile.name }}">
{{ deviceProfile.name }}
</div>
</div>
<div class="col-3">
<div class="text-truncate" title="{{ 'Device type' | translate }}: {{ getDeviceTypeTitle(deviceProfile) }}">
<span class="text-label-small m-r-8" translate>
Device type
</span>
<span *ngIf="deviceProfile.c8y_Filter?.type; else noType">
{{ deviceProfile.c8y_Filter?.type }}
</span>
<ng-template #noType>
<small><em class="text-muted" translate>Undefined`device type`</em></small>
</ng-template>
</div>
</div>
</c8y-li-body>
</c8y-li>
</c8y-list-group>
</div>
</div>
</div>