sub-assets/assign-devices/assign-devices.component.ts
providers |
{
provide: DATA_GRID_CONFIGURATION_STRATEGY, useClass: UserPreferencesConfigurationStrategy
}
{
provide: DATA_GRID_CONFIGURATION_CONTEXT, useValue: AssignDevicesComponent.GRID_CONFIG_CONTEXT
}
|
selector | c8y-assign-devices |
templateUrl | ./assign-devices.component.html |
Properties |
Methods |
Inputs |
Outputs |
HostListeners |
constructor(alert: AlertService, subAssetsService: SubAssetsService, inventoryService: InventoryService, gainsightService: GainsightService)
|
|||||||||||||||
Parameters :
|
currentGroupId |
Type : string
|
refresh |
Type : any
|
Default value : new EventEmitter<any>()
|
onCancel |
Type : EventEmitter
|
onShowChildDevices |
Type : EventEmitter
|
selectedDevice |
Type : EventEmitter
|
document:keydown.enter |
Arguments : '$event'
|
document:keydown.enter(_event: KeyboardEvent)
|
Async assignDevices |
assignDevices()
|
Returns :
any
|
Async ngOnInit |
ngOnInit()
|
Returns :
any
|
onEnterKeyDown | ||||||
onEnterKeyDown(_event: KeyboardEvent)
|
||||||
Decorators :
@HostListener('document:keydown.enter', ['$event'])
|
||||||
Parameters :
Returns :
void
|
onSelected | ||||||
onSelected(selectedDevicesIDs: string[])
|
||||||
Parameters :
Returns :
void
|
selectChildren | ||||||
selectChildren(asset: IManagedObject)
|
||||||
Parameters :
Returns :
void
|
setActionControls | ||||||
setActionControls(showChildren: boolean)
|
||||||
Parameters :
Returns :
void
|
setHeaderActionControls |
setHeaderActionControls()
|
Returns :
void
|
setNotIncludedInGroupQuery |
setNotIncludedInGroupQuery()
|
Returns :
void
|
actionControls |
Type : ActionControl[]
|
Default value : []
|
baseQuery |
Type : any
|
canAssignDevice |
Default value : false
|
CURRENT_LOCATION |
Default value : location.href
|
deviceQueryStringOutput |
Type : string
|
Static Readonly GRID_CONFIG_CONTEXT |
Type : UserPreferencesGridConfigContext
|
Default value : {
key: 'assign-devices-grid',
configFilter: {
filter: false
}
}
|
headerActionControls |
Type : HeaderActionControl[]
|
Default value : []
|
Readonly isSelectable |
Default value : true
|
pagination |
Type : Pagination
|
Default value : { pageSize: 20, currentPage: 1 }
|
pendingStatus |
Default value : false
|
PRODUCT_EXPERIENCE |
Default value : PRODUCT_EXPERIENCE_SUB_ASSETS_SHARED
|
selected |
Type : string[]
|
Default value : []
|
showChildren |
Default value : false
|
showDevicesToggle |
Type : TemplateRef<any>
|
Decorators :
@ViewChild('showDevicesToggle', {read: TemplateRef})
|
<div class="card-block flex-no-shrink separator-bottom col-xs-12 large-padding p-t-24 p-b-24">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<div class="h4 text-center text-medium">
{{ 'Assign devices' | translate }}
</div>
</div>
</div>
</div>
<c8y-device-grid
class="flex-grow col-xs-12 no-gutter"
[title]="''"
[actionControls]="actionControls"
[infiniteScroll]="'auto'"
[selectable]="isSelectable"
[pagination]="pagination"
(itemsSelect)="onSelected($event)"
[refresh]="refresh"
[baseQuery]="baseQuery"
[headerActionControls]="headerActionControls"
[withChildren]="true"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{ component: PRODUCT_EXPERIENCE.ASSIGN_DEVICES.COMPONENTS.ASSIGN_DEVICES }"
></c8y-device-grid>
<div class="text-center card-footer p-24 separator">
<button
class="btn btn-default"
title="{{ 'Cancel' | translate }}"
type="button"
(click)="onCancel.emit()"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.ASSIGN_DEVICES.COMPONENTS.ASSIGN_DEVICES,
action: PRODUCT_EXPERIENCE.ASSIGN_DEVICES.ACTIONS.CANCEL
}"
>
<span>{{ 'Cancel' | translate }}</span>
</button>
<button
class="btn btn-primary"
title="{{ 'Assign' | translate }}"
type="button"
[ngClass]="{ 'btn-pending': pendingStatus }"
(click)="assignDevices()"
[disabled]="selected.length === 0 || !canAssignDevice"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.ASSIGN_DEVICES.COMPONENTS.ASSIGN_DEVICES,
action: PRODUCT_EXPERIENCE.ASSIGN_DEVICES.ACTIONS.ASSIGN
}"
>
<span>{{ 'Assign' | translate }}</span>
</button>
</div>
<ng-template
#showDevicesToggle
let-control="headerActionControl"
>
<label
class="c8y-switch a-s-center"
title="{{ control.text | translate }}"
>
<input
type="checkbox"
[(ngModel)]="showChildren"
(click)="control.callback()"
/>
<span></span>
<span>{{ control.text | translate }}</span>
</label>
<button
class="btn-help m-r-16 a-s-center"
[attr.aria-label]="'Help' | translate"
[popover]="childDevicesPop"
placement="bottom"
triggers="focus"
type="button"
></button>
<ng-template #childDevicesPop>
<span translate>
Displays the button
<span
class="btn btn-dot btn-icon no-pointer"
title="Child devices icon"
>
<i class="text-primary dlt-c8y-icon-enter-bottom"></i>
</span>
next to target devices with children. Clicking it displays a list with all child devices of
the selected target device.
</span>
</ng-template>
</ng-template>