Commit 501c7d1926375314644461cce5bdf052cecaf04d
1 parent
a0e74d72
Edge Downlinks new tab final implementation
Showing
20 changed files
with
81 additions
and
563 deletions
@@ -384,7 +384,7 @@ export default angular.module('thingsboard.types', []) | @@ -384,7 +384,7 @@ export default angular.module('thingsboard.types', []) | ||
384 | entityView: "ENTITY_VIEW", | 384 | entityView: "ENTITY_VIEW", |
385 | edge: "EDGE" | 385 | edge: "EDGE" |
386 | }, | 386 | }, |
387 | - edgeEventType:{ | 387 | + edgeDownlinksType:{ |
388 | dashboard: "DASHBOARD", | 388 | dashboard: "DASHBOARD", |
389 | asset: "ASSET", | 389 | asset: "ASSET", |
390 | device: "DEVICE", | 390 | device: "DEVICE", |
@@ -405,7 +405,7 @@ export default angular.module('thingsboard.types', []) | @@ -405,7 +405,7 @@ export default angular.module('thingsboard.types', []) | ||
405 | widgetType: "WIDGET_TYPE", | 405 | widgetType: "WIDGET_TYPE", |
406 | adminSettings: "ADMIN_SETTINGS" | 406 | adminSettings: "ADMIN_SETTINGS" |
407 | }, | 407 | }, |
408 | - edgeEventStatus: { | 408 | + edgeDownlinksStatus: { |
409 | "DEPLOYED": { | 409 | "DEPLOYED": { |
410 | name: "edge.deployed", | 410 | name: "edge.deployed", |
411 | color: grey900 | 411 | color: grey900 |
@@ -1073,7 +1073,7 @@ export default angular.module('thingsboard.types', []) | @@ -1073,7 +1073,7 @@ export default angular.module('thingsboard.types', []) | ||
1073 | translate: { | 1073 | translate: { |
1074 | customTranslationsPrefix: "custom." | 1074 | customTranslationsPrefix: "custom." |
1075 | }, | 1075 | }, |
1076 | - edgeEventActionType: { | 1076 | + edgeDownlinksActionType: { |
1077 | "ADDED": { | 1077 | "ADDED": { |
1078 | name: "audit-log.type-added" | 1078 | name: "audit-log.type-added" |
1079 | }, | 1079 | }, |
@@ -1135,7 +1135,7 @@ export default angular.module('thingsboard.types', []) | @@ -1135,7 +1135,7 @@ export default angular.module('thingsboard.types', []) | ||
1135 | name: "audit-log.type-unassigned-from-edge" | 1135 | name: "audit-log.type-unassigned-from-edge" |
1136 | } | 1136 | } |
1137 | }, | 1137 | }, |
1138 | - edgeEventTypeTranslations:{ | 1138 | + edgeDownlinksTypeTranslations:{ |
1139 | "DASHBOARD": { | 1139 | "DASHBOARD": { |
1140 | name: "entity.type-dashboard" | 1140 | name: "entity.type-dashboard" |
1141 | }, | 1141 | }, |
@@ -1193,10 +1193,6 @@ export default angular.module('thingsboard.types', []) | @@ -1193,10 +1193,6 @@ export default angular.module('thingsboard.types', []) | ||
1193 | "ADMIN_SETTINGS": { | 1193 | "ADMIN_SETTINGS": { |
1194 | name: "permission.resource.display-type.ADMIN_SETTINGS" | 1194 | name: "permission.resource.display-type.ADMIN_SETTINGS" |
1195 | } | 1195 | } |
1196 | - }, | ||
1197 | - edgeDownlinks: { | ||
1198 | - value: "EDGE_DOWNLINKS", | ||
1199 | - name: "edge.downlinks" | ||
1200 | } | 1196 | } |
1201 | } | 1197 | } |
1202 | ).name; | 1198 | ).name; |
ui/src/app/edge/downlinks/downlink.scss
renamed from
ui/src/app/edge/downlinks/event.scss
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -md-list.tb-event-table { | 16 | +md-list.tb-edge-downlinks-table { |
17 | padding: 0; | 17 | padding: 0; |
18 | 18 | ||
19 | md-list-item { | 19 | md-list-item { |
@@ -85,11 +85,7 @@ md-list.tb-event-table { | @@ -85,11 +85,7 @@ md-list.tb-event-table { | ||
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | -.tb-edge-downlinks-table-2 { | ||
89 | - @extend .tb-event-table; | ||
90 | -} | ||
91 | - | ||
92 | -#tb-event-content { | 88 | +#tb-edge-downlinks-content { |
93 | width: 100%; | 89 | width: 100%; |
94 | min-width: 400px; | 90 | min-width: 400px; |
95 | height: 100%; | 91 | height: 100%; |
@@ -76,7 +76,7 @@ export default function EdgeDownlinksContentDialogController($mdDialog, types, c | @@ -76,7 +76,7 @@ export default function EdgeDownlinksContentDialogController($mdDialog, types, c | ||
76 | } | 76 | } |
77 | newWidth = 8 * maxLineLength + 16; | 77 | newWidth = 8 * maxLineLength + 16; |
78 | } | 78 | } |
79 | - $('#tb-event-content', element).height(newHeight.toString() + "px") | 79 | + $('#tb-edge-downlinks-content', element).height(newHeight.toString() + "px") |
80 | .width(newWidth.toString() + "px"); | 80 | .width(newWidth.toString() + "px"); |
81 | vm.editor.resize(); | 81 | vm.editor.resize(); |
82 | } | 82 | } |
ui/src/app/edge/downlinks/edge-downlinks-content-dialog.tpl.html
renamed from
ui/src/app/edge/downlinks/event-content-dialog.tpl.html
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | </md-toolbar> | 27 | </md-toolbar> |
28 | <md-dialog-content> | 28 | <md-dialog-content> |
29 | <div class="md-dialog-content"> | 29 | <div class="md-dialog-content"> |
30 | - <div flex id="tb-event-content" readonly | 30 | + <div flex id="tb-edge-downlinks-content" readonly |
31 | ui-ace="vm.contentOptions" | 31 | ui-ace="vm.contentOptions" |
32 | ng-model="vm.content"> | 32 | ng-model="vm.content"> |
33 | </div> | 33 | </div> |
@@ -15,34 +15,19 @@ | @@ -15,34 +15,19 @@ | ||
15 | */ | 15 | */ |
16 | /* eslint-disable import/no-unresolved, import/default */ | 16 | /* eslint-disable import/no-unresolved, import/default */ |
17 | 17 | ||
18 | -import edgeDownlinksHeaderTemplate from './event-header-edge-event.tpl.html' | 18 | +import edgeDownlinksHeaderTemplate from './edge-downlinks-header.tpl.html' |
19 | 19 | ||
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 EventHeaderDirective2($compile, $templateCache, types) { | 23 | +export default function EdgeDownlinksHeaderDirective($compile, $templateCache) { |
24 | 24 | ||
25 | - var linker = function (scope, element, attrs) { | 25 | + var linker = function (scope, element) { |
26 | 26 | ||
27 | - var getTemplate = function(eventType) { | ||
28 | - var template = ''; | ||
29 | - switch(eventType) { | ||
30 | - case types.edgeDownlinks.value: | ||
31 | - template = edgeDownlinksHeaderTemplate; | ||
32 | - break; | ||
33 | - } | ||
34 | - return $templateCache.get(template); | ||
35 | - } | ||
36 | - | ||
37 | - scope.loadTemplate = function() { | ||
38 | - element.html(getTemplate(attrs.eventType)); | ||
39 | - $compile(element.contents())(scope); | ||
40 | - } | ||
41 | - | ||
42 | - attrs.$observe('eventType', function() { | ||
43 | - scope.loadTemplate(); | ||
44 | - }); | 27 | + var template = edgeDownlinksHeaderTemplate; |
45 | 28 | ||
29 | + element.html($templateCache.get(template)); | ||
30 | + $compile(element.contents())(scope); | ||
46 | } | 31 | } |
47 | 32 | ||
48 | return { | 33 | return { |
ui/src/app/edge/downlinks/edge-downlinks-header.tpl.html
renamed from
ui/src/app/edge/downlinks/event-header-edge-event.tpl.html
@@ -15,40 +15,24 @@ | @@ -15,40 +15,24 @@ | ||
15 | */ | 15 | */ |
16 | /* eslint-disable import/no-unresolved, import/default */ | 16 | /* eslint-disable import/no-unresolved, import/default */ |
17 | 17 | ||
18 | -import eventErrorDialogTemplate from './event-content-dialog.tpl.html'; | ||
19 | - | ||
20 | -import edgeDownlinlsRowTemplate from './event-row-edge-event.tpl.html'; | 18 | +import edgeDownlinksContentTemplate from './edge-downlinks-content-dialog.tpl.html'; |
19 | +import edgeDownlinlsRowTemplate from './edge-downlinks-row.tpl.html'; | ||
21 | 20 | ||
22 | /* eslint-enable import/no-unresolved, import/default */ | 21 | /* eslint-enable import/no-unresolved, import/default */ |
23 | 22 | ||
24 | /*@ngInject*/ | 23 | /*@ngInject*/ |
25 | -export default function EventRowDirective2($compile, $templateCache, $mdDialog, $document, $translate, | 24 | +export default function EdgeDownlinksRowDirective($compile, $templateCache, $mdDialog, $document, $translate, |
26 | types, utils, toast, entityService, ruleChainService) { | 25 | types, utils, toast, entityService, ruleChainService) { |
27 | 26 | ||
28 | var linker = function (scope, element, attrs) { | 27 | var linker = function (scope, element, attrs) { |
29 | 28 | ||
30 | - var getTemplate = function(eventType) { | ||
31 | - var template = ''; | ||
32 | - switch(eventType) { | ||
33 | - case types.edgeDownlinks.value: | ||
34 | - template = edgeDownlinlsRowTemplate; | ||
35 | - break; | ||
36 | - } | ||
37 | - return $templateCache.get(template); | ||
38 | - } | ||
39 | - | ||
40 | - scope.loadTemplate = function() { | ||
41 | - element.html(getTemplate(attrs.eventType)); | ||
42 | - $compile(element.contents())(scope); | ||
43 | - } | 29 | + var template = edgeDownlinlsRowTemplate; |
44 | 30 | ||
45 | - attrs.$observe('eventType', function() { | ||
46 | - scope.loadTemplate(); | ||
47 | - }); | 31 | + element.html($templateCache.get(template)); |
32 | + $compile(element.contents())(scope); | ||
48 | 33 | ||
49 | scope.types = types; | 34 | scope.types = types; |
50 | - | ||
51 | - scope.event = attrs.event; | 35 | + scope.downlink = attrs.downlink; |
52 | 36 | ||
53 | scope.showEdgeEntityContent = function($event, title, contentType) { | 37 | scope.showEdgeEntityContent = function($event, title, contentType) { |
54 | var onShowingCallback = { | 38 | var onShowingCallback = { |
@@ -58,13 +42,13 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | @@ -58,13 +42,13 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | ||
58 | contentType = null; | 42 | contentType = null; |
59 | } | 43 | } |
60 | var content = ''; | 44 | var content = ''; |
61 | - switch(scope.event.type) { | ||
62 | - case types.edgeEventType.relation: | ||
63 | - content = angular.toJson(scope.event.body); | 45 | + switch(scope.downlink.type) { |
46 | + case types.edgeDownlinksType.relation: | ||
47 | + content = angular.toJson(scope.downlink.body); | ||
64 | showDialog(); | 48 | showDialog(); |
65 | break; | 49 | break; |
66 | - case types.edgeEventType.ruleChainMetaData: | ||
67 | - content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then( | 50 | + case types.edgeDownlinksType.ruleChainMetaData: |
51 | + content = ruleChainService.getRuleChainMetaData(scope.downlink.entityId, {ignoreErrors: true}).then( | ||
68 | function success(info) { | 52 | function success(info) { |
69 | showDialog(); | 53 | showDialog(); |
70 | return angular.toJson(info); | 54 | return angular.toJson(info); |
@@ -73,7 +57,7 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | @@ -73,7 +57,7 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | ||
73 | }); | 57 | }); |
74 | break; | 58 | break; |
75 | default: | 59 | default: |
76 | - content = entityService.getEntity(scope.event.type, scope.event.entityId, {ignoreErrors: true}).then( | 60 | + content = entityService.getEntity(scope.downlink.type, scope.downlink.entityId, {ignoreErrors: true}).then( |
77 | function success(info) { | 61 | function success(info) { |
78 | showDialog(); | 62 | showDialog(); |
79 | return angular.toJson(info); | 63 | return angular.toJson(info); |
@@ -84,9 +68,9 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | @@ -84,9 +68,9 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | ||
84 | } | 68 | } |
85 | function showDialog() { | 69 | function showDialog() { |
86 | $mdDialog.show({ | 70 | $mdDialog.show({ |
87 | - controller: 'EventContentDialogController2', | 71 | + controller: 'EdgeDownlinksContentDialogController', |
88 | controllerAs: 'vm', | 72 | controllerAs: 'vm', |
89 | - templateUrl: eventErrorDialogTemplate, | 73 | + templateUrl: edgeDownlinksContentTemplate, |
90 | locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, | 74 | locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, |
91 | parent: angular.element($document[0].body), | 75 | parent: angular.element($document[0].body), |
92 | fullscreen: true, | 76 | fullscreen: true, |
@@ -102,10 +86,10 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | @@ -102,10 +86,10 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | ||
102 | } | 86 | } |
103 | } | 87 | } |
104 | 88 | ||
105 | - scope.checkEdgeEventType = function (type) { | ||
106 | - return !(type === types.edgeEventType.widgetType || | ||
107 | - type === types.edgeEventType.adminSettings || | ||
108 | - type === types.edgeEventType.widgetsBundle ); | 89 | + scope.checkEdgeDownlinksType = function (type) { |
90 | + return !(type === types.edgeDownlinksType.widgetType || | ||
91 | + type === types.edgeDownlinksType.adminSettings || | ||
92 | + type === types.edgeDownlinksType.widgetsBundle ); | ||
109 | } | 93 | } |
110 | 94 | ||
111 | scope.checkTooltip = function($event) { | 95 | scope.checkTooltip = function($event) { |
@@ -118,14 +102,14 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | @@ -118,14 +102,14 @@ export default function EventRowDirective2($compile, $templateCache, $mdDialog, | ||
118 | 102 | ||
119 | $compile(element.contents())(scope); | 103 | $compile(element.contents())(scope); |
120 | 104 | ||
121 | - scope.updateStatus = function(eventCreatedTime) { | 105 | + scope.updateStatus = function(downlinkCreatedTime) { |
122 | var status; | 106 | var status; |
123 | - if (eventCreatedTime < scope.queueStartTs) { | ||
124 | - status = $translate.instant(types.edgeEventStatus.DEPLOYED.name); | ||
125 | - scope.statusColor = types.edgeEventStatus.DEPLOYED.color; | 107 | + if (downlinkCreatedTime < scope.queueStartTs) { |
108 | + status = $translate.instant(types.edgeDownlinksStatus.DEPLOYED.name); | ||
109 | + scope.statusColor = types.edgeDownlinksStatus.DEPLOYED.color; | ||
126 | } else { | 110 | } else { |
127 | - status = $translate.instant(types.edgeEventStatus.PENDING.name); | ||
128 | - scope.statusColor = types.edgeEventStatus.PENDING.color; | 111 | + status = $translate.instant(types.edgeDownlinksStatus.PENDING.name); |
112 | + scope.statusColor = types.edgeDownlinksStatus.PENDING.color; | ||
129 | } | 113 | } |
130 | return status; | 114 | return status; |
131 | } | 115 | } |
ui/src/app/edge/downlinks/edge-downlinks-row.tpl.html
renamed from
ui/src/app/edge/downlinks/event-row-edge-event.tpl.html
@@ -15,13 +15,13 @@ | @@ -15,13 +15,13 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<div class="tb-cell" flex="20">{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}</div> | ||
19 | -<div class="tb-cell" flex="10">{{ event.edgeEventTypeText }}</div> | ||
20 | -<div class="tb-cell" flex="15">{{ event.edgeEventActionText }}</div> | ||
21 | -<div class="tb-cell" flex="30">{{ event.entityId }}</div> | ||
22 | -<div class="tb-cell" flex="15" ng-style="{'color': statusColor}">{{ updateStatus(event.createdTime) }}</div> | 18 | +<div class="tb-cell" flex="20">{{ downlink.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}</div> |
19 | +<div class="tb-cell" flex="10">{{ downlink.edgeDownlinksTypeText }}</div> | ||
20 | +<div class="tb-cell" flex="15">{{ downlink.edgeDownlinksActionText }}</div> | ||
21 | +<div class="tb-cell" flex="30">{{ downlink.entityId }}</div> | ||
22 | +<div class="tb-cell" flex="15" ng-style="{'color': statusColor}">{{ updateStatus(downlink.createdTime) }}</div> | ||
23 | <div class="tb-cell" flex="10"> | 23 | <div class="tb-cell" flex="10"> |
24 | - <md-button ng-if="checkEdgeEventType(event.type)" class="md-icon-button md-primary" | 24 | + <md-button ng-if="checkEdgeDownlinksType(downlink.type)" class="md-icon-button md-primary" |
25 | ng-click="showEdgeEntityContent($event, 'edge.entity-info', 'JSON')" | 25 | ng-click="showEdgeEntityContent($event, 'edge.entity-info', 'JSON')" |
26 | aria-label="{{ 'action.view' | translate }}"> | 26 | aria-label="{{ 'action.view' | translate }}"> |
27 | <md-tooltip md-direction="top"> | 27 | <md-tooltip md-direction="top"> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -import './event.scss'; | 16 | +import './downlink.scss'; |
17 | 17 | ||
18 | /* eslint-disable import/no-unresolved, import/default */ | 18 | /* eslint-disable import/no-unresolved, import/default */ |
19 | 19 | ||
@@ -22,17 +22,13 @@ import edgeDownlinksTableTemplate from './edge-downlinks-table.tpl.html'; | @@ -22,17 +22,13 @@ import edgeDownlinksTableTemplate from './edge-downlinks-table.tpl.html'; | ||
22 | /* eslint-enable import/no-unresolved, import/default */ | 22 | /* eslint-enable import/no-unresolved, import/default */ |
23 | 23 | ||
24 | /*@ngInject*/ | 24 | /*@ngInject*/ |
25 | -export default function EdgeDownlinksDirective2($compile, $templateCache, $rootScope, $translate, types, | ||
26 | - eventService, edgeService, attributeService) { | 25 | +export default function EdgeDownlinksDirective($compile, $templateCache, $rootScope, $translate, types, edgeService, attributeService) { |
27 | 26 | ||
28 | var linker = function (scope, element) { | 27 | var linker = function (scope, element) { |
29 | 28 | ||
30 | var template = $templateCache.get(edgeDownlinksTableTemplate); | 29 | var template = $templateCache.get(edgeDownlinksTableTemplate); |
31 | - | ||
32 | element.html(template); | 30 | element.html(template); |
33 | 31 | ||
34 | - scope.eventType = types.edgeDownlinks.value; | ||
35 | - | ||
36 | var pageSize = 20; | 32 | var pageSize = 20; |
37 | var startTime = 0; | 33 | var startTime = 0; |
38 | var endTime = 0; | 34 | var endTime = 0; |
@@ -45,13 +41,13 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | @@ -45,13 +41,13 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | ||
45 | 41 | ||
46 | scope.topIndex = 0; | 42 | scope.topIndex = 0; |
47 | 43 | ||
48 | - scope.theEvents = { | 44 | + scope.theDownlinks = { |
49 | getItemAtIndex: function (index) { | 45 | getItemAtIndex: function (index) { |
50 | - if (index > scope.events.data.length) { | ||
51 | - scope.theEvents.fetchMoreItems_(index); | 46 | + if (index > scope.downlinks.data.length) { |
47 | + scope.theDownlinks.fetchMoreItems_(index); | ||
52 | return null; | 48 | return null; |
53 | } | 49 | } |
54 | - var item = scope.events.data[index]; | 50 | + var item = scope.downlinks.data[index]; |
55 | if (item) { | 51 | if (item) { |
56 | item.indexNumber = index + 1; | 52 | item.indexNumber = index + 1; |
57 | } | 53 | } |
@@ -59,34 +55,34 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | @@ -59,34 +55,34 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | ||
59 | }, | 55 | }, |
60 | 56 | ||
61 | getLength: function () { | 57 | getLength: function () { |
62 | - if (scope.events.hasNext) { | ||
63 | - return scope.events.data.length + scope.events.nextPageLink.limit; | 58 | + if (scope.downlinks.hasNext) { |
59 | + return scope.downlinks.data.length + scope.downlinks.nextPageLink.limit; | ||
64 | } else { | 60 | } else { |
65 | - return scope.events.data.length; | 61 | + return scope.downlinks.data.length; |
66 | } | 62 | } |
67 | }, | 63 | }, |
68 | 64 | ||
69 | fetchMoreItems_: function () { | 65 | fetchMoreItems_: function () { |
70 | - if (scope.events.hasNext && !scope.events.pending) { | ||
71 | - if (scope.entityType && scope.entityId && scope.eventType && scope.tenantId) { | 66 | + if (scope.downlinks.hasNext && !scope.downlinks.pending) { |
67 | + if (scope.entityType && scope.entityId && scope.tenantId) { | ||
72 | scope.loadEdgeInfo(); | 68 | scope.loadEdgeInfo(); |
73 | - scope.events.pending = true; | ||
74 | - edgeService.getEdgeDownlinks(scope.entityId, scope.events.nextPageLink).then( | ||
75 | - function success(events) { | ||
76 | - scope.events.data = scope.events.data.concat(prepareEdgeEventData(events.data)); | ||
77 | - scope.events.nextPageLink = events.nextPageLink; | ||
78 | - scope.events.hasNext = events.hasNext; | ||
79 | - if (scope.events.hasNext) { | ||
80 | - scope.events.nextPageLink.limit = pageSize; | 69 | + scope.downlinks.pending = true; |
70 | + edgeService.getEdgeDownlinks(scope.entityId, scope.downlinks.nextPageLink).then( | ||
71 | + function success(downlinks) { | ||
72 | + scope.downlinks.data = scope.downlinks.data.concat(prepareEdgeDownlinksData(downlinks.data)); | ||
73 | + scope.downlinks.nextPageLink = downlinks.nextPageLink; | ||
74 | + scope.downlinks.hasNext = downlinks.hasNext; | ||
75 | + if (scope.downlinks.hasNext) { | ||
76 | + scope.downlinks.nextPageLink.limit = pageSize; | ||
81 | } | 77 | } |
82 | - scope.events.pending = false; | 78 | + scope.downlinks.pending = false; |
83 | }, | 79 | }, |
84 | function fail() { | 80 | function fail() { |
85 | - scope.events.hasNext = false; | ||
86 | - scope.events.pending = false; | 81 | + scope.downlinks.hasNext = false; |
82 | + scope.downlinks.pending = false; | ||
87 | }); | 83 | }); |
88 | } else { | 84 | } else { |
89 | - scope.events.hasNext = false; | 85 | + scope.downlinks.hasNext = false; |
90 | } | 86 | } |
91 | } | 87 | } |
92 | } | 88 | } |
@@ -128,7 +124,7 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | @@ -128,7 +124,7 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | ||
128 | scope.topIndex = 0; | 124 | scope.topIndex = 0; |
129 | scope.selected = []; | 125 | scope.selected = []; |
130 | scope.updateTimeWindowRange(); | 126 | scope.updateTimeWindowRange(); |
131 | - scope.events = { | 127 | + scope.downlinks = { |
132 | data: [], | 128 | data: [], |
133 | nextPageLink: { | 129 | nextPageLink: { |
134 | limit: pageSize, | 130 | limit: pageSize, |
@@ -138,15 +134,15 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | @@ -138,15 +134,15 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | ||
138 | hasNext: true, | 134 | hasNext: true, |
139 | pending: false | 135 | pending: false |
140 | }; | 136 | }; |
141 | - scope.theEvents.getItemAtIndex(pageSize); | 137 | + scope.theDownlinks.getItemAtIndex(pageSize); |
142 | } | 138 | } |
143 | 139 | ||
144 | scope.noData = function() { | 140 | scope.noData = function() { |
145 | - return scope.events.data.length == 0 && !scope.events.hasNext; | 141 | + return scope.downlinks.data.length == 0 && !scope.downlinks.hasNext; |
146 | } | 142 | } |
147 | 143 | ||
148 | scope.hasData = function() { | 144 | scope.hasData = function() { |
149 | - return scope.events.data.length > 0; | 145 | + return scope.downlinks.data.length > 0; |
150 | } | 146 | } |
151 | 147 | ||
152 | scope.loading = function() { | 148 | scope.loading = function() { |
@@ -211,12 +207,12 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | @@ -211,12 +207,12 @@ export default function EdgeDownlinksDirective2($compile, $templateCache, $rootS | ||
211 | 207 | ||
212 | $compile(element.contents())(scope); | 208 | $compile(element.contents())(scope); |
213 | } | 209 | } |
214 | - function prepareEdgeEventData(data) { | 210 | + function prepareEdgeDownlinksData(data) { |
215 | 211 | ||
216 | data.forEach( | 212 | data.forEach( |
217 | - edgeEvent => { | ||
218 | - edgeEvent.edgeEventActionText = $translate.instant(types.edgeEventActionType[edgeEvent.action].name); | ||
219 | - edgeEvent.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeEvent.edgeId.entityType].name); | 213 | + edgeDownlink => { |
214 | + edgeDownlink.edgeDownlinksActionText = $translate.instant(types.edgeDownlinksActionType[edgeDownlink.action].name); | ||
215 | + edgeDownlink.edgeDownlinksTypeText = $translate.instant(types.edgeDownlinksTypeTranslations[edgeDownlink.edgeId.entityType].name); | ||
220 | } | 216 | } |
221 | ); | 217 | ); |
222 | return data; | 218 | return data; |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | </md-button> | 27 | </md-button> |
28 | </section> | 28 | </section> |
29 | <md-list flex layout="column" class="md-whiteframe-z1 tb-edge-downlinks-table"> | 29 | <md-list flex layout="column" class="md-whiteframe-z1 tb-edge-downlinks-table"> |
30 | - <md-list class="tb-row tb-header" layout="row" layout-align="start center" tb-edge-downlinks-header event-type="{{eventType}}"> | 30 | + <md-list class="tb-row tb-header" layout="row" layout-align="start center" tb-edge-downlinks-header> |
31 | </md-list> | 31 | </md-list> |
32 | <md-progress-linear style="max-height: 0px;" md-mode="indeterminate" ng-disabled="!$root.loading" | 32 | <md-progress-linear style="max-height: 0px;" md-mode="indeterminate" ng-disabled="!$root.loading" |
33 | ng-show="$root.loading"></md-progress-linear> | 33 | ng-show="$root.loading"></md-progress-linear> |
@@ -36,8 +36,8 @@ | @@ -36,8 +36,8 @@ | ||
36 | style="margin-top: 25px;" | 36 | style="margin-top: 25px;" |
37 | class="tb-prompt" ng-show="noData()">edge.no-downlinks-prompt</span> | 37 | class="tb-prompt" ng-show="noData()">edge.no-downlinks-prompt</span> |
38 | <md-virtual-repeat-container ng-show="hasData()" flex md-top-index="topIndex" tb-scope-element="repeatContainer"> | 38 | <md-virtual-repeat-container ng-show="hasData()" flex md-top-index="topIndex" tb-scope-element="repeatContainer"> |
39 | - <md-list-item md-virtual-repeat="event in theEvents" md-on-demand flex ng-style="hasScroll() ? {'margin-right':'-15px'} : {}"> | ||
40 | - <md-list class="tb-row" flex layout="row" layout-align="start center" tb-edge-downlinks-row event-type="{{eventType}}" event="{{event}}"> | 39 | + <md-list-item md-virtual-repeat="downlink in theDownlinks" md-on-demand flex ng-style="hasScroll() ? {'margin-right':'-15px'} : {}"> |
40 | + <md-list class="tb-row" flex layout="row" layout-align="start center" tb-edge-downlinks-row downlink="{{downlink}}"> | ||
41 | </md-list> | 41 | </md-list> |
42 | <md-divider flex></md-divider> | 42 | <md-divider flex></md-divider> |
43 | </md-list-item> | 43 | </md-list-item> |
@@ -65,13 +65,6 @@ | @@ -65,13 +65,6 @@ | ||
65 | default-event-type="{{vm.types.eventType.error.value}}"> | 65 | default-event-type="{{vm.types.eventType.error.value}}"> |
66 | </tb-event-table> | 66 | </tb-event-table> |
67 | </md-tab> | 67 | </md-tab> |
68 | - <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'edge.edge' | translate }}"> | ||
69 | - <tb-edge-downlinks-table-old flex entity-type="vm.types.entityType.edge" | ||
70 | - entity-id="vm.grid.operatingItem().id.id" | ||
71 | - tenant-id="vm.grid.operatingItem().tenantId.id" | ||
72 | - default-event-type="{{vm.types.edgeDownlinks.value}}"> | ||
73 | - </tb-edge-downlinks-table-old> | ||
74 | - </md-tab> | ||
75 | <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'edge.downlinks' | translate }}"> | 68 | <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" md-on-select="vm.grid.triggerResize()" label="{{ 'edge.downlinks' | translate }}"> |
76 | <tb-edge-downlinks-table flex entity-type="vm.types.entityType.edge" | 69 | <tb-edge-downlinks-table flex entity-type="vm.types.entityType.edge" |
77 | entity-id="vm.grid.operatingItem().id.id" | 70 | entity-id="vm.grid.operatingItem().id.id" |
@@ -45,7 +45,7 @@ export default angular.module('thingsboard.edge', [ | @@ -45,7 +45,7 @@ export default angular.module('thingsboard.edge', [ | ||
45 | .controller('SetRootRuleChainToEdgesController', SetRootRuleChainToEdgesController) | 45 | .controller('SetRootRuleChainToEdgesController', SetRootRuleChainToEdgesController) |
46 | .controller('EdgeDownlinksContentDialogController', EdgeDownlinksContentDialogController) | 46 | .controller('EdgeDownlinksContentDialogController', EdgeDownlinksContentDialogController) |
47 | .directive('tbEdge', EdgeDirective) | 47 | .directive('tbEdge', EdgeDirective) |
48 | + .directive('tbEdgeDownlinksTable', EdgeDownlinksDirective) | ||
48 | .directive('tbEdgeDownlinksHeader', EdgeDownlinksHeaderDirective) | 49 | .directive('tbEdgeDownlinksHeader', EdgeDownlinksHeaderDirective) |
49 | .directive('tbEdgeDownlinksRow', EdgeDownlinksRowDirective) | 50 | .directive('tbEdgeDownlinksRow', EdgeDownlinksRowDirective) |
50 | - .directive('tbEdgeDownlinksTable', EdgeDownlinksDirective) | ||
51 | .name; | 51 | .name; |
ui/src/app/event/edge-downlinks-table.directive.js
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright © 2016-2020 The Thingsboard Authors | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -import './event.scss'; | ||
17 | - | ||
18 | -/* eslint-disable import/no-unresolved, import/default */ | ||
19 | - | ||
20 | -import edgeDownlinksTableTemplate from './edge-downlinks-table.tpl.html'; | ||
21 | - | ||
22 | -/* eslint-enable import/no-unresolved, import/default */ | ||
23 | - | ||
24 | -/*@ngInject*/ | ||
25 | -export default function EdgeDownlinksDirective($compile, $templateCache, $rootScope, $translate, types, | ||
26 | - eventService, edgeService, attributeService) { | ||
27 | - | ||
28 | - var linker = function (scope, element) { | ||
29 | - | ||
30 | - var template = $templateCache.get(edgeDownlinksTableTemplate); | ||
31 | - | ||
32 | - element.html(template); | ||
33 | - | ||
34 | - scope.eventType = types.edgeDownlinks.value; | ||
35 | - | ||
36 | - var pageSize = 20; | ||
37 | - var startTime = 0; | ||
38 | - var endTime = 0; | ||
39 | - | ||
40 | - scope.timewindow = { | ||
41 | - history: { | ||
42 | - timewindowMs: 24 * 60 * 60 * 1000 // 1 day | ||
43 | - } | ||
44 | - } | ||
45 | - | ||
46 | - scope.topIndex = 0; | ||
47 | - | ||
48 | - scope.theEvents = { | ||
49 | - getItemAtIndex: function (index) { | ||
50 | - if (index > scope.events.data.length) { | ||
51 | - scope.theEvents.fetchMoreItems_(index); | ||
52 | - return null; | ||
53 | - } | ||
54 | - var item = scope.events.data[index]; | ||
55 | - if (item) { | ||
56 | - item.indexNumber = index + 1; | ||
57 | - } | ||
58 | - return item; | ||
59 | - }, | ||
60 | - | ||
61 | - getLength: function () { | ||
62 | - if (scope.events.hasNext) { | ||
63 | - return scope.events.data.length + scope.events.nextPageLink.limit; | ||
64 | - } else { | ||
65 | - return scope.events.data.length; | ||
66 | - } | ||
67 | - }, | ||
68 | - | ||
69 | - fetchMoreItems_: function () { | ||
70 | - if (scope.events.hasNext && !scope.events.pending) { | ||
71 | - if (scope.entityType && scope.entityId && scope.eventType && scope.tenantId) { | ||
72 | - scope.loadEdgeInfo(); | ||
73 | - scope.events.pending = true; | ||
74 | - edgeService.getEdgeDownlinks(scope.entityId, scope.events.nextPageLink).then( | ||
75 | - function success(events) { | ||
76 | - scope.events.data = scope.events.data.concat(prepareEdgeEventData(events.data)); | ||
77 | - scope.events.nextPageLink = events.nextPageLink; | ||
78 | - scope.events.hasNext = events.hasNext; | ||
79 | - if (scope.events.hasNext) { | ||
80 | - scope.events.nextPageLink.limit = pageSize; | ||
81 | - } | ||
82 | - scope.events.pending = false; | ||
83 | - }, | ||
84 | - function fail() { | ||
85 | - scope.events.hasNext = false; | ||
86 | - scope.events.pending = false; | ||
87 | - }); | ||
88 | - } else { | ||
89 | - scope.events.hasNext = false; | ||
90 | - } | ||
91 | - } | ||
92 | - } | ||
93 | - }; | ||
94 | - | ||
95 | - scope.$watch("entityId", function(newVal, prevVal) { | ||
96 | - if (newVal && !angular.equals(newVal, prevVal)) { | ||
97 | - scope.resetFilter(); | ||
98 | - scope.reload(); | ||
99 | - } | ||
100 | - }); | ||
101 | - | ||
102 | - scope.$watch("timewindow", function(newVal, prevVal) { | ||
103 | - if (newVal && !angular.equals(newVal, prevVal)) { | ||
104 | - scope.reload(); | ||
105 | - } | ||
106 | - }, true); | ||
107 | - | ||
108 | - scope.resetFilter = function() { | ||
109 | - scope.timewindow = { | ||
110 | - history: { | ||
111 | - timewindowMs: 24 * 60 * 60 * 1000 // 1 day | ||
112 | - } | ||
113 | - }; | ||
114 | - } | ||
115 | - | ||
116 | - scope.updateTimeWindowRange = function() { | ||
117 | - if (scope.timewindow.history.timewindowMs) { | ||
118 | - var currentTime = (new Date).getTime(); | ||
119 | - startTime = currentTime - scope.timewindow.history.timewindowMs; | ||
120 | - endTime = currentTime; | ||
121 | - } else { | ||
122 | - startTime = scope.timewindow.history.fixedTimewindow.startTimeMs; | ||
123 | - endTime = scope.timewindow.history.fixedTimewindow.endTimeMs; | ||
124 | - } | ||
125 | - } | ||
126 | - | ||
127 | - scope.reload = function() { | ||
128 | - scope.topIndex = 0; | ||
129 | - scope.selected = []; | ||
130 | - scope.updateTimeWindowRange(); | ||
131 | - scope.events = { | ||
132 | - data: [], | ||
133 | - nextPageLink: { | ||
134 | - limit: pageSize, | ||
135 | - startTime: startTime, | ||
136 | - endTime: endTime | ||
137 | - }, | ||
138 | - hasNext: true, | ||
139 | - pending: false | ||
140 | - }; | ||
141 | - scope.theEvents.getItemAtIndex(pageSize); | ||
142 | - } | ||
143 | - | ||
144 | - scope.noData = function() { | ||
145 | - return scope.events.data.length == 0 && !scope.events.hasNext; | ||
146 | - } | ||
147 | - | ||
148 | - scope.hasData = function() { | ||
149 | - return scope.events.data.length > 0; | ||
150 | - } | ||
151 | - | ||
152 | - scope.loading = function() { | ||
153 | - return $rootScope.loading; | ||
154 | - } | ||
155 | - | ||
156 | - scope.hasScroll = function() { | ||
157 | - var repeatContainer = scope.repeatContainer[0]; | ||
158 | - if (repeatContainer) { | ||
159 | - var scrollElement = repeatContainer.children[0]; | ||
160 | - if (scrollElement) { | ||
161 | - return scrollElement.scrollHeight > scrollElement.clientHeight; | ||
162 | - } | ||
163 | - } | ||
164 | - return false; | ||
165 | - } | ||
166 | - | ||
167 | - scope.subscriptionId = null; | ||
168 | - | ||
169 | - scope.loadEdgeInfo = function() { | ||
170 | - attributeService.getEntityAttributesValues( | ||
171 | - scope.entityType, | ||
172 | - scope.entityId, | ||
173 | - types.attributesScope.server.value, | ||
174 | - types.edgeAttributeKeys.queueStartTs, | ||
175 | - null).then( | ||
176 | - function success(attributes) { | ||
177 | - attributes.length > 0 ? scope.onEdgeAttributesUpdate(attributes) : scope.queueStartTs = 0; | ||
178 | - }); | ||
179 | - scope.checkSubscription(); | ||
180 | - } | ||
181 | - | ||
182 | - scope.onEdgeAttributesUpdate = function(attributes) { | ||
183 | - let edgeAttributes = attributes.reduce(function (map, attribute) { | ||
184 | - map[attribute.key] = attribute; | ||
185 | - return map; | ||
186 | - }, {}); | ||
187 | - if (edgeAttributes.queueStartTs) { | ||
188 | - scope.queueStartTs = edgeAttributes.queueStartTs.lastUpdateTs; | ||
189 | - } | ||
190 | - } | ||
191 | - | ||
192 | - scope.checkSubscription = function() { | ||
193 | - var newSubscriptionId = null; | ||
194 | - if (scope.entityId && scope.entityType && types.attributesScope.server.value) { | ||
195 | - newSubscriptionId = | ||
196 | - attributeService.subscribeForEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value); | ||
197 | - } | ||
198 | - if (scope.subscriptionId && scope.subscriptionId != newSubscriptionId) { | ||
199 | - attributeService.unsubscribeForEntityAttributes(scope.subscriptionId); | ||
200 | - } | ||
201 | - scope.subscriptionId = newSubscriptionId; | ||
202 | - } | ||
203 | - | ||
204 | - scope.$on('$destroy', function () { | ||
205 | - if (scope.subscriptionId) { | ||
206 | - attributeService.unsubscribeForEntityAttributes(scope.subscriptionId); | ||
207 | - } | ||
208 | - }); | ||
209 | - | ||
210 | - scope.reload(); | ||
211 | - | ||
212 | - $compile(element.contents())(scope); | ||
213 | - } | ||
214 | - function prepareEdgeEventData(data) { | ||
215 | - | ||
216 | - data.forEach( | ||
217 | - edgeEvent => { | ||
218 | - edgeEvent.edgeEventActionText = $translate.instant(types.edgeEventActionType[edgeEvent.action].name); | ||
219 | - edgeEvent.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeEvent.edgeId.entityType].name); | ||
220 | - } | ||
221 | - ); | ||
222 | - return data; | ||
223 | - } | ||
224 | - | ||
225 | - return { | ||
226 | - restrict: "E", | ||
227 | - link: linker, | ||
228 | - scope: { | ||
229 | - entityType: '=', | ||
230 | - entityId: '=', | ||
231 | - tenantId: '=' | ||
232 | - } | ||
233 | - }; | ||
234 | -} |
ui/src/app/event/edge-downlinks-table.tpl.html
deleted
100644 → 0
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 | -<md-content flex class="md-padding tb-absolute-fill" layout="column"> | ||
19 | - <section layout="row"> | ||
20 | - <tb-timewindow flex ng-model="timewindow" history-only as-button="true"></tb-timewindow> | ||
21 | - <md-button ng-disabled="$root.loading" | ||
22 | - class="md-icon-button" ng-click="reload()"> | ||
23 | - <md-icon>refresh</md-icon> | ||
24 | - <md-tooltip md-direction="top"> | ||
25 | - {{ 'action.refresh' | translate }} | ||
26 | - </md-tooltip> | ||
27 | - </md-button> | ||
28 | - </section> | ||
29 | - <md-list flex layout="column" class="md-whiteframe-z1 tb-edge-downlinks-table-old"> | ||
30 | - <md-list class="tb-row tb-header" layout="row" layout-align="start center" tb-event-header event-type="{{eventType}}"> | ||
31 | - </md-list> | ||
32 | - <md-progress-linear style="max-height: 0px;" md-mode="indeterminate" ng-disabled="!$root.loading" | ||
33 | - ng-show="$root.loading"></md-progress-linear> | ||
34 | - <md-divider></md-divider> | ||
35 | - <span translate layout-align="center center" | ||
36 | - style="margin-top: 25px;" | ||
37 | - class="tb-prompt" ng-show="noData()">edge.no-downlinks-prompt</span> | ||
38 | - <md-virtual-repeat-container ng-show="hasData()" flex md-top-index="topIndex" tb-scope-element="repeatContainer"> | ||
39 | - <md-list-item md-virtual-repeat="event in theEvents" md-on-demand flex ng-style="hasScroll() ? {'margin-right':'-15px'} : {}"> | ||
40 | - <md-list class="tb-row" flex layout="row" layout-align="start center" tb-event-row event-type="{{eventType}}" event="{{event}}"> | ||
41 | - </md-list> | ||
42 | - <md-divider flex></md-divider> | ||
43 | - </md-list-item> | ||
44 | - </md-virtual-repeat-container> | ||
45 | - </md-list> | ||
46 | -</md-content> |
ui/src/app/event/event-header-edge-event.tpl.html
deleted
100644 → 0
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="20">event.event-time</div> | ||
19 | -<div translate class="tb-cell" flex="10">event.event-type</div> | ||
20 | -<div translate class="tb-cell" flex="15">edge.event-action</div> | ||
21 | -<div translate class="tb-cell" flex="30">edge.entity-id</div> | ||
22 | -<div translate class="tb-cell" flex="15">edge.status</div> | ||
23 | -<div translate class="tb-cell" flex="10">edge.entity-info</div> |
@@ -19,7 +19,6 @@ import eventHeaderLcEventTemplate from './event-header-lc-event.tpl.html'; | @@ -19,7 +19,6 @@ 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 edgeDownlinksHeaderTemplate from './event-header-edge-event.tpl.html' | ||
23 | 22 | ||
24 | /* eslint-enable import/no-unresolved, import/default */ | 23 | /* eslint-enable import/no-unresolved, import/default */ |
25 | 24 | ||
@@ -46,9 +45,6 @@ export default function EventHeaderDirective($compile, $templateCache, types) { | @@ -46,9 +45,6 @@ export default function EventHeaderDirective($compile, $templateCache, types) { | ||
46 | case types.debugEventType.debugRuleChain.value: | 45 | case types.debugEventType.debugRuleChain.value: |
47 | template = eventHeaderDebugRuleNodeTemplate; | 46 | template = eventHeaderDebugRuleNodeTemplate; |
48 | break; | 47 | break; |
49 | - case types.edgeDownlinks.value: | ||
50 | - template = edgeDownlinksHeaderTemplate; | ||
51 | - break; | ||
52 | } | 48 | } |
53 | return $templateCache.get(template); | 49 | return $templateCache.get(template); |
54 | } | 50 | } |
ui/src/app/event/event-row-edge-event.tpl.html
deleted
100644 → 0
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="20">{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}</div> | ||
19 | -<div class="tb-cell" flex="10">{{ event.edgeEventTypeText }}</div> | ||
20 | -<div class="tb-cell" flex="15">{{ event.edgeEventActionText }}</div> | ||
21 | -<div class="tb-cell" flex="30">{{ event.entityId }}</div> | ||
22 | -<div class="tb-cell" flex="15" ng-style="{'color': statusColor}">{{ updateStatus(event.createdTime) }}</div> | ||
23 | -<div class="tb-cell" flex="10"> | ||
24 | - <md-button ng-if="checkEdgeEventType(event.type)" 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 | - | ||
37 | - |
@@ -21,13 +21,12 @@ import eventRowLcEventTemplate from './event-row-lc-event.tpl.html'; | @@ -21,13 +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 edgeDownlinlsRowTemplate from './event-row-edge-event.tpl.html'; | ||
25 | 24 | ||
26 | /* eslint-enable import/no-unresolved, import/default */ | 25 | /* eslint-enable import/no-unresolved, import/default */ |
27 | 26 | ||
28 | /*@ngInject*/ | 27 | /*@ngInject*/ |
29 | export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, | 28 | export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, |
30 | - types, utils, toast, entityService, ruleChainService) { | 29 | + types, utils) { |
31 | 30 | ||
32 | var linker = function (scope, element, attrs) { | 31 | var linker = function (scope, element, attrs) { |
33 | 32 | ||
@@ -49,9 +48,6 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | @@ -49,9 +48,6 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | ||
49 | case types.debugEventType.debugRuleChain.value: | 48 | case types.debugEventType.debugRuleChain.value: |
50 | template = eventRowDebugRuleNodeTemplate; | 49 | template = eventRowDebugRuleNodeTemplate; |
51 | break; | 50 | break; |
52 | - case types.edgeDownlinks.value: | ||
53 | - template = edgeDownlinlsRowTemplate; | ||
54 | - break; | ||
55 | } | 51 | } |
56 | return $templateCache.get(template); | 52 | return $templateCache.get(template); |
57 | } | 53 | } |
@@ -98,85 +94,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | @@ -98,85 +94,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ | ||
98 | }); | 94 | }); |
99 | } | 95 | } |
100 | 96 | ||
101 | - scope.showEdgeEntityContent = function($event, title, contentType) { | ||
102 | - var onShowingCallback = { | ||
103 | - onShowing: function(){} | ||
104 | - } | ||
105 | - if (!contentType) { | ||
106 | - contentType = null; | ||
107 | - } | ||
108 | - var content = ''; | ||
109 | - switch(scope.event.type) { | ||
110 | - case types.edgeEventType.relation: | ||
111 | - content = angular.toJson(scope.event.body); | ||
112 | - showDialog(); | ||
113 | - break; | ||
114 | - case types.edgeEventType.ruleChainMetaData: | ||
115 | - content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then( | ||
116 | - function success(info) { | ||
117 | - showDialog(); | ||
118 | - return angular.toJson(info); | ||
119 | - }, function fail() { | ||
120 | - showError(); | ||
121 | - }); | ||
122 | - break; | ||
123 | - default: | ||
124 | - content = entityService.getEntity(scope.event.type, scope.event.entityId, {ignoreErrors: true}).then( | ||
125 | - function success(info) { | ||
126 | - showDialog(); | ||
127 | - return angular.toJson(info); | ||
128 | - }, function fail() { | ||
129 | - showError(); | ||
130 | - }); | ||
131 | - break; | ||
132 | - } | ||
133 | - function showDialog() { | ||
134 | - $mdDialog.show({ | ||
135 | - controller: 'EventContentDialogController', | ||
136 | - controllerAs: 'vm', | ||
137 | - templateUrl: eventErrorDialogTemplate, | ||
138 | - locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, | ||
139 | - parent: angular.element($document[0].body), | ||
140 | - fullscreen: true, | ||
141 | - targetEvent: $event, | ||
142 | - multiple: true, | ||
143 | - onShowing: function(scope, element) { | ||
144 | - onShowingCallback.onShowing(scope, element); | ||
145 | - } | ||
146 | - }); | ||
147 | - } | ||
148 | - function showError() { | ||
149 | - toast.showError($translate.instant('edge.load-entity-error')); | ||
150 | - } | ||
151 | - } | ||
152 | - | ||
153 | - scope.checkEdgeEventType = function (type) { | ||
154 | - return !(type === types.edgeEventType.widgetType || | ||
155 | - type === types.edgeEventType.adminSettings || | ||
156 | - type === types.edgeEventType.widgetsBundle ); | ||
157 | - } | ||
158 | - | ||
159 | - scope.checkTooltip = function($event) { | ||
160 | - var el = $event.target; | ||
161 | - var $el = angular.element(el); | ||
162 | - if(el.offsetWidth < el.scrollWidth && !$el.attr('title')){ | ||
163 | - $el.attr('title', $el.text()); | ||
164 | - } | ||
165 | - } | ||
166 | - | ||
167 | $compile(element.contents())(scope); | 97 | $compile(element.contents())(scope); |
168 | - | ||
169 | - scope.updateStatus = function(eventCreatedTime) { | ||
170 | - var status; | ||
171 | - if (eventCreatedTime < scope.queueStartTs) { | ||
172 | - status = $translate.instant(types.edgeEventStatus.DEPLOYED.name); | ||
173 | - scope.statusColor = types.edgeEventStatus.DEPLOYED.color; | ||
174 | - } else { | ||
175 | - status = $translate.instant(types.edgeEventStatus.PENDING.name); | ||
176 | - scope.statusColor = types.edgeEventStatus.PENDING.color; | ||
177 | - } | ||
178 | - return status; | ||
179 | - } | ||
180 | } | 98 | } |
181 | 99 | ||
182 | return { | 100 | return { |
@@ -85,10 +85,6 @@ md-list.tb-event-table { | @@ -85,10 +85,6 @@ md-list.tb-event-table { | ||
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | -.tb-edge-downlinks-table { | ||
89 | - @extend .tb-event-table; | ||
90 | -} | ||
91 | - | ||
92 | #tb-event-content { | 88 | #tb-event-content { |
93 | width: 100%; | 89 | width: 100%; |
94 | min-width: 400px; | 90 | min-width: 400px; |
@@ -19,7 +19,6 @@ import EventContentDialogController from './event-content-dialog.controller'; | @@ -19,7 +19,6 @@ import EventContentDialogController from './event-content-dialog.controller'; | ||
19 | import EventHeaderDirective from './event-header.directive'; | 19 | import EventHeaderDirective from './event-header.directive'; |
20 | import EventRowDirective from './event-row.directive'; | 20 | import EventRowDirective from './event-row.directive'; |
21 | import EventTableDirective from './event-table.directive'; | 21 | import EventTableDirective from './event-table.directive'; |
22 | -import EdgeDownlinksDirective from "./edge-downlinks-table.directive"; | ||
23 | 22 | ||
24 | export default angular.module('thingsboard.event', [ | 23 | export default angular.module('thingsboard.event', [ |
25 | thingsboardApiEvent | 24 | thingsboardApiEvent |
@@ -28,5 +27,4 @@ export default angular.module('thingsboard.event', [ | @@ -28,5 +27,4 @@ export default angular.module('thingsboard.event', [ | ||
28 | .directive('tbEventHeader', EventHeaderDirective) | 27 | .directive('tbEventHeader', EventHeaderDirective) |
29 | .directive('tbEventRow', EventRowDirective) | 28 | .directive('tbEventRow', EventRowDirective) |
30 | .directive('tbEventTable', EventTableDirective) | 29 | .directive('tbEventTable', EventTableDirective) |
31 | - .directive('tbEdgeDownlinksTableOld', EdgeDownlinksDirective) | ||
32 | .name; | 30 | .name; |