Added telemetry view

This commit is contained in:
Volodymyr Babak 2018-09-11 12:56:43 +03:00
parent 18b3f1339c
commit 08e166d703
4 changed files with 51 additions and 5 deletions

View File

@ -156,9 +156,6 @@ function EntityViewService($http, $q, $window, userService, attributeService, cu
var deferred = $q.defer();
var url = '/api/entityView';
entityView.keys = {};
entityView.keys.timeseries = ['temp'];
$http.post(url, entityView).then(function success(response) {
deferred.resolve(response.data);
}, function fail() {

View File

@ -62,6 +62,39 @@
<label translate>entity-view.description</label>
<textarea ng-model="entityView.additionalInfo.description" rows="2"></textarea>
</md-input-container>
<section layout="column">
<label translate class="tb-title no-padding">entity-view.client-attributes</label>
<md-chips style="padding-bottom: 15px;"
ng-required="false"
readonly="!isEdit"
ng-model="entityView.keys.attributes.cs"
placeholder="{{'entity-view.client-attributes' | translate}}"
md-separator-keys="separatorKeys">
</md-chips>
<label translate class="tb-title no-padding">entity-view.shared-attributes</label>
<md-chips style="padding-bottom: 15px;"
ng-required="false"
readonly="!isEdit"
ng-model="entityView.keys.attributes.sh"
placeholder="{{'entity-view.shared-attributes' | translate}}"
md-separator-keys="separatorKeys">
</md-chips>
<label translate class="tb-title no-padding">entity-view.server-attributes</label>
<md-chips style="padding-bottom: 15px;"
ng-required="false"
readonly="!isEdit"
ng-model="entityView.keys.attributes.ss"
placeholder="{{'entity-view.server-attributes' | translate}}"
md-separator-keys="separatorKeys">
</md-chips>
<label translate class="tb-title no-padding">entity-view.latest-timeseries</label>
<md-chips ng-required="false"
readonly="!isEdit"
ng-model="entityView.keys.timeseries"
placeholder="{{'entity-view.latest-timeseries' | translate}}"
md-separator-keys="separatorKeys">
</md-chips>
</section>
<section layout="row" layout-align="start start">
<mdp-date-picker ng-model="startTs"
mdp-max-date="maxStartTs"

View File

@ -20,7 +20,8 @@ import entityViewFieldsetTemplate from './entity-view-fieldset.tpl.html';
/* eslint-enable import/no-unresolved, import/default */
/*@ngInject*/
export default function EntityViewDirective($compile, $templateCache, $filter, toast, $translate, types, clipboardService, entityViewService, customerService) {
export default function EntityViewDirective($compile, $templateCache, $filter, toast, $translate, $mdConstant,
types, clipboardService, entityViewService, customerService) {
var linker = function (scope, element) {
var template = $templateCache.get(entityViewFieldsetTemplate);
element.html(template);
@ -32,6 +33,9 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t
scope.allowedEntityTypes = [types.entityType.device, types.entityType.asset];
var semicolon = 186;
scope.separatorKeys = [$mdConstant.KEY_CODE.ENTER, $mdConstant.KEY_CODE.COMMA, semicolon];
scope.$watch('entityView', function(newVal) {
if (newVal) {
if (scope.entityView.customerId && scope.entityView.customerId.id !== types.id.nullUid) {
@ -49,6 +53,14 @@ export default function EntityViewDirective($compile, $templateCache, $filter, t
}
scope.startTs = new Date(scope.entityView.startTs);
scope.endTs = new Date(scope.entityView.endTs);
if (!scope.entityView.keys) {
scope.entityView.keys = {};
scope.entityView.keys.timeseries = [];
scope.entityView.keys.attributes = {};
scope.entityView.keys.attributes.ss = [];
scope.entityView.keys.attributes.cs = [];
scope.entityView.keys.attributes.sh = [];
}
}
});

View File

@ -828,7 +828,11 @@
"select-entity-view": "Select entity view",
"make-public": "Make entity view public",
"start-ts": "Start ts",
"end-ts": "End ts"
"end-ts": "End ts",
"client-attributes": "Client attributes",
"shared-attributes": "Shared attributes",
"server-attributes": "Server attributes",
"latest-timeseries": "Latest timeseries"
},
"event": {
"event-type": "Event type",