Showing
4 changed files
with
51 additions
and
5 deletions
@@ -156,9 +156,6 @@ function EntityViewService($http, $q, $window, userService, attributeService, cu | @@ -156,9 +156,6 @@ function EntityViewService($http, $q, $window, userService, attributeService, cu | ||
156 | var deferred = $q.defer(); | 156 | var deferred = $q.defer(); |
157 | var url = '/api/entityView'; | 157 | var url = '/api/entityView'; |
158 | 158 | ||
159 | - entityView.keys = {}; | ||
160 | - entityView.keys.timeseries = ['temp']; | ||
161 | - | ||
162 | $http.post(url, entityView).then(function success(response) { | 159 | $http.post(url, entityView).then(function success(response) { |
163 | deferred.resolve(response.data); | 160 | deferred.resolve(response.data); |
164 | }, function fail() { | 161 | }, function fail() { |
@@ -62,6 +62,39 @@ | @@ -62,6 +62,39 @@ | ||
62 | <label translate>entity-view.description</label> | 62 | <label translate>entity-view.description</label> |
63 | <textarea ng-model="entityView.additionalInfo.description" rows="2"></textarea> | 63 | <textarea ng-model="entityView.additionalInfo.description" rows="2"></textarea> |
64 | </md-input-container> | 64 | </md-input-container> |
65 | + <section layout="column"> | ||
66 | + <label translate class="tb-title no-padding">entity-view.client-attributes</label> | ||
67 | + <md-chips style="padding-bottom: 15px;" | ||
68 | + ng-required="false" | ||
69 | + readonly="!isEdit" | ||
70 | + ng-model="entityView.keys.attributes.cs" | ||
71 | + placeholder="{{'entity-view.client-attributes' | translate}}" | ||
72 | + md-separator-keys="separatorKeys"> | ||
73 | + </md-chips> | ||
74 | + <label translate class="tb-title no-padding">entity-view.shared-attributes</label> | ||
75 | + <md-chips style="padding-bottom: 15px;" | ||
76 | + ng-required="false" | ||
77 | + readonly="!isEdit" | ||
78 | + ng-model="entityView.keys.attributes.sh" | ||
79 | + placeholder="{{'entity-view.shared-attributes' | translate}}" | ||
80 | + md-separator-keys="separatorKeys"> | ||
81 | + </md-chips> | ||
82 | + <label translate class="tb-title no-padding">entity-view.server-attributes</label> | ||
83 | + <md-chips style="padding-bottom: 15px;" | ||
84 | + ng-required="false" | ||
85 | + readonly="!isEdit" | ||
86 | + ng-model="entityView.keys.attributes.ss" | ||
87 | + placeholder="{{'entity-view.server-attributes' | translate}}" | ||
88 | + md-separator-keys="separatorKeys"> | ||
89 | + </md-chips> | ||
90 | + <label translate class="tb-title no-padding">entity-view.latest-timeseries</label> | ||
91 | + <md-chips ng-required="false" | ||
92 | + readonly="!isEdit" | ||
93 | + ng-model="entityView.keys.timeseries" | ||
94 | + placeholder="{{'entity-view.latest-timeseries' | translate}}" | ||
95 | + md-separator-keys="separatorKeys"> | ||
96 | + </md-chips> | ||
97 | + </section> | ||
65 | <section layout="row" layout-align="start start"> | 98 | <section layout="row" layout-align="start start"> |
66 | <mdp-date-picker ng-model="startTs" | 99 | <mdp-date-picker ng-model="startTs" |
67 | mdp-max-date="maxStartTs" | 100 | mdp-max-date="maxStartTs" |
@@ -20,7 +20,8 @@ import entityViewFieldsetTemplate from './entity-view-fieldset.tpl.html'; | @@ -20,7 +20,8 @@ import entityViewFieldsetTemplate from './entity-view-fieldset.tpl.html'; | ||
20 | /* eslint-enable import/no-unresolved, import/default */ | 20 | /* eslint-enable import/no-unresolved, import/default */ |
21 | 21 | ||
22 | /*@ngInject*/ | 22 | /*@ngInject*/ |
23 | -export default function EntityViewDirective($compile, $templateCache, $filter, toast, $translate, types, clipboardService, entityViewService, customerService) { | 23 | +export default function EntityViewDirective($compile, $templateCache, $filter, toast, $translate, $mdConstant, |
24 | + types, clipboardService, entityViewService, customerService) { | ||
24 | var linker = function (scope, element) { | 25 | var linker = function (scope, element) { |
25 | var template = $templateCache.get(entityViewFieldsetTemplate); | 26 | var template = $templateCache.get(entityViewFieldsetTemplate); |
26 | element.html(template); | 27 | element.html(template); |
@@ -32,6 +33,9 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t | @@ -32,6 +33,9 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t | ||
32 | 33 | ||
33 | scope.allowedEntityTypes = [types.entityType.device, types.entityType.asset]; | 34 | scope.allowedEntityTypes = [types.entityType.device, types.entityType.asset]; |
34 | 35 | ||
36 | + var semicolon = 186; | ||
37 | + scope.separatorKeys = [$mdConstant.KEY_CODE.ENTER, $mdConstant.KEY_CODE.COMMA, semicolon]; | ||
38 | + | ||
35 | scope.$watch('entityView', function(newVal) { | 39 | scope.$watch('entityView', function(newVal) { |
36 | if (newVal) { | 40 | if (newVal) { |
37 | if (scope.entityView.customerId && scope.entityView.customerId.id !== types.id.nullUid) { | 41 | if (scope.entityView.customerId && scope.entityView.customerId.id !== types.id.nullUid) { |
@@ -49,6 +53,14 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t | @@ -49,6 +53,14 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t | ||
49 | } | 53 | } |
50 | scope.startTs = new Date(scope.entityView.startTs); | 54 | scope.startTs = new Date(scope.entityView.startTs); |
51 | scope.endTs = new Date(scope.entityView.endTs); | 55 | scope.endTs = new Date(scope.entityView.endTs); |
56 | + if (!scope.entityView.keys) { | ||
57 | + scope.entityView.keys = {}; | ||
58 | + scope.entityView.keys.timeseries = []; | ||
59 | + scope.entityView.keys.attributes = {}; | ||
60 | + scope.entityView.keys.attributes.ss = []; | ||
61 | + scope.entityView.keys.attributes.cs = []; | ||
62 | + scope.entityView.keys.attributes.sh = []; | ||
63 | + } | ||
52 | } | 64 | } |
53 | }); | 65 | }); |
54 | 66 |
@@ -828,7 +828,11 @@ | @@ -828,7 +828,11 @@ | ||
828 | "select-entity-view": "Select entity view", | 828 | "select-entity-view": "Select entity view", |
829 | "make-public": "Make entity view public", | 829 | "make-public": "Make entity view public", |
830 | "start-ts": "Start ts", | 830 | "start-ts": "Start ts", |
831 | - "end-ts": "End ts" | 831 | + "end-ts": "End ts", |
832 | + "client-attributes": "Client attributes", | ||
833 | + "shared-attributes": "Shared attributes", | ||
834 | + "server-attributes": "Server attributes", | ||
835 | + "latest-timeseries": "Latest timeseries" | ||
832 | }, | 836 | }, |
833 | "event": { | 837 | "event": { |
834 | "event-type": "Event type", | 838 | "event-type": "Event type", |