Added manage customer edges

This commit is contained in:
deaflynx 2020-08-27 11:05:13 +03:00
parent 4ac8c0675b
commit aeaf2ed6c6
6 changed files with 51 additions and 0 deletions

View File

@ -19,6 +19,7 @@
<md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button> <md-button ng-click="onManageAssets({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-assets' | translate }}</md-button>
<md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button> <md-button ng-click="onManageDevices({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-devices' | translate }}</md-button>
<md-button ng-click="onManageDashboards({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-dashboards' | translate }}</md-button> <md-button ng-click="onManageDashboards({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'customer.manage-dashboards' | translate }}</md-button>
<md-button ng-click="onManageEdges({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.manage-edges' | translate }}</md-button>
<md-button ng-click="onDeleteCustomer({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.delete' | translate }}</md-button> <md-button ng-click="onDeleteCustomer({event: $event})" ng-show="!isEdit && !isPublic" class="md-raised md-primary">{{ 'customer.delete' | translate }}</md-button>
<div layout="row"> <div layout="row">

View File

@ -77,6 +77,20 @@ export default function CustomerController(customerService, $state, $stateParams
}, },
icon: "dashboard" icon: "dashboard"
}, },
{
onAction: function ($event, item) {
openCustomerEdges($event, item);
},
name: function() { return $translate.instant('edge.edges') },
details: function(customer) {
if (customer && customer.additionalInfo && customer.additionalInfo.isPublic) {
return $translate.instant('customer.manage-public-edges')
} else {
return $translate.instant('customer.manage-customer-edges')
}
},
icon: "router"
},
{ {
onAction: function ($event, item) { onAction: function ($event, item) {
vm.grid.deleteItem($event, item); vm.grid.deleteItem($event, item);
@ -147,6 +161,7 @@ export default function CustomerController(customerService, $state, $stateParams
vm.openCustomerAssets = openCustomerAssets; vm.openCustomerAssets = openCustomerAssets;
vm.openCustomerDevices = openCustomerDevices; vm.openCustomerDevices = openCustomerDevices;
vm.openCustomerDashboards = openCustomerDashboards; vm.openCustomerDashboards = openCustomerDashboards;
vm.openCustomerEdges = openCustomerEdges;
function deleteCustomerTitle(customer) { function deleteCustomerTitle(customer) {
return $translate.instant('customer.delete-customer-title', {customerTitle: customer.title}); return $translate.instant('customer.delete-customer-title', {customerTitle: customer.title});
@ -216,4 +231,11 @@ export default function CustomerController(customerService, $state, $stateParams
$state.go('home.customers.dashboards', {customerId: customer.id.id}); $state.go('home.customers.dashboards', {customerId: customer.id.id});
} }
function openCustomerEdges($event, customer) {
if ($event) {
$event.stopPropagation();
}
$state.go('home.customers.edges', {customerId: customer.id.id});
}
} }

View File

@ -55,6 +55,7 @@ export default function CustomerDirective($compile, $templateCache, $translate,
onManageAssets: '&', onManageAssets: '&',
onManageDevices: '&', onManageDevices: '&',
onManageDashboards: '&', onManageDashboards: '&',
onManageEdges: '&',
onDeleteCustomer: '&' onDeleteCustomer: '&'
} }
}; };

View File

@ -29,6 +29,7 @@
on-manage-assets="vm.openCustomerAssets(event, vm.grid.detailsConfig.currentItem)" on-manage-assets="vm.openCustomerAssets(event, vm.grid.detailsConfig.currentItem)"
on-manage-devices="vm.openCustomerDevices(event, vm.grid.detailsConfig.currentItem)" on-manage-devices="vm.openCustomerDevices(event, vm.grid.detailsConfig.currentItem)"
on-manage-dashboards="vm.openCustomerDashboards(event, vm.grid.detailsConfig.currentItem)" on-manage-dashboards="vm.openCustomerDashboards(event, vm.grid.detailsConfig.currentItem)"
on-manage-edges="vm.openCustomerEdges(event, vm.grid.detailsConfig.currentItem)"
on-delete-customer="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-customer> on-delete-customer="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-customer>
</md-tab> </md-tab>
<md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'attribute.attributes' | translate }}"> <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'attribute.attributes' | translate }}">

View File

@ -161,5 +161,28 @@ export default function EdgeRoutes($stateProvider, types) {
ncyBreadcrumb: { ncyBreadcrumb: {
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}' label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
} }
})
.state('home.customers.edges', {
url: '/:customerId/edges',
params: {'topIndex': 0},
module: 'private',
auth: ['TENANT_ADMIN'],
views: {
"content@home": {
templateUrl: edgesTemplate,
controllerAs: 'vm',
controller: 'EdgeController'
}
},
data: {
edgesType: 'customer',
searchEnabled: true,
searchByEntitySubtype: true,
searchEntityType: types.entityType.edge,
pageTitle: 'customer.edges'
},
ncyBreadcrumb: {
label: '{"icon": "router", "label": "{{ vm.customerEdgesTitle }}", "translate": "false"}'
}
}); });
} }

View File

@ -441,6 +441,7 @@
"manage-assets": "Manage assets", "manage-assets": "Manage assets",
"manage-devices": "Manage devices", "manage-devices": "Manage devices",
"manage-dashboards": "Manage dashboards", "manage-dashboards": "Manage dashboards",
"manage-edges": "Manage edges",
"title": "Title", "title": "Title",
"title-required": "Title is required.", "title-required": "Title is required.",
"description": "Description", "description": "Description",
@ -812,6 +813,8 @@
"assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer", "assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer",
"unassign-edge-title": "Are you sure you want to unassign the edge '{{edgeName}}'?", "unassign-edge-title": "Are you sure you want to unassign the edge '{{edgeName}}'?",
"unassign-edge-text": "After the confirmation the edge will be unassigned and won't be accessible by the customer.", "unassign-edge-text": "After the confirmation the edge will be unassigned and won't be accessible by the customer.",
"unassign-edges-title": "Are you sure you want to unassign { count, plural, 1 {1 edge} other {# edges} }?",
"unassign-edges-text": "After the confirmation all selected edges will be unassigned and won't be accessible by the customer.",
"make-public": "Make edge public", "make-public": "Make edge public",
"make-public-edge-title": "Are you sure you want to make the edge '{{edgeName}}' public?", "make-public-edge-title": "Are you sure you want to make the edge '{{edgeName}}' public?",
"make-public-edge-text": "After the confirmation the edge and all its data will be made public and accessible by others.", "make-public-edge-text": "After the confirmation the edge and all its data will be made public and accessible by others.",