Commit aeaf2ed6c6f167ae37b5eca22d3a41cdd08663d6

Authored by deaflynx
1 parent 4ac8c067

Added manage customer edges

... ... @@ -19,6 +19,7 @@
19 19 <md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button>
20 20 <md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button>
21 21 <md-button ng-click="onManageDashboards({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-dashboards' | translate }}</md-button>
  22 +<md-button ng-click="onManageEdges({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-edges' | translate }}</md-button>
22 23 <md-button ng-click="onDeleteCustomer({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.delete' | translate }}</md-button>
23 24
24 25 <div layout="row">
... ...
... ... @@ -79,6 +79,20 @@ export default function CustomerController(customerService, $state, $stateParams
79 79 },
80 80 {
81 81 onAction: function ($event, item) {
  82 + openCustomerEdges($event, item);
  83 + },
  84 + name: function() { return $translate.instant('edge.edges') },
  85 + details: function(customer) {
  86 + if (customer && customer.additionalInfo && customer.additionalInfo.isPublic) {
  87 + return $translate.instant('customer.manage-public-edges')
  88 + } else {
  89 + return $translate.instant('customer.manage-customer-edges')
  90 + }
  91 + },
  92 + icon: "router"
  93 + },
  94 + {
  95 + onAction: function ($event, item) {
82 96 vm.grid.deleteItem($event, item);
83 97 },
84 98 name: function() { return $translate.instant('action.delete') },
... ... @@ -147,6 +161,7 @@ export default function CustomerController(customerService, $state, $stateParams
147 161 vm.openCustomerAssets = openCustomerAssets;
148 162 vm.openCustomerDevices = openCustomerDevices;
149 163 vm.openCustomerDashboards = openCustomerDashboards;
  164 + vm.openCustomerEdges = openCustomerEdges;
150 165
151 166 function deleteCustomerTitle(customer) {
152 167 return $translate.instant('customer.delete-customer-title', {customerTitle: customer.title});
... ... @@ -216,4 +231,11 @@ export default function CustomerController(customerService, $state, $stateParams
216 231 $state.go('home.customers.dashboards', {customerId: customer.id.id});
217 232 }
218 233
  234 + function openCustomerEdges($event, customer) {
  235 + if ($event) {
  236 + $event.stopPropagation();
  237 + }
  238 + $state.go('home.customers.edges', {customerId: customer.id.id});
  239 + }
  240 +
219 241 }
... ...
... ... @@ -55,6 +55,7 @@ export default function CustomerDirective($compile, $templateCache, $translate,
55 55 onManageAssets: '&',
56 56 onManageDevices: '&',
57 57 onManageDashboards: '&',
  58 + onManageEdges: '&',
58 59 onDeleteCustomer: '&'
59 60 }
60 61 };
... ...
... ... @@ -29,6 +29,7 @@
29 29 on-manage-assets="vm.openCustomerAssets(event, vm.grid.detailsConfig.currentItem)"
30 30 on-manage-devices="vm.openCustomerDevices(event, vm.grid.detailsConfig.currentItem)"
31 31 on-manage-dashboards="vm.openCustomerDashboards(event, vm.grid.detailsConfig.currentItem)"
  32 + on-manage-edges="vm.openCustomerEdges(event, vm.grid.detailsConfig.currentItem)"
32 33 on-delete-customer="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-customer>
33 34 </md-tab>
34 35 <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'attribute.attributes' | translate }}">
... ...
... ... @@ -161,5 +161,28 @@ export default function EdgeRoutes($stateProvider, types) {
161 161 ncyBreadcrumb: {
162 162 label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
163 163 }
  164 + })
  165 + .state('home.customers.edges', {
  166 + url: '/:customerId/edges',
  167 + params: {'topIndex': 0},
  168 + module: 'private',
  169 + auth: ['TENANT_ADMIN'],
  170 + views: {
  171 + "content@home": {
  172 + templateUrl: edgesTemplate,
  173 + controllerAs: 'vm',
  174 + controller: 'EdgeController'
  175 + }
  176 + },
  177 + data: {
  178 + edgesType: 'customer',
  179 + searchEnabled: true,
  180 + searchByEntitySubtype: true,
  181 + searchEntityType: types.entityType.edge,
  182 + pageTitle: 'customer.edges'
  183 + },
  184 + ncyBreadcrumb: {
  185 + label: '{"icon": "router", "label": "{{ vm.customerEdgesTitle }}", "translate": "false"}'
  186 + }
164 187 });
165 188 }
... ...
... ... @@ -441,6 +441,7 @@
441 441 "manage-assets": "Manage assets",
442 442 "manage-devices": "Manage devices",
443 443 "manage-dashboards": "Manage dashboards",
  444 + "manage-edges": "Manage edges",
444 445 "title": "Title",
445 446 "title-required": "Title is required.",
446 447 "description": "Description",
... ... @@ -812,6 +813,8 @@
812 813 "assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer",
813 814 "unassign-edge-title": "Are you sure you want to unassign the edge '{{edgeName}}'?",
814 815 "unassign-edge-text": "After the confirmation the edge will be unassigned and won't be accessible by the customer.",
  816 + "unassign-edges-title": "Are you sure you want to unassign { count, plural, 1 {1 edge} other {# edges} }?",
  817 + "unassign-edges-text": "After the confirmation all selected edges will be unassigned and won't be accessible by the customer.",
815 818 "make-public": "Make edge public",
816 819 "make-public-edge-title": "Are you sure you want to make the edge '{{edgeName}}' public?",
817 820 "make-public-edge-text": "After the confirmation the edge and all its data will be made public and accessible by others.",
... ...