Browse Source

Fixed group chips overflow in entity tables and moved Manage agents to customer details panel (#16266)

* Fixed group chips overflow in entity tables and moved Manage agents to customer details panel

* Fixed license headers
pull/16270/head
Maksym Tsymbarov 2 months ago
committed by GitHub
parent
commit
efdeafd04d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ui-ngx/src/app/modules/home/components/entity/entity-chips.component.html
  2. 6
      ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss
  3. 8
      ui-ngx/src/app/modules/home/pages/customer/customer.component.html
  4. 4
      ui-ngx/src/app/modules/home/pages/customer/customer.component.ts
  5. 10
      ui-ngx/src/app/modules/home/pages/customer/customers-table-config.resolver.ts
  6. 4
      ui-ngx/src/assets/locale/locale.constant-en_US.json

5
ui-ngx/src/app/modules/home/components/entity/entity-chips.component.html

@ -1,11 +1,12 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
@for (subEntity of subEntities; track subEntity) {
<a class="tb-entity-chip"
<a class="tb-entity-chip" [tbTruncateWithTooltip]="subEntity.name | customTranslate"
routerLink="{{entityDetailsPrefixUrl}}/{{subEntity.id.id}}" (click)="$event.stopPropagation();">
{{ subEntity.name | customTranslate }}
</a>

6
ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss

@ -1,11 +1,15 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
:host {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 4px 0;
width: 0;
min-width: 100%;
a.tb-entity-chip {
max-width: 100%;
padding: 4px 8px;
border-radius: 12px;
line-height: 16px;

8
ui-ngx/src/app/modules/home/pages/customer/customer.component.html

@ -60,6 +60,14 @@
{{'customer.manage-edges' | translate }}
</button>
}
@if (resource.AGENT | hasGenericPermission: operation.READ) {
<button mat-stroked-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'manageAgents')"
[class.!hidden]="hideManageAgents() || isEdit">
{{'customer.manage-agents' | translate }}
</button>
}
@if (resource.DASHBOARD | hasGenericPermission: operation.READ) {
<button mat-stroked-button color="primary"
[disabled]="(isLoading$ | async)"

4
ui-ngx/src/app/modules/home/pages/customer/customer.component.ts

@ -103,6 +103,10 @@ export class CustomerComponent extends GroupContactBasedComponent<CustomerInfo>
}
}
hideManageAgents() {
return this.isGroupMode();
}
hideManageDashboards() {
if (this.isGroupMode()) {
return !this.groupEntitiesTableConfig.manageDashboardsEnabled(this.entity);

10
ui-ngx/src/app/modules/home/pages/customer/customers-table-config.resolver.ts

@ -208,16 +208,6 @@ export class CustomersTableConfigResolver {
}
);
}
if (this.userPermissionsService.hasGenericPermission(Resource.AGENT, Operation.READ)) {
actions.push(
{
name: this.translate.instant('customer.manage-customer-agents'),
icon: 'memory',
isEnabled: (customer) => true,
onAction: ($event, entity) => this.manageCustomerAgents($event, entity, config)
}
);
}
if (this.userPermissionsService.hasGenericPermission(Resource.DASHBOARD, Operation.READ)) {
actions.push(
{

4
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2175,7 +2175,6 @@
"manage-public-dashboards": "Manage public dashboards",
"manage-customer-assets": "Manage customer assets",
"manage-customer-edges": "Manage customer edges",
"manage-customer-agents": "Manage agents",
"manage-public-assets": "Manage public assets",
"add-customer-text": "Add new customer",
"no-customers-text": "No customers found",
@ -2220,7 +2219,8 @@
"search": "Search customers",
"selected-customers": "{ count, plural, =1 {1 customer} other {# customers} } selected",
"edges": "Customer edge instances",
"manage-edges": "Manage edges"
"manage-edges": "Manage edges",
"manage-agents": "Manage agents"
},
"customers-hierarchy": {
"customers-hierarchy": "Customers hierarchy",

Loading…
Cancel
Save