sub-assets/add-group/add-group.component.ts
selector | c8y-add-group |
templateUrl | ./add-group.component.html |
Properties |
Methods |
Inputs |
Outputs |
HostListeners |
constructor(deviceGridService: DeviceGridService, fb: FormBuilder, addGroupService: AddGroupService, alert: AlertService, subAssetsService: SubAssetsService)
|
||||||||||||||||||
Parameters :
|
currentGroupId |
Type : string
|
refresh |
Type : any
|
Default value : new EventEmitter<any>()
|
onCancel |
Type : EventEmitter
|
onDeviceQueryStringChange |
Type : EventEmitter<string>
|
document:keydown.enter |
Arguments : '$event'
|
document:keydown.enter(event: KeyboardEvent)
|
document:keydown.escape |
Arguments : '$event'
|
document:keydown.escape(event: KeyboardEvent)
|
Async createGroup |
createGroup()
|
Returns :
any
|
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
Async ngOnInit |
ngOnInit()
|
Returns :
any
|
onEnterKeyDown | ||||||
onEnterKeyDown(event: KeyboardEvent)
|
||||||
Decorators :
@HostListener('document:keydown.enter', ['$event'])
|
||||||
Parameters :
Returns :
void
|
onEscapeKeyDown | ||||||
onEscapeKeyDown(event: KeyboardEvent)
|
||||||
Decorators :
@HostListener('document:keydown.escape', ['$event'])
|
||||||
Parameters :
Returns :
void
|
onSelected | ||||||
onSelected(selectedDevicesIDs: string[])
|
||||||
Parameters :
Returns :
void
|
resetStepper |
resetStepper()
|
Returns :
void
|
Readonly btnLabels |
Type : object
|
Default value : {
next: gettext('Next'),
cancel: gettext('Cancel'),
create: gettext('Create')
}
|
canAssignDevice |
Type : boolean
|
Default value : false
|
canCreateGroup |
Type : boolean
|
Default value : false
|
deviceQueryStringOutput |
Type : string
|
formGroupStepOne |
Type : FormGroup
|
Readonly ITEMS_SELECT_LIMIT |
Type : number
|
Default value : 15
|
nameInputRef |
Type : ElementRef
|
Decorators :
@ViewChild('nameRef', {static: false})
|
pagination |
Type : Pagination
|
Default value : { pageSize: 20, currentPage: 1 }
|
pendingStatus |
Type : boolean
|
Default value : false
|
selected |
Type : string[]
|
Default value : []
|
stepper |
Type : C8yStepper
|
Decorators :
@ViewChild(C8yStepper, {static: false})
|
subscription |
Type : Subscription
|
<c8y-title *ngIf="!currentGroupId">
{{ 'Add group' | translate }}
</c8y-title>
<div class="d-contents" *ngIf="!currentGroupId; else stepper">
<ng-container [ngTemplateOutlet]="stepper"></ng-container>
</div>
<ng-template #stepper>
<c8y-stepper
class="flex-col flex-nowrap no-align-items fit-h c8y-stepper--no-btns"
[disableDefaultIcons]="{ edit: true, done: false }"
[customClasses]="['col-md-6', 'col-md-offset-3', 'm-t-24', 'm-b-40', 'p-0', 'flex-no-shrink']"
linear
>
<cdk-step [stepControl]="formGroupStepOne" [label]="'New group' | translate">
<div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<h4 class="text-center text-medium">
{{ 'New group' | translate }}
</h4>
</div>
</div>
</div>
<div class="col-xs-12 flex-grow no-gutter">
<div class="card-inner-scroll fit-h">
<div class="card-block p-b-0">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<c8y-form-group>
<div [formGroup]="formGroupStepOne">
<c8y-form-group>
<label translate>Name</label>
<input
class="form-control"
type="text"
formControlName="name"
placeholder="{{ 'e.g. First floor' | translate }} "
maxlength="254"
#nameRef
required
/>
<c8y-messages>
<c8y-message *ngIf="!formGroupStepOne.untouched && !nameRef.value" translate
>This field is required.</c8y-message
>
</c8y-messages>
</c8y-form-group>
<c8y-form-group>
<label translate>Description</label>
<input
class="form-control"
type="text"
formControlName="description"
placeholder="{{ 'e.g. first floor devices' | translate }}"
/>
</c8y-form-group>
</div>
</c8y-form-group>
<c8y-form-group>
<div [formGroup]="formGroupStepOne"></div>
</c8y-form-group>
<div class="alert alert-info max-width-100" translate *ngIf="!canAssignDevice">
You don't have permission to assign devices.
</div>
</div>
</div>
</div>
</div>
</div>
<c8y-stepper-buttons
class="d-block card-footer p-24 separator"
(onCancel)="onCancel.emit()"
(onCustom)="createGroup()"
[disabled]="!canCreateGroup"
[labels]="
canAssignDevice
? { next: btnLabels.next, cancel: btnLabels.cancel }
: { custom: btnLabels.create, cancel: btnLabels.cancel }
"
[showButtons]="
canAssignDevice ? { next: true, cancel: true } : { custom: true, cancel: true }
"
></c8y-stepper-buttons>
</cdk-step>
<cdk-step [label]="'Assign devices' | translate">
<div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<h4 class="text-center text-medium">
{{ 'Assign devices' | translate }}
</h4>
</div>
</div>
</div>
<div class="col-xs-12 no-gutter flex-grow">
<c8y-device-grid
[title]="'Select target devices' | translate"
[actionControls]="[]"
[infiniteScroll]="'auto'"
[selectable]="true"
[pagination]="pagination"
(itemsSelect)="onSelected($event)"
[refresh]="refresh"
>
</c8y-device-grid>
</div>
<c8y-stepper-buttons
class="d-block card-footer p-24 separator"
(onCancel)="onCancel.emit()"
(onCustom)="createGroup()"
[labels]="{ custom: btnLabels.create }"
[disabled]="!canAssignDevice"
[pending]="pendingStatus"
></c8y-stepper-buttons>
</cdk-step>
</c8y-stepper>
</ng-template>