Commit f1b58a9df16d63be44576ea6e966d6d9c14261df

Authored by Artem Babak
1 parent 716ed83d

Fixed and refactored customer edges

... ... @@ -27,6 +27,7 @@ import { DashboardsTableConfigResolver } from '@modules/home/pages/dashboard/das
27 27 import { DashboardPageComponent } from '@home/pages/dashboard/dashboard-page.component';
28 28 import { BreadCrumbConfig } from '@shared/components/breadcrumb';
29 29 import { dashboardBreadcumbLabelFunction, DashboardResolver } from '@home/pages/dashboard/dashboard-routing.module';
  30 +import {EdgesTableConfigResolver} from "@home/pages/edge/edges-table-config.resolver";
30 31
31 32 const routes: Routes = [
32 33 {
... ... @@ -97,6 +98,22 @@ const routes: Routes = [
97 98 }
98 99 },
99 100 {
  101 + path: ':customerId/edges',
  102 + component: EntitiesTableComponent,
  103 + data: {
  104 + auth: [Authority.TENANT_ADMIN],
  105 + title: 'customer.edges',
  106 + edgesType: 'customer',
  107 + breadcrumb: {
  108 + label: 'customer.edges',
  109 + icon: 'router'
  110 + }
  111 + },
  112 + resolve: {
  113 + entitiesTableConfig: EdgesTableConfigResolver
  114 + }
  115 + },
  116 + {
100 117 path: ':customerId/dashboards',
101 118 data: {
102 119 breadcrumb: {
... ...
... ... @@ -95,7 +95,18 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C
95 95 icon: 'dashboard',
96 96 isEnabled: (customer) => true,
97 97 onAction: ($event, entity) => this.manageCustomerDashboards($event, entity)
98   - }
  98 + },
  99 + {
  100 + name: this.translate.instant('customer.manage-customer-edges'),
  101 + nameFunction: (customer) => {
  102 + return customer.additionalInfo && customer.additionalInfo.isPublic
  103 + ? this.translate.instant('customer.manage-public-edges')
  104 + : this.translate.instant('customer.manage-customer-edges');
  105 + },
  106 + icon: 'router',
  107 + isEnabled: (customer) => true,
  108 + onAction: ($event, entity) => this.manageCustomerEdges($event, entity)
  109 + },
99 110 );
100 111
101 112 this.config.deleteEntityTitle = customer => this.translate.instant('customer.delete-customer-title', { customerTitle: customer.title });
... ... @@ -147,6 +158,13 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C
147 158 this.router.navigateByUrl(`customers/${customer.id.id}/dashboards`);
148 159 }
149 160
  161 + manageCustomerEdges($event: Event, customer: Customer) {
  162 + if ($event) {
  163 + $event.stopPropagation();
  164 + }
  165 + this.router.navigateByUrl(`customers/${customer.id.id}/edges`);
  166 + }
  167 +
150 168 onCustomerAction(action: EntityAction<Customer>): boolean {
151 169 switch (action.action) {
152 170 case 'manageUsers':
... ...
... ... @@ -40,7 +40,7 @@ const routes: Routes = [
40 40 component: EntitiesTableComponent,
41 41 data: {
42 42 auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
43   - edgeScope: 'tenant'
  43 + edgesType: 'tenant'
44 44 },
45 45 resolve: {
46 46 entitiesTableConfig: EdgesTableConfigResolver
... ...
... ... @@ -107,7 +107,7 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
107 107 resolve(route: ActivatedRouteSnapshot): Observable<EntityTableConfig<EdgeInfo>> {
108 108 const routeParams = route.params;
109 109 this.config.componentsData = {
110   - edgeScope: route.data.edgeScope,
  110 + edgeScope: route.data.edgesType,
111 111 edgeType: ''
112 112 };
113 113 this.customerId = routeParams.customerId;
... ...
... ... @@ -36,7 +36,6 @@ export interface Edge extends BaseData<EdgeId> {
36 36 export interface EdgeInfo extends Edge {
37 37 customerTitle: string;
38 38 customerIsPublic: boolean;
39   - // assignedCustomers?: Array<ShortCustomerInfo> //TODO: deaflynx check usage
40 39 }
41 40
42 41 export interface EdgeSearchQuery extends EntitySearchQuery {
... ...
... ... @@ -422,6 +422,7 @@
422 422 "devices": "Customer Devices",
423 423 "entity-views": "Customer Entity Views",
424 424 "assets": "Customer Assets",
  425 + "edges": "Customer Edges",
425 426 "public-dashboards": "Public Dashboards",
426 427 "public-devices": "Public Devices",
427 428 "public-assets": "Public Assets",
... ... @@ -436,6 +437,8 @@
436 437 "manage-public-dashboards": "Manage public dashboards",
437 438 "manage-customer-assets": "Manage customer assets",
438 439 "manage-public-assets": "Manage public assets",
  440 + "manage-customer-edges": "Manage customer edges",
  441 + "manage-public-edges": "Manage customer edges",
439 442 "add-customer-text": "Add new customer",
440 443 "no-customers-text": "No customers found",
441 444 "customer-details": "Customer details",
... ... @@ -446,6 +449,7 @@
446 449 "delete-customers-text": "Be careful, after the confirmation all selected customers will be removed and all related data will become unrecoverable.",
447 450 "manage-users": "Manage users",
448 451 "manage-assets": "Manage assets",
  452 + "manage-edges": "Manage edges",
449 453 "manage-devices": "Manage devices",
450 454 "manage-dashboards": "Manage dashboards",
451 455 "title": "Title",
... ... @@ -980,7 +984,9 @@
980 984 "set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }",
981 985 "status": "Received by edge",
982 986 "success": "Deployed",
983   - "failed": "Pending"
  987 + "failed": "Pending",
  988 + "search": "Search edges",
  989 + "selected-edges": "{ count, plural, 1 {1 edge} other {# edges} } selected"
984 990 },
985 991 "error": {
986 992 "unable-to-connect": "Unable to connect to the server! Please check your internet connection.",
... ...