sub-assets/group-info.component.ts
OnDestroy
OnChanges
selector | c8y-group-info |
templateUrl | ./group-info.component.html |
Properties |
Methods |
|
Inputs |
Outputs |
constructor(inventory: InventoryService, subAssetsService: SubAssetsService, smartGroupsService: SmartGroupsService, alertService: AlertService, modalService: ModalService, assetNodeService: AssetNodeService, assetType: AssetTypesRealtimeService, deviceListExtensionService: DeviceListExtensionService, moduleConfig: SubAssetsConfig)
|
||||||||||||||||||||||||||||||
Parameters :
|
group |
Type : IManagedObject
|
groupChange |
Type : EventEmitter
|
isSmartGroup |
isSmartGroup()
|
Returns :
any
|
Async ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
any
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
Async update | ||||||
update(partialGroup: Partial
|
||||||
Parameters :
Returns :
any
|
canEdit |
Type : boolean
|
columnsWithFilter |
Type : Column[]
|
filterMsg |
Default value : gettext(
'Smart groups are groups dynamically constructed based on filtering criteria.'
)
|
groupIcon |
Type : string
|
groupInfoModel |
Type : literal type
|
Default value : {
name: '',
c8y_Notes: ''
}
|
label |
Type : string
|
Public moduleConfig |
Type : SubAssetsConfig
|
Decorators :
@Inject(SUB_ASSETS_CONFIG)
|
PRODUCT_EXPERIENCE |
Default value : PRODUCT_EXPERIENCE_SUB_ASSETS_SHARED
|
smartGroupFilter |
Type : string
|
<div class="bg-level-1 separator-bottom">
<div class="card-block p-t-24 p-b-24 large-padding">
<div class="content-flex-70">
<div class="text-center col-1">
<i
class="c8y-icon-duocolor icon-48"
[c8yIcon]="groupIcon"
></i>
<p>
<small
class="label label-info"
*ngIf="group.c8y_IsDynamicGroup"
>
{{ 'Smart group' | translate }}
</small>
<small
class="label label-info text-truncate d-inline-block"
title="{{ label | translate }}"
*ngIf="!group.c8y_IsDynamicGroup && !group.com_cumulocity_model_Agent"
>
{{ label | translate }}
</small>
<small
class="label label-info"
*ngIf="group.com_cumulocity_model_Agent"
>
{{ 'Remote group' | translate }}
</small>
</p>
</div>
<div class="flex-grow col-10">
<div class="content-flex-80">
<div class="col-9">
<form #groupNameForm="ngForm">
<c8y-form-group class="form-group-lg m-b-0">
<label
class="sr-only"
for="groupName"
translate
>
Name
</label>
<p
class="form-control-static"
*ngIf="!canEdit"
>
{{ groupInfoModel.name }}
</p>
<div
class="input-group input-group-lg input-group-editable"
*ngIf="canEdit"
>
<input
class="form-control"
title="{{ groupInfoModel.name }}"
id="groupName"
placeholder="{{ 'e.g. My group' | translate }}"
name="name"
type="text"
required
[(ngModel)]="groupInfoModel.name"
size="{{ groupInfoModel.name.length + 2 }}"
maxlength="254"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.GROUP_INFO.COMPONENTS.GROUP_INFO,
action: PRODUCT_EXPERIENCE.GROUP_INFO.ACTIONS.EDIT,
property: PRODUCT_EXPERIENCE.GROUP_INFO.PROPERTIES.NAME
}"
/>
<span></span>
<div class="input-group-btn">
<button
class="btn btn-primary"
title="{{ 'Save' | translate }}"
type="submit"
[disabled]="groupNameForm.form.invalid"
(click)="
update({ name: groupInfoModel.name }); groupNameForm.form.markAsPristine()
"
[actionName]="'groupInfo:EditedNameSaved'"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.GROUP_INFO.COMPONENTS.GROUP_INFO,
result: PRODUCT_EXPERIENCE.GROUP_INFO.RESULTS.EDIT_SAVED,
property: PRODUCT_EXPERIENCE.GROUP_INFO.PROPERTIES.NAME
}"
>
{{ 'Save' | translate }}
</button>
</div>
</div>
</c8y-form-group>
</form>
<form #groupDescriptionForm="ngForm">
<label
class="sr-only"
for="description"
translate
>
Description
</label>
<p
class="form-control-static"
*ngIf="!canEdit"
>
{{ groupInfoModel.c8y_Notes }}
</p>
<div
class="input-group input-group-editable"
*ngIf="canEdit"
>
<textarea
class="form-control no-resize"
title="{{
groupInfoModel.c8y_Notes
? groupInfoModel.c8y_Notes
: ('e.g. My description' | translate)
}}"
id="description"
placeholder="{{ 'e.g. My description' | translate }}"
name="description"
c8y-textarea-autoresize
[(ngModel)]="groupInfoModel.c8y_Notes"
cols="{{ groupInfoModel.c8y_Notes ? groupInfoModel.c8y_Notes.length : 25 }}"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.GROUP_INFO.COMPONENTS.GROUP_INFO,
action: PRODUCT_EXPERIENCE.GROUP_INFO.ACTIONS.EDIT,
property: PRODUCT_EXPERIENCE.GROUP_INFO.PROPERTIES.DESCRIPTION
}"
></textarea>
<span></span>
<div class="input-group-btn">
<button
class="btn btn-primary"
title="{{ 'Save' | translate }}"
type="submit"
[disabled]="groupDescriptionForm.form.invalid"
(click)="
update({ c8y_Notes: groupInfoModel.c8y_Notes });
groupDescriptionForm.form.markAsPristine()
"
c8yProductExperience
[actionName]="PRODUCT_EXPERIENCE.EVENT"
[actionData]="{
component: PRODUCT_EXPERIENCE.GROUP_INFO.COMPONENTS.GROUP_INFO,
result: PRODUCT_EXPERIENCE.GROUP_INFO.RESULTS.EDIT_SAVED,
property: PRODUCT_EXPERIENCE.GROUP_INFO.PROPERTIES.DESCRIPTION
}"
>
{{ 'Save' | translate }}
</button>
</div>
</div>
</form>
<div
class="dropdown m-t-8"
placement="bottom left"
container="body"
type="button"
dropdown
*ngIf="isSmartGroup()"
#ddFilters="bs-dropdown"
[insideClick]="true"
>
<button
class="btn btn-default btn-sm"
title="{{ 'Smart group filters' | translate }}"
aria-haspopup="true"
dropdownToggle
data-cy="c8y-data-grid--filters"
[disabled]="columnsWithFilter?.length === 0"
>
<i
class="m-r-4"
c8yIcon="filter"
></i>
<span>{{ 'Smart group filters' | translate }}</span>
<span
class="p-relative p-l-4 p-r-16"
*ngIf="columnsWithFilter?.length > 0"
>
<span class="badge badge-system p-absolute" data-cy="group-info--filter-number">
{{ columnsWithFilter?.length }}
</span>
</span>
</button>
<button
class="btn-help btn-help--sm m-r-4"
[attr.aria-label]="'Help' | translate"
popover="{{ filterMsg | translate }}"
placement="right"
triggers="focus"
data-cy="group-info--help-button"
container="body"
type="button"
></button>
<div
class="dropdown-menu"
*dropdownMenu
(click)="$event.stopPropagation()"
>
<div class="data-grid__dropdown bg-level-0">
<ul class="list-unstyled m-0">
<li
*ngFor="let column of columnsWithFilter; let last = last"
[ngClass]="{ 'separator-bottom': !last }"
>
<ng-container>
<div
class="dropdown-header sticky-top text-truncate no-border-top p-b-0"
title="{{ (column.header | translate) || column.name }}"
>
<label>
{{ (column.header | translate) || column.name }}
</label>
</div>
<div
class="list-group-item borderless d-flex d-col"
*ngFor="
let groupedFilterChips of column
| mapToFilterChips
| async
| groupedFilterChips;
let first = first
"
[ngClass]="{ 'p-t-0': first }"
>
<p
class="small p-b-4"
*ngIf="groupedFilterChips.label"
>
{{ groupedFilterChips.label | translate }}
</p>
<div class="d-flex a-i-center gap-4 flex-wrap">
<span
class="tag tag--info chip"
data-cy="group-info--grouped-filter-chip"
*ngFor="let chip of groupedFilterChips.chips"
>
{{ chip.displayValue | translate }}
</span>
</div>
</div>
</ng-container>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="flex-grow">
<ul class="list-unstyled small">
<li class="p-t-4 p-b-4 d-flex separator-top-bottom text-nowrap">
<label class="small m-b-0 m-r-8">{{ 'Created' | translate }}</label>
<span class="m-l-auto">{{ group.creationTime | c8yDate }}</span>
</li>
<li class="p-t-4 p-b-4 d-flex separator-bottom text-nowrap">
<label class="small m-b-0 m-r-8">{{ 'Last updated' | translate }}</label>
<span class="m-l-auto">{{ group.lastUpdated | c8yDate }}</span>
</li>
<li
class="p-t-4 p-b-4 d-flex separator-bottom text-nowrap"
*ngIf="group.com_cumulocity_model_Agent"
>
<label class="small m-b-0 m-r-8">{{ 'Status' | translate }}</label>
<span
class="m-l-auto"
*ngIf="group.c8y_BrokerSource"
>
{{ group.c8y_BrokerSource.status }}
</span>
<span
class="m-l-auto"
*ngIf="!group.c8y_BrokerSource"
>
{{ 'Offline' | translate }}
</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>