diff --git a/application/pom.xml b/application/pom.xml
index d955418c91..2abfb870cb 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.scss b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.scss
index a009dbbb88..aecdb0ae5a 100644
--- a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.scss
+++ b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.scss
@@ -1,5 +1,5 @@
/**
- * Copyright © 2016-2020 The Thingsboard Authors
+ * Copyright © 2016-2021 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.ts b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.ts
index e6d17491f1..33adc55b59 100644
--- a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.ts
+++ b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-header.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table.component.html b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table.component.html
index 792765ba4d..acefb832fd 100644
--- a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table.component.html
+++ b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table.component.html
@@ -1,6 +1,6 @@
-
diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts b/ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts
index 43933270c2..b9e3246f7c 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts
+++ b/ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-predicate.scss b/ui-ngx/src/app/modules/home/components/filter/filter-predicate.scss
index 4b1b99f933..e88454b8b3 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filter-predicate.scss
+++ b/ui-ngx/src/app/modules/home/components/filter/filter-predicate.scss
@@ -1,5 +1,5 @@
/**
- * Copyright © 2016-2020 The Thingsboard Authors
+ * Copyright © 2016-2021 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
:host {
.tb-hint {
padding-bottom: 0;
diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-select.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-select.component.html
index 65249441ed..6821134cd5 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filter-select.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/filter-select.component.html
@@ -1,6 +1,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
index f69af45170..a0b8a83cd4 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
@@ -1,5 +1,5 @@
/**
- * Copyright © 2016-2020 The Thingsboard Authors
+ * Copyright © 2016-2021 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
index 1e7806b455..d664c5c2a4 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import {
EditAlarmDetailsDialogComponent,
EditAlarmDetailsDialogData
} from '@home/components/profile/alarm/edit-alarm-details-dialog.component';
+import { EntityId } from '@shared/models/id/entity-id';
@Component({
selector: 'tb-alarm-rule',
@@ -65,6 +66,9 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
this.requiredValue = coerceBooleanProperty(value);
}
+ @Input()
+ deviceProfileId: EntityId;
+
private modelValue: AlarmRule;
alarmRuleFormGroup: FormGroup;
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
index 64a808fe98..d82b17d2c5 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
@@ -1,6 +1,6 @@
-
| null;
objectsList: Array = [];
filteredObjectsList: Observable>;
- private disabled = false as boolean;
+ // TODO: voba - check this fix
+ // private disabled = false as boolean;
+ disabled = false as boolean;
searchText = '' as string;
- private dirty = false as boolean;
+ private dirty = false as boolean;Lwm2mObjectAddInstancesListComponent
get required(): boolean {
return this.requiredValue;
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html
index 322fba8086..2750aa694d 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html
@@ -1,6 +1,6 @@
-
tenant-profile.profile-configuration
-
-
+
+
+
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/tenant-profile-data.component.ts b/ui-ngx/src/app/modules/home/components/profile/tenant-profile-data.component.ts
index cc6ce7a6ce..4f2c5ba657 100644
--- a/ui-ngx/src/app/modules/home/components/profile/tenant-profile-data.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/tenant-profile-data.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/components/profile/tenant-profile-dialog.component.html b/ui-ngx/src/app/modules/home/components/profile/tenant-profile-dialog.component.html
index 75f75906d0..ef37564fd5 100644
--- a/ui-ngx/src/app/modules/home/components/profile/tenant-profile-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/tenant-profile-dialog.component.html
@@ -1,6 +1,6 @@
-
-
+
+
device-profile.transport-type
@@ -40,19 +40,19 @@
-
-
+ }}">
+
-
-
+
+
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.ts b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.ts
index cba34b4987..804b349cff 100644
--- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile.module.ts b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile.module.ts
index 09207057ac..b6b2b4b3fc 100644
--- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile.module.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profiles-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/device-profile/device-profiles-table-config.resolver.ts
index 60cb15c199..299c1e4015 100644
--- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profiles-table-config.resolver.ts
+++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profiles-table-config.resolver.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/pages/device/data/default-device-configuration.component.html b/ui-ngx/src/app/modules/home/pages/device/data/default-device-configuration.component.html
index 001cc16801..c66e70265d 100644
--- a/ui-ngx/src/app/modules/home/pages/device/data/default-device-configuration.component.html
+++ b/ui-ngx/src/app/modules/home/pages/device/data/default-device-configuration.component.html
@@ -1,6 +1,6 @@
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts
index 3647b69a84..8ebe66997b 100644
--- a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.models.ts b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.models.ts
index cd323e2f90..8d44c3da18 100644
--- a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.models.ts
+++ b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.models.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
index 2dc4a46a17..dec4fe0e78 100644
--- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
@@ -1,5 +1,5 @@
///
-/// Copyright © 2016-2020 The Thingsboard Authors
+/// Copyright © 2016-2021 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
@@ -189,7 +189,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: false,
- ruleChainType: RuleChainType.edge
+ ruleChainType: RuleChainType.EDGE
},
resolve: {
ruleChain: RuleChainResolver,
@@ -210,7 +210,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: true,
- ruleChainType: RuleChainType.edge
+ ruleChainType: RuleChainType.EDGE
},
resolve: {
ruleNodeComponents: RuleNodeComponentsResolver
diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html b/ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html
index 0155fb5013..6b1c51eeb1 100644
--- a/ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html
+++ b/ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html
@@ -1,6 +1,6 @@
+
+
+
+
{{ vm.title }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ 'action.close' |
+ translate }}
+
+
+
diff --git a/ui/src/app/edge/downlinks/edge-downlinks-header.directive.js b/ui/src/app/edge/downlinks/edge-downlinks-header.directive.js
new file mode 100644
index 0000000000..3af243ca48
--- /dev/null
+++ b/ui/src/app/edge/downlinks/edge-downlinks-header.directive.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2016-2020 The Thingsboard Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable import/no-unresolved, import/default */
+
+import edgeDownlinksHeaderTemplate from './edge-downlinks-header.tpl.html'
+
+/* eslint-enable import/no-unresolved, import/default */
+
+/*@ngInject*/
+export default function EdgeDownlinksHeaderDirective($compile, $templateCache) {
+
+ var linker = function (scope, element) {
+
+ var template = edgeDownlinksHeaderTemplate;
+
+ element.html($templateCache.get(template));
+ $compile(element.contents())(scope);
+ }
+
+ return {
+ restrict: "A",
+ replace: false,
+ link: linker,
+ scope: false
+ };
+}
diff --git a/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js b/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js
new file mode 100644
index 0000000000..16015d12db
--- /dev/null
+++ b/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js
@@ -0,0 +1,124 @@
+/*
+ * Copyright © 2016-2020 The Thingsboard Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable import/no-unresolved, import/default */
+
+import edgeDownlinksContentTemplate from './edge-downlinks-content-dialog.tpl.html';
+import edgeDownlinlsRowTemplate from './edge-downlinks-row.tpl.html';
+
+/* eslint-enable import/no-unresolved, import/default */
+
+/*@ngInject*/
+export default function EdgeDownlinksRowDirective($compile, $templateCache, $mdDialog, $document, $translate,
+ types, utils, toast, entityService, ruleChainService) {
+
+ var linker = function (scope, element, attrs) {
+
+ var template = edgeDownlinlsRowTemplate;
+
+ element.html($templateCache.get(template));
+ $compile(element.contents())(scope);
+
+ scope.types = types;
+ scope.downlink = attrs.downlink;
+
+ scope.showEdgeEntityContent = function($event, title, contentType) {
+ var onShowingCallback = {
+ onShowing: function(){}
+ }
+ if (!contentType) {
+ contentType = null;
+ }
+ var content = '';
+ switch(scope.downlink.type) {
+ case types.edgeEventType.relation:
+ content = angular.toJson(scope.downlink.body);
+ showDialog();
+ break;
+ case types.edgeEventType.ruleChainMetaData:
+ content = ruleChainService.getRuleChainMetaData(scope.downlink.entityId, {ignoreErrors: true}).then(
+ function success(info) {
+ showDialog();
+ return angular.toJson(info);
+ }, function fail() {
+ showError();
+ });
+ break;
+ default:
+ content = entityService.getEntity(scope.downlink.type, scope.downlink.entityId, {ignoreErrors: true}).then(
+ function success(info) {
+ showDialog();
+ return angular.toJson(info);
+ }, function fail() {
+ showError();
+ });
+ break;
+ }
+ function showDialog() {
+ $mdDialog.show({
+ controller: 'EdgeDownlinksContentDialogController',
+ controllerAs: 'vm',
+ templateUrl: edgeDownlinksContentTemplate,
+ locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback},
+ parent: angular.element($document[0].body),
+ fullscreen: true,
+ targetEvent: $event,
+ multiple: true,
+ onShowing: function(scope, element) {
+ onShowingCallback.onShowing(scope, element);
+ }
+ });
+ }
+ function showError() {
+ toast.showError($translate.instant('edge.load-entity-error'));
+ }
+ }
+
+ scope.checkEdgeDownlinksType = function (type) {
+ return !(type === types.edgeEventType.widgetType ||
+ type === types.edgeEventType.adminSettings ||
+ type === types.edgeEventType.widgetsBundle );
+ }
+
+ scope.checkTooltip = function($event) {
+ var el = $event.target;
+ var $el = angular.element(el);
+ if(el.offsetWidth < el.scrollWidth && !$el.attr('title')){
+ $el.attr('title', $el.text());
+ }
+ }
+
+ $compile(element.contents())(scope);
+
+ scope.updateStatus = function(downlinkCreatedTime) {
+ var status;
+ if (downlinkCreatedTime < scope.queueStartTs) {
+ status = $translate.instant(types.edgeEventStatus.DEPLOYED.name);
+ scope.statusColor = types.edgeEventStatus.DEPLOYED.color;
+ } else {
+ status = $translate.instant(types.edgeEventStatus.PENDING.name);
+ scope.statusColor = types.edgeEventStatus.PENDING.color;
+ }
+ return status;
+ }
+ }
+
+ return {
+ restrict: "A",
+ replace: false,
+ link: linker,
+ scope: false
+ };
+}
diff --git a/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js b/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js
new file mode 100644
index 0000000000..98bd63abb0
--- /dev/null
+++ b/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js
@@ -0,0 +1,230 @@
+/*
+ * Copyright © 2016-2020 The Thingsboard Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import './downlink.scss';
+
+/* eslint-disable import/no-unresolved, import/default */
+
+import edgeDownlinksTableTemplate from './edge-downlinks-table.tpl.html';
+
+/* eslint-enable import/no-unresolved, import/default */
+
+/*@ngInject*/
+export default function EdgeDownlinksDirective($compile, $templateCache, $rootScope, $translate, types, edgeService, attributeService) {
+
+ var linker = function (scope, element) {
+
+ var template = $templateCache.get(edgeDownlinksTableTemplate);
+ element.html(template);
+
+ var pageSize = 20;
+ var startTime = 0;
+ var endTime = 0;
+
+ scope.timewindow = {
+ history: {
+ timewindowMs: 24 * 60 * 60 * 1000 // 1 day
+ }
+ }
+
+ scope.topIndex = 0;
+
+ scope.theDownlinks = {
+ getItemAtIndex: function (index) {
+ if (index > scope.downlinks.data.length) {
+ scope.theDownlinks.fetchMoreItems_(index);
+ return null;
+ }
+ var item = scope.downlinks.data[index];
+ if (item) {
+ item.indexNumber = index + 1;
+ }
+ return item;
+ },
+
+ getLength: function () {
+ if (scope.downlinks.hasNext) {
+ return scope.downlinks.data.length + scope.downlinks.nextPageLink.limit;
+ } else {
+ return scope.downlinks.data.length;
+ }
+ },
+
+ fetchMoreItems_: function () {
+ if (scope.downlinks.hasNext && !scope.downlinks.pending) {
+ if (scope.entityType && scope.entityId && scope.tenantId) {
+ scope.loadEdgeInfo();
+ scope.downlinks.pending = true;
+ edgeService.getEdgeEvents(scope.entityId, scope.downlinks.nextPageLink).then(
+ function success(downlinks) {
+ scope.downlinks.data = scope.downlinks.data.concat(prepareEdgeDownlinksData(downlinks.data));
+ scope.downlinks.nextPageLink = downlinks.nextPageLink;
+ scope.downlinks.hasNext = downlinks.hasNext;
+ if (scope.downlinks.hasNext) {
+ scope.downlinks.nextPageLink.limit = pageSize;
+ }
+ scope.downlinks.pending = false;
+ },
+ function fail() {
+ scope.downlinks.hasNext = false;
+ scope.downlinks.pending = false;
+ });
+ } else {
+ scope.downlinks.hasNext = false;
+ }
+ }
+ }
+ };
+
+ scope.$watch("entityId", function(newVal, prevVal) {
+ if (newVal && !angular.equals(newVal, prevVal)) {
+ scope.resetFilter();
+ scope.reload();
+ }
+ });
+
+ scope.$watch("timewindow", function(newVal, prevVal) {
+ if (newVal && !angular.equals(newVal, prevVal)) {
+ scope.reload();
+ }
+ }, true);
+
+ scope.resetFilter = function() {
+ scope.timewindow = {
+ history: {
+ timewindowMs: 24 * 60 * 60 * 1000 // 1 day
+ }
+ };
+ }
+
+ scope.updateTimeWindowRange = function() {
+ if (scope.timewindow.history.timewindowMs) {
+ var currentTime = (new Date).getTime();
+ startTime = currentTime - scope.timewindow.history.timewindowMs;
+ endTime = currentTime;
+ } else {
+ startTime = scope.timewindow.history.fixedTimewindow.startTimeMs;
+ endTime = scope.timewindow.history.fixedTimewindow.endTimeMs;
+ }
+ }
+
+ scope.reload = function() {
+ scope.topIndex = 0;
+ scope.selected = [];
+ scope.updateTimeWindowRange();
+ scope.downlinks = {
+ data: [],
+ nextPageLink: {
+ limit: pageSize,
+ startTime: startTime,
+ endTime: endTime
+ },
+ hasNext: true,
+ pending: false
+ };
+ scope.theDownlinks.getItemAtIndex(pageSize);
+ }
+
+ scope.noData = function() {
+ return scope.downlinks.data.length == 0 && !scope.downlinks.hasNext;
+ }
+
+ scope.hasData = function() {
+ return scope.downlinks.data.length > 0;
+ }
+
+ scope.loading = function() {
+ return $rootScope.loading;
+ }
+
+ scope.hasScroll = function() {
+ var repeatContainer = scope.repeatContainer[0];
+ if (repeatContainer) {
+ var scrollElement = repeatContainer.children[0];
+ if (scrollElement) {
+ return scrollElement.scrollHeight > scrollElement.clientHeight;
+ }
+ }
+ return false;
+ }
+
+ scope.subscriptionId = null;
+
+ scope.loadEdgeInfo = function() {
+ attributeService.getEntityAttributesValues(
+ scope.entityType,
+ scope.entityId,
+ types.attributesScope.server.value,
+ types.edgeAttributeKeys.queueStartTs,
+ null).then(
+ function success(attributes) {
+ attributes.length > 0 ? scope.onEdgeAttributesUpdate(attributes) : scope.queueStartTs = 0;
+ });
+ scope.checkSubscription();
+ }
+
+ scope.onEdgeAttributesUpdate = function(attributes) {
+ let edgeAttributes = attributes.reduce(function (map, attribute) {
+ map[attribute.key] = attribute;
+ return map;
+ }, {});
+ if (edgeAttributes.queueStartTs) {
+ scope.queueStartTs = edgeAttributes.queueStartTs.lastUpdateTs;
+ }
+ }
+
+ scope.checkSubscription = function() {
+ var newSubscriptionId = null;
+ if (scope.entityId && scope.entityType && types.attributesScope.server.value) {
+ newSubscriptionId =
+ attributeService.subscribeForEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value);
+ }
+ if (scope.subscriptionId && scope.subscriptionId != newSubscriptionId) {
+ attributeService.unsubscribeForEntityAttributes(scope.subscriptionId);
+ }
+ scope.subscriptionId = newSubscriptionId;
+ }
+
+ scope.$on('$destroy', function () {
+ if (scope.subscriptionId) {
+ attributeService.unsubscribeForEntityAttributes(scope.subscriptionId);
+ }
+ });
+
+ scope.reload();
+
+ $compile(element.contents())(scope);
+ }
+ function prepareEdgeDownlinksData(data) {
+
+ data.forEach(
+ edgeDownlink => {
+ edgeDownlink.edgeEventActionText = $translate.instant(types.edgeEventActionTypeTranslations[edgeDownlink.action].name);
+ edgeDownlink.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeDownlink.type].name);
+ }
+ );
+ return data;
+ }
+
+ return {
+ restrict: "E",
+ link: linker,
+ scope: {
+ entityType: '=',
+ entityId: '=',
+ tenantId: '='
+ }
+ };
+}
diff --git a/ui/src/app/edge/downlinks/edge-downlinks-table.tpl.html b/ui/src/app/edge/downlinks/edge-downlinks-table.tpl.html
new file mode 100644
index 0000000000..0e66b2b685
--- /dev/null
+++ b/ui/src/app/edge/downlinks/edge-downlinks-table.tpl.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+ refresh
+
+ {{ 'action.refresh' | translate }}
+
+
+
+
+
+
+
+ edge.no-downlinks-prompt
+
+
+
+
+
+
+
+
+