Version set to 1.1.1-SNAPSHOT. UI Widgets: Performance improvements, timeseries zoom support.

This commit is contained in:
Igor Kulikov 2017-02-09 18:33:03 +02:00
parent d751ace71c
commit cf22f6a4b3
26 changed files with 133 additions and 81 deletions

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>common</artifactId>
</parent>
<groupId>org.thingsboard.common</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>common</artifactId>
</parent>
<groupId>org.thingsboard.common</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>common</artifactId>
</parent>
<groupId>org.thingsboard.common</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>extensions</artifactId>
</parent>
<groupId>org.thingsboard.extensions</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>extensions</artifactId>
</parent>
<groupId>org.thingsboard.extensions</groupId>

View File

@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>extensions</artifactId>
</parent>
<groupId>org.thingsboard.extensions</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.thingsboard</groupId>
<artifactId>thingsboard</artifactId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Thingsboard</name>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>transport</artifactId>
</parent>
<groupId>org.thingsboard.transport</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>transport</artifactId>
</parent>
<groupId>org.thingsboard.transport</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>transport</artifactId>
</parent>
<groupId>org.thingsboard.transport</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.thingsboard</groupId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>thingsboard</artifactId>
</parent>
<groupId>org.thingsboard</groupId>

View File

@ -61,7 +61,7 @@ function DatasourceService($timeout, $log, telemetryWebsocketService, types, uti
};
if (listener.widget.type === types.widgetType.timeseries.value) {
datasourceSubscription.subscriptionTimewindow = listener.subscriptionTimewindow;
datasourceSubscription.subscriptionTimewindow = angular.copy(listener.subscriptionTimewindow);
}
if (datasourceSubscription.datasourceType === types.datasourceType.device) {
datasourceSubscription.deviceId = listener.deviceId;

View File

@ -220,7 +220,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
dataStream.onError(onError);
dataStream.onOpen(onOpen);
dataStream.onClose(onClose);
dataStream.onMessage(onMessage);
dataStream.onMessage(onMessage, {autoApply: false});
}
function closeSocket() {

View File

@ -164,13 +164,14 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
gridsterParent = $('#gridster-parent', $element);
gridsterElement = angular.element($('#gridster-child', gridsterParent));
gridsterParent.scroll(function () {
//TODO: widgets visibility
/*gridsterParent.scroll(function () {
updateVisibleRect();
});
gridsterParent.resize(function () {
updateVisibleRect();
});
});*/
$scope.$watch('vm.isMobile', function () {
vm.gridsterOpts.isMobile = vm.isMobileDisabled ? false : vm.isMobile;
@ -188,7 +189,8 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
gridster.columns = vm.columns;
updateGridsterParams();
}
updateVisibleRect();
//TODO: widgets visibility
//updateVisibleRect();
});
$scope.$watch('vm.margins', function () {
@ -197,7 +199,8 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
gridster.margins = vm.margins;
updateGridsterParams();
}
updateVisibleRect();
//TODO: widgets visibility
//updateVisibleRect();
});
$scope.$watch('vm.isEdit', function () {
@ -213,7 +216,8 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
$scope.$on('gridster-resized', function (event, sizes, theGridster) {
if (checkIsLocalGridsterElement(theGridster)) {
gridster = theGridster;
updateVisibleRect(false, true);
//TODO: widgets visibility
//updateVisibleRect(false, true);
}
});
@ -225,9 +229,10 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
} else {
vm.gridsterOpts.rowHeight = 'match';
}
$timeout(function () {
//TODO: widgets visibility
/*$timeout(function () {
updateVisibleRect(true);
}, 500, false);
}, 500, false);*/
}
});
@ -283,7 +288,8 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
}
}
function updateVisibleRect (force, containerResized) {
//TODO: widgets visibility
/*function updateVisibleRect (force, containerResized) {
if (gridster) {
var position = $(gridster.$element).position()
if (position) {
@ -321,7 +327,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $log, toast
}
}
}
}
}*/
function checkIsLocalGridsterElement (gridster) {
return gridsterElement[0] == gridster.$element[0];

View File

@ -44,16 +44,18 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
var targetDeviceAliasId = null;
var targetDeviceId = null;
var visible = false;
var bounds = {top: 0, left: 0, bottom: 0, right: 0};
//var bounds = {top: 0, left: 0, bottom: 0, right: 0};
//TODO: widgets visibility
/*var visible = false;*/
var lastWidth, lastHeight;
var containerParent = $($element);
var container = $('#container', $element);
var containerElement = container[0];
var inited = false;
var gridsterItemElement;
// var gridsterItemElement;
var timer;
var init = fns.init || function () {
@ -160,18 +162,20 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
};
vm.gridsterItemInitialized = gridsterItemInitialized;
vm.visibleRectChanged = visibleRectChanged;
function gridsterItemInitialized(item) {
if (item) {
gridsterItemElement = $(item.$element);
updateVisibility();
}
}
//TODO: widgets visibility
/*vm.visibleRectChanged = visibleRectChanged;
function visibleRectChanged(newVisibleRect) {
visibleRect = newVisibleRect;
updateVisibility();
}*/
function gridsterItemInitialized(item) {
if (item) {
// gridsterItemElement = $(item.$element);
//updateVisibility();
onRedraw();
}
}
initWidget();
@ -282,7 +286,8 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
}
}
function updateVisibility(forceRedraw) {
//TODO: widgets visibility
/*function updateVisibility(forceRedraw) {
if (visibleRect) {
forceRedraw = forceRedraw || visibleRect.containerResized;
var newVisible = false;
@ -306,21 +311,49 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
onRedraw(50);
}
}
}
}*/
function updateBounds() {
bounds = {
/*bounds = {
top: widget.row,
left: widget.col,
bottom: widget.row + widget.sizeY,
right: widget.col + widget.sizeX
};
updateVisibility(true);
updateVisibility(true);*/
onRedraw();
}
var originalTimewindow;
function onRedraw(delay, dataUpdate) {
//TODO:
var timewindowFunctions = {
onUpdateTimewindow: onUpdateTimewindow,
onResetTimewindow: onResetTimewindow
};
function onResetTimewindow() {
if (originalTimewindow) {
widget.config.timewindow = angular.copy(originalTimewindow);
originalTimewindow = null;
}
}
function onUpdateTimewindow(startTimeMs, endTimeMs) {
if (!originalTimewindow) {
originalTimewindow = angular.copy(widget.config.timewindow);
}
widget.config.timewindow = {
history: {
fixedTimewindow: {
startTimeMs: startTimeMs,
endTimeMs: endTimeMs
}
}
};
}
function onRedraw(delay, dataUpdate, tickUpdate) {
//TODO: widgets visibility
/*if (!visible) {
return;
}*/
@ -344,7 +377,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
if (width > 20 && height > 20) {
if (!inited) {
init(containerElement, widget.config.settings, widget.config.datasources, data, $scope, controlApi);
init(containerElement, widget.config.settings, widget.config.datasources, data, $scope, controlApi, timewindowFunctions);
inited = true;
}
if (widget.type === types.widgetType.timeseries.value) {
@ -360,7 +393,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
timeWindow.minTime = subscriptionTimewindow.fixedWindow.startTimeMs;
}
}
redraw(containerElement, width, height, data, timeWindow, sizeChanged, $scope);
redraw(containerElement, width, height, data, timeWindow, sizeChanged, $scope, dataUpdate, tickUpdate);
}
}, delay, false);
}
@ -406,11 +439,12 @@ export default function WidgetController($scope, $timeout, $window, $element, $q
var listener = datasourceListeners[i];
datasourceService.unsubscribeFromDatasource(listener);
}
datasourceListeners = [];
}
}
function onTick() {
onRedraw();
onRedraw(0, false, true);
timer = $timeout(onTick, 1000, false);
}

