-device.assignedToCustomer
+{{'device.assignedToCustomer' | translate}} '{{vm.customerTitle}}'
diff --git a/ui/src/app/device/device.controller.js b/ui/src/app/device/device.controller.js
index d111df8acb..4a054e2896 100644
--- a/ui/src/app/device/device.controller.js
+++ b/ui/src/app/device/device.controller.js
@@ -24,7 +24,36 @@ import deviceCredentialsTemplate from './device-credentials.tpl.html';
/* eslint-enable import/no-unresolved, import/default */
/*@ngInject*/
-export default function DeviceController(userService, deviceService, customerService, $scope, $controller, $state, $stateParams, $document, $mdDialog, $q, $translate, types) {
+export function DeviceCardController($scope, types, customerService) {
+
+ var vm = this;
+
+ vm.types = types;
+
+ vm.isAssignedToCustomer = function() {
+ if (vm.item && vm.item.customerId && vm.parentCtl.devicesScope === 'tenant',
+ vm.item.customerId.id != vm.types.id.nullUid) {
+ return true;
+ }
+ return false;
+ }
+
+ $scope.$watch('vm.item',
+ function() {
+ if (vm.item && vm.item.customerId && vm.item.customerId.id != vm.types.id.nullUid) {
+ customerService.getCustomerTitle(vm.item.customerId.id).then(
+ function success(title) {
+ vm.customerTitle = title;
+ }
+ );
+ }
+ }
+ );
+}
+
+
+/*@ngInject*/
+export function DeviceController(userService, deviceService, customerService, $scope, $controller, $state, $stateParams, $document, $mdDialog, $q, $translate, types) {
var customerId = $stateParams.customerId;
@@ -47,6 +76,7 @@ export default function DeviceController(userService, deviceService, customerSer
getItemTitleFunc: getDeviceTitle,
+ itemCardController: 'DeviceCardController',
itemCardTemplateUrl: deviceCard,
parentCtl: vm,
diff --git a/ui/src/app/device/index.js b/ui/src/app/device/index.js
index 611e664837..b84497aa21 100644
--- a/ui/src/app/device/index.js
+++ b/ui/src/app/device/index.js
@@ -21,7 +21,7 @@ import thingsboardApiDevice from '../api/device.service';
import thingsboardApiCustomer from '../api/customer.service';
import DeviceRoutes from './device.routes';
-import DeviceController from './device.controller';
+import {DeviceController, DeviceCardController} from './device.controller';
import AssignDeviceToCustomerController from './assign-to-customer.controller';
import AddDevicesToCustomerController from './add-devices-to-customer.controller';
import ManageDeviceCredentialsController from './device-credentials.controller';
@@ -40,6 +40,7 @@ export default angular.module('thingsboard.device', [
])
.config(DeviceRoutes)
.controller('DeviceController', DeviceController)
+ .controller('DeviceCardController', DeviceCardController)
.controller('AssignDeviceToCustomerController', AssignDeviceToCustomerController)
.controller('AddDevicesToCustomerController', AddDevicesToCustomerController)
.controller('ManageDeviceCredentialsController', ManageDeviceCredentialsController)