Commit 5ac2ca3a26292f38f143875b7c728e20cd82fc36
1 parent
cd2e89e8
Added Downlink edge tab. UI data implementation
Showing
7 changed files
with
136 additions
and
5 deletions
@@ -600,6 +600,10 @@ export default angular.module('thingsboard.types', []) | @@ -600,6 +600,10 @@ export default angular.module('thingsboard.types', []) | ||
600 | stats: { | 600 | stats: { |
601 | value: "STATS", | 601 | value: "STATS", |
602 | name: "event.type-stats" | 602 | name: "event.type-stats" |
603 | + }, | ||
604 | + edgeEvent: { | ||
605 | + value: "EDGE_EVENT", | ||
606 | + name: "event.type-edge-event" | ||
603 | } | 607 | } |
604 | }, | 608 | }, |
605 | debugEventType: { | 609 | debugEventType: { |
1 | +<!-- | ||
2 | + | ||
3 | + Copyright © 2016-2020 The Thingsboard Authors | ||
4 | + | ||
5 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + you may not use this file except in compliance with the License. | ||
7 | + You may obtain a copy of the License at | ||
8 | + | ||
9 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + | ||
11 | + Unless required by applicable law or agreed to in writing, software | ||
12 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + See the License for the specific language governing permissions and | ||
15 | + limitations under the License. | ||
16 | + | ||
17 | +--> | ||
18 | +<div translate class="tb-cell" flex="30">event.event-time</div> | ||
19 | +<div translate class="tb-cell" flex="20">event.event-type</div> | ||
20 | +<div translate class="tb-cell" flex="20">edge.entity-id</div> | ||
21 | +<div translate class="tb-cell" flex="20">edge.event-action</div> | ||
22 | +<div translate class="tb-cell" flex="20">event.success</div> | ||
23 | +<div translate class="tb-cell" flex="20">edge.entity-info</div> |
@@ -19,6 +19,7 @@ import eventHeaderLcEventTemplate from './event-header-lc-event.tpl.html'; | @@ -19,6 +19,7 @@ import eventHeaderLcEventTemplate from './event-header-lc-event.tpl.html'; | ||
19 | import eventHeaderStatsTemplate from './event-header-stats.tpl.html'; | 19 | import eventHeaderStatsTemplate from './event-header-stats.tpl.html'; |
20 | import eventHeaderErrorTemplate from './event-header-error.tpl.html'; | 20 | import eventHeaderErrorTemplate from './event-header-error.tpl.html'; |
21 | import eventHeaderDebugRuleNodeTemplate from './event-header-debug-rulenode.tpl.html'; | 21 | import eventHeaderDebugRuleNodeTemplate from './event-header-debug-rulenode.tpl.html'; |
22 | +import eventHeaderEdgeEventTemplate from './event-header-edge-event.tpl.html' | ||
22 | 23 | ||
23 | /* eslint-enable import/no-unresolved, import/default */ | 24 | /* eslint-enable import/no-unresolved, import/default */ |
24 | 25 | ||
@@ -45,6 +46,9 @@ export default function EventHeaderDirective($compile, $templateCache, types) { | @@ -45,6 +46,9 @@ export default function EventHeaderDirective($compile, $templateCache, types) { | ||
45 | case types.debugEventType.debugRuleChain.value: | 46 | case types.debugEventType.debugRuleChain.value: |
46 | template = eventHeaderDebugRuleNodeTemplate; | 47 | template = eventHeaderDebugRuleNodeTemplate; |
47 | break; | 48 | break; |
49 | + case types.eventType.edgeEvent.value: | ||
50 | + template = eventHeaderEdgeEventTemplate; | ||
51 | + break; | ||
48 | } | 52 | } |
49 | return $templateCache.get(template); | 53 | return $templateCache.get(template); |
50 | } | 54 | } |
1 | +<!-- | ||
2 | + | ||
3 | + Copyright © 2016-2020 The Thingsboard Authors | ||
4 | + | ||
5 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + you may not use this file except in compliance with the License. | ||
7 | + You may obtain a copy of the License at | ||
8 | + | ||
9 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + | ||
11 | + Unless required by applicable law or agreed to in writing, software | ||
12 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + See the License for the specific language governing permissions and | ||
15 | + limitations under the License. | ||
16 | + | ||
17 | +--> | ||
18 | +<div class="tb-cell" flex="30">{{event.createdTime | date : 'yyyy-MM-dd HH:mm:ss'}}</div> | ||
19 | +<div class="tb-cell" flex="20">{{event.edgeEventAction}}</div> | ||
20 | +<div class="tb-cell" flex="20">{{event.entityId}}</div> | ||
21 | +<div class="tb-cell" flex="20">{{event.entityType}}</div> | ||
22 | +<div translate class="tb-cell" flex="20">{{event.success ? 'event.success' : 'event.failed'}}</div> | ||
23 | +<div class="tb-cell" flex="20"> | ||
24 | + <md-button class="md-icon-button md-primary" | ||
25 | + ng-click="showEdgeEntityContent($event, 'edge.entity-info', 'JSON')" | ||
26 | + aria-label="{{ 'action.view' | translate }}"> | ||
27 | + <md-tooltip md-direction="top"> | ||
28 | + {{ 'action.view' | translate }} | ||
29 | + </md-tooltip> | ||
30 | + <md-icon aria-label="{{ 'action.view' | translate }}" | ||
31 | + class="material-icons"> | ||
32 | + more_horiz | ||
33 | + </md-icon> | ||
34 | + </md-button> | ||
35 | +</div> | ||
36 | + |
@@ -21,11 +21,12 @@ import eventRowLcEventTemplate from './event-row-lc-event.tpl.html'; | @@ -21,11 +21,12 @@ import eventRowLcEventTemplate from './event-row-lc-event.tpl.html'; | ||
21 | import eventRowStatsTemplate from './event-row-stats.tpl.html'; | 21 | import eventRowStatsTemplate from './event-row-stats.tpl.html'; |
22 | import eventRowErrorTemplate from './event-row-error.tpl.html'; | 22 | import eventRowErrorTemplate from './event-row-error.tpl.html'; |
23 | import eventRowDebugRuleNodeTemplate from './event-row-debug-rulenode.tpl.html'; | 23 | import eventRowDebugRuleNodeTemplate from './event-row-debug-rulenode.tpl.html'; |
24 | +import eventRowEdgeEventTemplate from './event-row-edge-event.tpl.html'; | ||
24 | 25 | ||
25 | /* eslint-enable import/no-unresolved, import/default */ | 26 | /* eslint-enable import/no-unresolved, import/default */ |
26 | 27 | ||
27 | /*@ngInject*/ | 28 | /*@ngInject*/ |
28 | -export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, types) { | 29 | +export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, types, toast, entityService) { |
29 | 30 | ||
30 | var linker = function (scope, element, attrs) { | 31 | var linker = function (scope, element, attrs) { |
31 | 32 | ||
@@ -47,6 +48,9 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | @@ -47,6 +48,9 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | ||
47 | case types.debugEventType.debugRuleChain.value: | 48 | case types.debugEventType.debugRuleChain.value: |
48 | template = eventRowDebugRuleNodeTemplate; | 49 | template = eventRowDebugRuleNodeTemplate; |
49 | break; | 50 | break; |
51 | + case types.eventType.edgeEvent.value: | ||
52 | + template = eventRowEdgeEventTemplate; | ||
53 | + break; | ||
50 | } | 54 | } |
51 | return $templateCache.get(template); | 55 | return $templateCache.get(template); |
52 | } | 56 | } |
@@ -86,6 +90,36 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | @@ -86,6 +90,36 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | ||
86 | }); | 90 | }); |
87 | } | 91 | } |
88 | 92 | ||
93 | + scope.showEdgeEntityContent = function($event, title, contentType) { | ||
94 | + var onShowingCallback = { | ||
95 | + onShowing: function(){} | ||
96 | + } | ||
97 | + if (!contentType) { | ||
98 | + contentType = null; | ||
99 | + } | ||
100 | + entityService.getEntity(scope.event.entityType, scope.event.entityId, {}).then( | ||
101 | + function success(info) { | ||
102 | + var content = angular.toJson(info); | ||
103 | + $mdDialog.show({ | ||
104 | + controller: 'EventContentDialogController', | ||
105 | + controllerAs: 'vm', | ||
106 | + templateUrl: eventErrorDialogTemplate, | ||
107 | + locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, | ||
108 | + parent: angular.element($document[0].body), | ||
109 | + fullscreen: true, | ||
110 | + targetEvent: $event, | ||
111 | + multiple: true, | ||
112 | + onShowing: function(scope, element) { | ||
113 | + onShowingCallback.onShowing(scope, element); | ||
114 | + } | ||
115 | + }); | ||
116 | + }, | ||
117 | + function fail() { | ||
118 | + toast.showError($translate.instant('edge.load-entity-error')); | ||
119 | + } | ||
120 | + ); | ||
121 | + } | ||
122 | + | ||
89 | scope.checkTooltip = function($event) { | 123 | scope.checkTooltip = function($event) { |
90 | var el = $event.target; | 124 | var el = $event.target; |
91 | var $el = angular.element(el); | 125 | var $el = angular.element(el); |
@@ -24,6 +24,27 @@ import eventTableTemplate from './event-table.tpl.html'; | @@ -24,6 +24,27 @@ import eventTableTemplate from './event-table.tpl.html'; | ||
24 | /*@ngInject*/ | 24 | /*@ngInject*/ |
25 | export default function EventTableDirective($compile, $templateCache, $rootScope, types, eventService) { | 25 | export default function EventTableDirective($compile, $templateCache, $rootScope, types, eventService) { |
26 | 26 | ||
27 | + var edgeData = [ | ||
28 | + { | ||
29 | + "createdTime": 1593592774537, | ||
30 | + "tenantId": "63746950-bb76-11ea-9f96-69d7782607f7", | ||
31 | + "edgeId": "85bb84b0-bb78-11ea-8472-c3dbdeb0fd97", | ||
32 | + "edgeEventAction": "ASSIGNED_TO_EDGE", | ||
33 | + "entityId": "640055a0-bb76-11ea-9f96-69d7782607f7", | ||
34 | + "entityType": "DEVICE", | ||
35 | + "success": true, | ||
36 | + }, | ||
37 | + { | ||
38 | + "createdTime": 1593592774538, | ||
39 | + "tenantId": "63746950-bb76-11ea-9f96-69d7782607f7", | ||
40 | + "edgeId": "85bb84b0-bb78-11ea-8472-c3dbdeb0fd97", | ||
41 | + "edgeEventAction": "CREDENTIALS_UPDATED", | ||
42 | + "entityId": "640055a0-bb76-11ea-9f96-69d7782607f8", | ||
43 | + "entityType": "DEVICE", | ||
44 | + "success": false | ||
45 | + } | ||
46 | + ] | ||
47 | + | ||
27 | var linker = function (scope, element, attrs) { | 48 | var linker = function (scope, element, attrs) { |
28 | 49 | ||
29 | var template = $templateCache.get(eventTableTemplate); | 50 | var template = $templateCache.get(eventTableTemplate); |
@@ -98,7 +119,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | @@ -98,7 +119,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | ||
98 | }, | 119 | }, |
99 | 120 | ||
100 | fetchMoreItems_: function () { | 121 | fetchMoreItems_: function () { |
101 | - if (scope.events.hasNext && !scope.events.pending) { | 122 | + if (scope.events.hasNext && !scope.events.pending && scope.eventType !== "EDGE_EVENT") { |
102 | if (scope.entityType && scope.entityId && scope.eventType && scope.tenantId) { | 123 | if (scope.entityType && scope.entityId && scope.eventType && scope.tenantId) { |
103 | var promise = eventService.getEvents(scope.entityType, scope.entityId, | 124 | var promise = eventService.getEvents(scope.entityType, scope.entityId, |
104 | scope.eventType, scope.tenantId, scope.events.nextPageLink); | 125 | scope.eventType, scope.tenantId, scope.events.nextPageLink); |
@@ -125,12 +146,16 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | @@ -125,12 +146,16 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | ||
125 | scope.events.hasNext = false; | 146 | scope.events.hasNext = false; |
126 | } | 147 | } |
127 | } | 148 | } |
149 | + if (scope.eventType === "EDGE_EVENT") { | ||
150 | + scope.events.data = edgeData; | ||
151 | + scope.events.nextPageLink = false; | ||
152 | + scope.events.hasNext = null; | ||
153 | + } | ||
128 | } | 154 | } |
129 | }; | 155 | }; |
130 | 156 | ||
131 | scope.$watch("entityId", function(newVal, prevVal) { | 157 | scope.$watch("entityId", function(newVal, prevVal) { |
132 | if (newVal && !angular.equals(newVal, prevVal)) { | 158 | if (newVal && !angular.equals(newVal, prevVal)) { |
133 | - scope.resetFilter(); | ||
134 | scope.reload(); | 159 | scope.reload(); |
135 | } | 160 | } |
136 | }); | 161 | }); |
@@ -141,7 +166,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | @@ -141,7 +166,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope | ||
141 | } | 166 | } |
142 | }); | 167 | }); |
143 | 168 | ||
144 | - scope.$watch("timewindow", function(newVal, prevVal) { | 169 | + scope.$watch("createdTime", function(newVal, prevVal) { |
145 | if (newVal && !angular.equals(newVal, prevVal)) { | 170 | if (newVal && !angular.equals(newVal, prevVal)) { |
146 | scope.reload(); | 171 | scope.reload(); |
147 | } | 172 | } |
@@ -791,14 +791,17 @@ | @@ -791,14 +791,17 @@ | ||
791 | "name": "Name", | 791 | "name": "Name", |
792 | "name-required": "Name is required.", | 792 | "name-required": "Name is required.", |
793 | "description": "Description", | 793 | "description": "Description", |
794 | - "events": "Events", | 794 | + "entity-info": "Entity info", |
795 | "details": "Details", | 795 | "details": "Details", |
796 | + "events": "Events", | ||
796 | "copy-id": "Copy Edge Id", | 797 | "copy-id": "Copy Edge Id", |
797 | "id-copied-message": "Edge Id has been copied to clipboard", | 798 | "id-copied-message": "Edge Id has been copied to clipboard", |
798 | "permissions": "Permissions", | 799 | "permissions": "Permissions", |
799 | "edge-required": "Edge required", | 800 | "edge-required": "Edge required", |
800 | "edge-type": "Edge type", | 801 | "edge-type": "Edge type", |
801 | "edge-type-required": "Edge type is required.", | 802 | "edge-type-required": "Edge type is required.", |
803 | + "event-action": "Event action", | ||
804 | + "entity-id": "Entity ID", | ||
802 | "select-edge-type": "Select edge type", | 805 | "select-edge-type": "Select edge type", |
803 | "assign-to-customer": "Assign to customer", | 806 | "assign-to-customer": "Assign to customer", |
804 | "assign-to-customer-text": "Please select the customer to assign the edge(s)", | 807 | "assign-to-customer-text": "Please select the customer to assign the edge(s)", |
@@ -818,6 +821,7 @@ | @@ -818,6 +821,7 @@ | ||
818 | "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.", | 821 | "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.", |
819 | "import": "Import edge", | 822 | "import": "Import edge", |
820 | "label": "Label", | 823 | "label": "Label", |
824 | + "load-entity-error": "Could not load entity info", | ||
821 | "assign-new-edge": "Assign new edge", | 825 | "assign-new-edge": "Assign new edge", |
822 | "manage-edge-dashboards": "Manage edge dashboards", | 826 | "manage-edge-dashboards": "Manage edge dashboards", |
823 | "unassign-from-edge": "Unassign from edge", | 827 | "unassign-from-edge": "Unassign from edge", |
@@ -1082,6 +1086,7 @@ | @@ -1082,6 +1086,7 @@ | ||
1082 | "type-debug-rule-chain": "Debug", | 1086 | "type-debug-rule-chain": "Debug", |
1083 | "no-events-prompt": "No events found", | 1087 | "no-events-prompt": "No events found", |
1084 | "error": "Error", | 1088 | "error": "Error", |
1089 | + "type-edge-event": "Downlink", | ||
1085 | "alarm": "Alarm", | 1090 | "alarm": "Alarm", |
1086 | "event-time": "Event time", | 1091 | "event-time": "Event time", |
1087 | "server": "Server", | 1092 | "server": "Server", |