Commit 82e4968d90a5040a490d97bfe026a0f0386aa2c1
Committed by
GitHub
Merge pull request #42 from deaflynx/feature/edge
Added manage customer edges
Showing
6 changed files
with
51 additions
and
0 deletions
@@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
19 | <md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button> | 19 | <md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button> |
20 | <md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button> | 20 | <md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button> |
21 | <md-button ng-click="onManageDashboards({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-dashboards' | translate }}</md-button> | 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 | <md-button ng-click="onDeleteCustomer({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.delete' | translate }}</md-button> | 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 | <div layout="row"> | 25 | <div layout="row"> |
@@ -79,6 +79,20 @@ export default function CustomerController(customerService, $state, $stateParams | @@ -79,6 +79,20 @@ export default function CustomerController(customerService, $state, $stateParams | ||
79 | }, | 79 | }, |
80 | { | 80 | { |
81 | onAction: function ($event, item) { | 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 | vm.grid.deleteItem($event, item); | 96 | vm.grid.deleteItem($event, item); |
83 | }, | 97 | }, |
84 | name: function() { return $translate.instant('action.delete') }, | 98 | name: function() { return $translate.instant('action.delete') }, |
@@ -147,6 +161,7 @@ export default function CustomerController(customerService, $state, $stateParams | @@ -147,6 +161,7 @@ export default function CustomerController(customerService, $state, $stateParams | ||
147 | vm.openCustomerAssets = openCustomerAssets; | 161 | vm.openCustomerAssets = openCustomerAssets; |
148 | vm.openCustomerDevices = openCustomerDevices; | 162 | vm.openCustomerDevices = openCustomerDevices; |
149 | vm.openCustomerDashboards = openCustomerDashboards; | 163 | vm.openCustomerDashboards = openCustomerDashboards; |
164 | + vm.openCustomerEdges = openCustomerEdges; | ||
150 | 165 | ||
151 | function deleteCustomerTitle(customer) { | 166 | function deleteCustomerTitle(customer) { |
152 | return $translate.instant('customer.delete-customer-title', {customerTitle: customer.title}); | 167 | return $translate.instant('customer.delete-customer-title', {customerTitle: customer.title}); |
@@ -216,4 +231,11 @@ export default function CustomerController(customerService, $state, $stateParams | @@ -216,4 +231,11 @@ export default function CustomerController(customerService, $state, $stateParams | ||
216 | $state.go('home.customers.dashboards', {customerId: customer.id.id}); | 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,6 +55,7 @@ export default function CustomerDirective($compile, $templateCache, $translate, | ||
55 | onManageAssets: '&', | 55 | onManageAssets: '&', |
56 | onManageDevices: '&', | 56 | onManageDevices: '&', |
57 | onManageDashboards: '&', | 57 | onManageDashboards: '&', |
58 | + onManageEdges: '&', | ||
58 | onDeleteCustomer: '&' | 59 | onDeleteCustomer: '&' |
59 | } | 60 | } |
60 | }; | 61 | }; |
@@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
29 | on-manage-assets="vm.openCustomerAssets(event, vm.grid.detailsConfig.currentItem)" | 29 | on-manage-assets="vm.openCustomerAssets(event, vm.grid.detailsConfig.currentItem)" |
30 | on-manage-devices="vm.openCustomerDevices(event, vm.grid.detailsConfig.currentItem)" | 30 | on-manage-devices="vm.openCustomerDevices(event, vm.grid.detailsConfig.currentItem)" |
31 | on-manage-dashboards="vm.openCustomerDashboards(event, vm.grid.detailsConfig.currentItem)" | 31 | on-manage-dashboards="vm.openCustomerDashboards(event, vm.grid.detailsConfig.currentItem)" |
32 | + on-manage-edges="vm.openCustomerEdges(event, vm.grid.detailsConfig.currentItem)" | ||
32 | on-delete-customer="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-customer> | 33 | on-delete-customer="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-customer> |
33 | </md-tab> | 34 | </md-tab> |
34 | <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'attribute.attributes' | translate }}"> | 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,5 +161,28 @@ export default function EdgeRoutes($stateProvider, types) { | ||
161 | ncyBreadcrumb: { | 161 | ncyBreadcrumb: { |
162 | label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}' | 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,6 +441,7 @@ | ||
441 | "manage-assets": "Manage assets", | 441 | "manage-assets": "Manage assets", |
442 | "manage-devices": "Manage devices", | 442 | "manage-devices": "Manage devices", |
443 | "manage-dashboards": "Manage dashboards", | 443 | "manage-dashboards": "Manage dashboards", |
444 | + "manage-edges": "Manage edges", | ||
444 | "title": "Title", | 445 | "title": "Title", |
445 | "title-required": "Title is required.", | 446 | "title-required": "Title is required.", |
446 | "description": "Description", | 447 | "description": "Description", |
@@ -812,6 +813,8 @@ | @@ -812,6 +813,8 @@ | ||
812 | "assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer", | 813 | "assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer", |
813 | "unassign-edge-title": "Are you sure you want to unassign the edge '{{edgeName}}'?", | 814 | "unassign-edge-title": "Are you sure you want to unassign the edge '{{edgeName}}'?", |
814 | "unassign-edge-text": "After the confirmation the edge will be unassigned and won't be accessible by the customer.", | 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 | "make-public": "Make edge public", | 818 | "make-public": "Make edge public", |
816 | "make-public-edge-title": "Are you sure you want to make the edge '{{edgeName}}' public?", | 819 | "make-public-edge-title": "Are you sure you want to make the edge '{{edgeName}}' public?", |
817 | "make-public-edge-text": "After the confirmation the edge and all its data will be made public and accessible by others.", | 820 | "make-public-edge-text": "After the confirmation the edge and all its data will be made public and accessible by others.", |