View File

@ -29,17 +29,19 @@ function Widget($controller, $compile, widgetService) {
scope: true,
link: function (scope, elem, attrs) {
var widgetController;
var locals = scope.$eval(attrs.locals);
var widget = locals.widget;
var widgetController;
var gridsterItem;
scope.$on('visibleRectChanged', function (event, newVisibleRect) {
//TODO: widgets visibility
/*scope.$on('visibleRectChanged', function (event, newVisibleRect) {
locals.visibleRect = newVisibleRect;
if (widgetController) {
widgetController.visibleRectChanged(newVisibleRect);
}
});
});*/
scope.$on('gridster-item-initialized', function (event, item) {
gridsterItem = item;
@ -125,6 +127,7 @@ function Widget($controller, $compile, widgetService) {
"deviceAliasList"];
widgetController = $controller(controllerFunction, locals);
if (gridsterItem) {
widgetController.gridsterItemInitialized(gridsterItem);
}

View File

@ -31,6 +31,7 @@ export default class TbMapWidget {
}
this.locationsSettings = [];
this.varsRegex = /\$\{([^\}]*)\}/g;
this.tooltipsUpdated = false;
if (settings.defaultZoomLevel) {
if (settings.defaultZoomLevel > 0 && settings.defaultZoomLevel < 21) {
@ -169,7 +170,7 @@ export default class TbMapWidget {
}
redraw(data, sizeChanged) {
redraw(data, sizeChanged, dataUpdate) {
var tbMap = this;
@ -406,7 +407,7 @@ export default class TbMapWidget {
if (data) {
if (!this.locations) {
loadLocations(data);
} else {
} else if (dataUpdate) {
updateLocations(data);
}
}
@ -426,29 +427,31 @@ export default class TbMapWidget {
}
}
var tooltips = this.map.getTooltips();
for (var t in tooltips) {
var tooltip = tooltips[t];
var text = tooltip.pattern;
var replaceInfo = tooltip.replaceInfo;
for (var v in replaceInfo.variables) {
var variableInfo = replaceInfo.variables[v];
var txtVal = '';
if (variableInfo.dataKeyIndex > -1) {
var varData = data[variableInfo.dataKeyIndex].data;
if (varData.length > 0) {
var val = varData[varData.length-1][1];
if (isNumber(val)) {
txtVal = padValue(val, variableInfo.valDec, 0);
} else {
txtVal = val;
if (!this.tooltipsUpdated || dataUpdate) {
this.tooltipsUpdated = true;
var tooltips = this.map.getTooltips();
for (var t in tooltips) {
var tooltip = tooltips[t];
var text = tooltip.pattern;
var replaceInfo = tooltip.replaceInfo;
for (var v in replaceInfo.variables) {
var variableInfo = replaceInfo.variables[v];
var txtVal = '';
if (variableInfo.dataKeyIndex > -1) {
var varData = data[variableInfo.dataKeyIndex].data;
if (varData.length > 0) {
var val = varData[varData.length - 1][1];
if (isNumber(val)) {
txtVal = padValue(val, variableInfo.valDec, 0);
} else {
txtVal = val;
}
}
}
text = text.split(variableInfo.variable).join(txtVal);
}
text = text.split(variableInfo.variable).join(txtVal);
tooltip.popup.setContent(text);
}
tooltip.popup.setContent(text);
}
}