Browse Source

Added description to the device card. Allows viewing of the description of a device or more importantly can have a friendly name showing on the device card instead of a long unique mac id.

pull/875/head
steve 8 years ago
committed by Andrew Shvayka
parent
commit
0546cb1e85
  1. 2
      ui/src/app/api/alias-controller.js
  2. 2
      ui/src/app/api/entity.service.js
  3. 3
      ui/src/app/device/device-card.tpl.html

2
ui/src/app/api/alias-controller.js

@ -146,6 +146,7 @@ export default class AliasController {
newDatasource.entityId = resolvedEntity.id; newDatasource.entityId = resolvedEntity.id;
newDatasource.entityType = resolvedEntity.entityType; newDatasource.entityType = resolvedEntity.entityType;
newDatasource.entityName = resolvedEntity.name; newDatasource.entityName = resolvedEntity.name;
newDatasource.entityDescription = resolvedEntity.entityDescription
newDatasource.name = resolvedEntity.name; newDatasource.name = resolvedEntity.name;
newDatasource.generated = i > 0 ? true : false; newDatasource.generated = i > 0 ? true : false;
datasources.push(newDatasource); datasources.push(newDatasource);
@ -167,6 +168,7 @@ export default class AliasController {
datasource.entityType = entity.entityType; datasource.entityType = entity.entityType;
datasource.entityName = entity.name; datasource.entityName = entity.name;
datasource.name = entity.name; datasource.name = entity.name;
datasource.entityDescription = entity.entityDescription;
deferred.resolve([datasource]); deferred.resolve([datasource]);
} else { } else {
if (aliasInfo.stateEntity) { if (aliasInfo.stateEntity) {

2
ui/src/app/api/entity.service.js

@ -329,7 +329,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
} }
function entityToEntityInfo(entity) { function entityToEntityInfo(entity) {
return { name: entity.name, entityType: entity.id.entityType, id: entity.id.id }; return { name: entity.name, entityType: entity.id.entityType, id: entity.id.id, entityDescription: entity.additionalInfo?entity.additionalInfo.description:"" };
} }
function entityRelationInfoToEntityInfo(entityRelationInfo, direction) { function entityRelationInfoToEntityInfo(entityRelationInfo, direction) {

3
ui/src/app/device/device-card.tpl.html

@ -16,7 +16,8 @@
--> -->
<div flex layout="column" style="margin-top: -10px;"> <div flex layout="column" style="margin-top: -10px;">
<div style="text-transform: uppercase; padding-bottom: 10px;">{{vm.item.type}}</div> <div flex>{{vm.item.additionalInfo.description}}</div>
<div flex style="text-transform: uppercase; padding-bottom: 10px;">{{vm.item.type}}</div>
<div class="tb-small" ng-show="vm.isAssignedToCustomer()">{{'device.assignedToCustomer' | translate}} '{{vm.item.assignedCustomer.title}}'</div> <div class="tb-small" ng-show="vm.isAssignedToCustomer()">{{'device.assignedToCustomer' | translate}} '{{vm.item.assignedCustomer.title}}'</div>
<div class="tb-small" ng-show="vm.isPublic()">{{'device.public' | translate}}</div> <div class="tb-small" ng-show="vm.isPublic()">{{'device.public' | translate}}</div>
</div> </div>

Loading…
Cancel
Save