From 8e2dfc3ea4856f677f52090f2e1890cb4d2181a1 Mon Sep 17 00:00:00 2001 From: oleg Date: Fri, 29 Dec 2017 10:35:53 +0200 Subject: [PATCH 01/10] "Timeseries - Flot" widget improvements --- ui/src/app/widget/lib/flot-widget.js | 79 +++++++++++++++++----------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/ui/src/app/widget/lib/flot-widget.js b/ui/src/app/widget/lib/flot-widget.js index 59787cf920..4e5f99f919 100644 --- a/ui/src/app/widget/lib/flot-widget.js +++ b/ui/src/app/widget/lib/flot-widget.js @@ -238,19 +238,30 @@ export default class TbFlot { if (this.ticksFormatterFunction) { return this.ticksFormatterFunction(value); } - var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, - formatted = "" + Math.round(value * factor) / factor; - if (this.tickDecimals != null) { - var decimal = formatted.indexOf("."), - precision = decimal === -1 ? 0 : formatted.length - decimal - 1; - - if (precision < this.tickDecimals) { - formatted = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); - } + if (this.tickDecimals) { + value = value.toFixed(this.tickDecimals); } - formatted += ' ' + this.tickUnits; - return formatted; - } + if (this.tickUnits) { + value = value + ' ' + this.tickUnits; + } + if (this.tickSize) { + return value; + } + + // var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, + // formatted = "" + Math.round(value * factor) / factor; + // if (this.tickDecimals != null) { + // var decimal = formatted.indexOf("."), + // precision = decimal === -1 ? 0 : formatted.length - decimal - 1; + // + // if (precision < this.tickDecimals) { + // formatted = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); + // } + // } + // formatted += ' ' + this.tickUnits; + return value; + + }; this.yaxis.tickFormatter = ctx.yAxisTickFormatter; @@ -262,6 +273,8 @@ export default class TbFlot { this.yaxis.labelFont.color = this.yaxis.font.color; this.yaxis.labelFont.size = this.yaxis.font.size+2; this.yaxis.labelFont.weight = "bold"; + this.yaxis.tickSize = settings.yaxis.tickSize || null; + this.yaxis.tickDecimals = settings.yaxis.tickDecimals || null; if (settings.yaxis.ticksFormatter && settings.yaxis.ticksFormatter.length) { try { this.yaxis.ticksFormatterFunction = new Function('value', settings.yaxis.ticksFormatter); @@ -489,7 +502,7 @@ export default class TbFlot { var yaxis = angular.copy(this.yaxis); var label = keySettings.axisTitle && keySettings.axisTitle.length ? keySettings.axisTitle : yaxis.label; - var tickDecimals = angular.isDefined(keySettings.axisTickDecimals) ? keySettings.axisTickDecimals : 0; + //var tickDecimals = angular.isDefined(keySettings.axisTickDecimals) ? keySettings.axisTickDecimals : 0; var position = keySettings.axisPosition && keySettings.axisPosition.length ? keySettings.axisPosition : "left"; var min = angular.isDefined(keySettings.axisMin) ? keySettings.axisMin : yaxis.min; @@ -499,7 +512,6 @@ export default class TbFlot { yaxis.min = min; yaxis.max = max; yaxis.tickUnits = units; - yaxis.tickDecimals = tickDecimals; yaxis.alignTicksWithAxis = position == "right" ? 1 : null; yaxis.position = position; @@ -904,6 +916,11 @@ export default class TbFlot { "type": "number", "default": null }, + "tickSize": { + "title": "Step size between ticks", + "type": "number", + "default": null + }, "showLabels": { "title": "Show labels", "type": "boolean", @@ -928,7 +945,13 @@ export default class TbFlot { "title": "Ticks formatter function, f(value)", "type": "string", "default": "" + }, + "tickDecimals": { + "title": "The number of decimals to display", + "type": "number", + "default": 0 } + } } }, @@ -986,6 +1009,8 @@ export default class TbFlot { "items": [ "yaxis.min", "yaxis.max", + "yaxis.tickSize", + "yaxis.tickDecimals", "yaxis.showLabels", "yaxis.title", "yaxis.titleAngle", @@ -1010,24 +1035,24 @@ export default class TbFlot { static datakeySettingsSchema(defaultShowLines) { return { - "schema": { + "schema": { "type": "object", - "title": "DataKeySettings", - "properties": { + "title": "DataKeySettings", + "properties": { "showLines": { "title": "Show lines", - "type": "boolean", - "default": defaultShowLines + "type": "boolean", + "default": defaultShowLines }, "fillLines": { "title": "Fill lines", - "type": "boolean", - "default": false + "type": "boolean", + "default": false }, "showPoints": { "title": "Show points", - "type": "boolean", - "default": false + "type": "boolean", + "default": false }, "tooltipValueFormatter": { "title": "Tooltip value format function, f(value)", @@ -1054,11 +1079,6 @@ export default class TbFlot { "type": "string", "default": "" }, - "axisTickDecimals": { - "title": "Axis tick number of digits after floating point", - "type": "number", - "default": 0 - }, "axisPosition": { "title": "Axis position", "type": "string", @@ -1072,7 +1092,7 @@ export default class TbFlot { }, "required": ["showLines", "fillLines", "showPoints"] }, - "form": [ + "form": [ "showLines", "fillLines", "showPoints", @@ -1084,7 +1104,6 @@ export default class TbFlot { "axisMin", "axisMax", "axisTitle", - "axisTickDecimals", { "key": "axisPosition", "type": "rc-select", From 7e0d4df80858be80776bcf0f87bb149e8164218d Mon Sep 17 00:00:00 2001 From: oleg Date: Thu, 11 Jan 2018 18:08:36 +0200 Subject: [PATCH 02/10] Attribute subscription --- .../core/plugin/telemetry/SubscriptionManager.java | 9 +++++++-- .../telemetry/handlers/TelemetryRpcMsgHandler.java | 3 ++- .../telemetry/handlers/TelemetryWebsocketMsgHandler.java | 8 ++++---- .../core/plugin/telemetry/sub/Subscription.java | 4 ++++ .../core/plugin/telemetry/sub/SubscriptionState.java | 1 + extensions-core/src/main/proto/telemetry.proto | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/SubscriptionManager.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/SubscriptionManager.java index d137e10fbd..bad1678d77 100644 --- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/SubscriptionManager.java +++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/SubscriptionManager.java @@ -33,6 +33,7 @@ import org.thingsboard.server.extensions.core.plugin.telemetry.sub.SubscriptionU import java.util.*; import java.util.function.Function; +import java.util.function.Predicate; /** * @author Andrew Shvayka @@ -174,9 +175,13 @@ public class SubscriptionManager { } public void onLocalSubscriptionUpdate(PluginContext ctx, EntityId entityId, SubscriptionType type, Function> f) { + onLocalSubscriptionUpdate(ctx, entityId, s -> type == s.getType(), f); + } + + public void onLocalSubscriptionUpdate(PluginContext ctx, EntityId entityId, Predicate filter, Function> f) { Set deviceSubscriptions = subscriptionsByEntityId.get(entityId); if (deviceSubscriptions != null) { - deviceSubscriptions.stream().filter(s -> type == s.getType()).forEach(s -> { + deviceSubscriptions.stream().filter(filter).forEach(s -> { String sessionId = s.getWsSessionId(); List subscriptionUpdate = f.apply(s); if (!subscriptionUpdate.isEmpty()) { @@ -206,7 +211,7 @@ public class SubscriptionManager { public void onAttributesUpdateFromServer(PluginContext ctx, EntityId entityId, String scope, List attributes) { Optional serverAddress = ctx.resolve(entityId); if (!serverAddress.isPresent()) { - onLocalSubscriptionUpdate(ctx, entityId, SubscriptionType.ATTRIBUTES, s -> { + onLocalSubscriptionUpdate(ctx, entityId, s -> SubscriptionType.ATTRIBUTES == s.getType() && scope.equals(s.getScope()), s -> { List subscriptionUpdate = new ArrayList(); for (AttributeKvEntry kv : attributes) { if (s.isAllKeys() || s.getKeyStates().containsKey(kv.getKey())) { diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryRpcMsgHandler.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryRpcMsgHandler.java index ba5d61080e..874c480f0d 100644 --- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryRpcMsgHandler.java +++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryRpcMsgHandler.java @@ -114,7 +114,7 @@ public class TelemetryRpcMsgHandler implements RpcMsgHandler { } Map statesMap = proto.getKeyStatesList().stream().collect(Collectors.toMap(SubscriptionKetStateProto::getKey, SubscriptionKetStateProto::getTs)); Subscription subscription = new Subscription( - new SubscriptionState(proto.getSessionId(), proto.getSubscriptionId(), EntityIdFactory.getByTypeAndId(proto.getEntityType(), proto.getEntityId()), SubscriptionType.valueOf(proto.getType()), proto.getAllKeys(), statesMap), + new SubscriptionState(proto.getSessionId(), proto.getSubscriptionId(), EntityIdFactory.getByTypeAndId(proto.getEntityType(), proto.getEntityId()), SubscriptionType.valueOf(proto.getType()), proto.getAllKeys(), statesMap, proto.getScope()), false, msg.getServerAddress()); subscriptionManager.addRemoteWsSubscription(ctx, msg.getServerAddress(), proto.getSessionId(), subscription); } @@ -127,6 +127,7 @@ public class TelemetryRpcMsgHandler implements RpcMsgHandler { builder.setEntityId(cmd.getEntityId().getId().toString()); builder.setType(cmd.getType().name()); builder.setAllKeys(cmd.isAllKeys()); + builder.setScope(cmd.getScope()); cmd.getKeyStates().entrySet().forEach(e -> builder.addKeyStates(SubscriptionKetStateProto.newBuilder().setKey(e.getKey()).setTs(e.getValue()).build())); ctx.sendPluginRpcMsg(new RpcMsg(address, SUBSCRIPTION_CLAZZ, builder.build().toByteArray())); } diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryWebsocketMsgHandler.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryWebsocketMsgHandler.java index 7b0e6d8fcd..6f02c9a5f2 100644 --- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryWebsocketMsgHandler.java +++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryWebsocketMsgHandler.java @@ -131,7 +131,7 @@ public class TelemetryWebsocketMsgHandler extends DefaultWebsocketMsgHandler { keys.forEach(key -> subState.put(key, 0L)); attributesData.forEach(v -> subState.put(v.getKey(), v.getTs())); - SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.ATTRIBUTES, false, subState); + SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.ATTRIBUTES, false, subState, cmd.getScope()); subscriptionManager.addLocalWsSubscription(ctx, sessionId, entityId, sub); } @@ -168,7 +168,7 @@ public class TelemetryWebsocketMsgHandler extends DefaultWebsocketMsgHandler { Map subState = new HashMap<>(attributesData.size()); attributesData.forEach(v -> subState.put(v.getKey(), v.getTs())); - SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.ATTRIBUTES, true, subState); + SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.ATTRIBUTES, true, subState, cmd.getScope()); subscriptionManager.addLocalWsSubscription(ctx, sessionId, entityId, sub); } @@ -234,7 +234,7 @@ public class TelemetryWebsocketMsgHandler extends DefaultWebsocketMsgHandler { sendWsMsg(ctx, sessionRef, new SubscriptionUpdate(cmd.getCmdId(), data)); Map subState = new HashMap<>(data.size()); data.forEach(v -> subState.put(v.getKey(), v.getTs())); - SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.TIMESERIES, true, subState); + SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.TIMESERIES, true, subState, cmd.getScope()); subscriptionManager.addLocalWsSubscription(ctx, sessionId, entityId, sub); } @@ -262,7 +262,7 @@ public class TelemetryWebsocketMsgHandler extends DefaultWebsocketMsgHandler { Map subState = new HashMap<>(keys.size()); keys.forEach(key -> subState.put(key, startTs)); data.forEach(v -> subState.put(v.getKey(), v.getTs())); - SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.TIMESERIES, false, subState); + SubscriptionState sub = new SubscriptionState(sessionId, cmd.getCmdId(), entityId, SubscriptionType.TIMESERIES, false, subState, cmd.getScope()); subscriptionManager.addLocalWsSubscription(ctx, sessionId, entityId, sub); } diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/Subscription.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/Subscription.java index 1285cfa903..360b018d14 100644 --- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/Subscription.java +++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/Subscription.java @@ -51,6 +51,10 @@ public class Subscription { return getSub().getType(); } + public String getScope() { + return getSub().getScope(); + } + public boolean isAllKeys() { return getSub().isAllKeys(); } diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/SubscriptionState.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/SubscriptionState.java index 5e15fda502..7e0a2ba48f 100644 --- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/SubscriptionState.java +++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/sub/SubscriptionState.java @@ -33,6 +33,7 @@ public class SubscriptionState { @Getter private final SubscriptionType type; @Getter private final boolean allKeys; @Getter private final Map keyStates; + @Getter private final String scope; @Override public boolean equals(Object o) { diff --git a/extensions-core/src/main/proto/telemetry.proto b/extensions-core/src/main/proto/telemetry.proto index 2bfef5908b..59c5c14fd5 100644 --- a/extensions-core/src/main/proto/telemetry.proto +++ b/extensions-core/src/main/proto/telemetry.proto @@ -27,6 +27,7 @@ message SubscriptionProto { string type = 5; bool allKeys = 6; repeated SubscriptionKetStateProto keyStates = 7; + string scope = 8; } message SubscriptionUpdateProto { From 2920a1a73ea76b788835d527fa1f2264ae1a41c6 Mon Sep 17 00:00:00 2001 From: oleg Date: Fri, 12 Jan 2018 19:03:59 +0200 Subject: [PATCH 03/10] Dashboard page jittering --- ui/src/app/common/utils.service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/app/common/utils.service.js b/ui/src/app/common/utils.service.js index 085a28bad5..54d85ec6fe 100644 --- a/ui/src/app/common/utils.service.js +++ b/ui/src/app/common/utils.service.js @@ -553,7 +553,9 @@ function Utils($mdColorPalette, $rootScope, $window, $translate, $q, $timeout, t var aspect = imageAspectMap[urlHashCode]; if (angular.isUndefined(aspect)) { var testImage = document.createElement('img'); // eslint-disable-line - testImage.style.visibility = 'hidden'; + testImage.style.position = 'absolute'; + testImage.style.left = '-99999px'; + testImage.style.top = '-99999px'; testImage.onload = function() { aspect = testImage.width / testImage.height; document.body.removeChild(testImage); //eslint-disable-line From a8ed801e503bb1d0a42437f8c6a9610194ee4334 Mon Sep 17 00:00:00 2001 From: oleg Date: Mon, 15 Jan 2018 17:01:51 +0200 Subject: [PATCH 04/10] UI:Bug. 'Flot state' widget --- ui/src/app/widget/lib/flot-widget.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/src/app/widget/lib/flot-widget.js b/ui/src/app/widget/lib/flot-widget.js index 59787cf920..392c8736de 100644 --- a/ui/src/app/widget/lib/flot-widget.js +++ b/ui/src/app/widget/lib/flot-widget.js @@ -405,9 +405,13 @@ export default class TbFlot { } } series.lines = { - fill: keySettings.fillLines === true, - show: this.chartType === 'line' ? keySettings.showLines !== false : keySettings.showLines === true + fill: keySettings.fillLines === true }; + if (this.chartType === 'line' || this.chartType === 'state') { + series.lines.show = keySettings.showLines !== false + } else { + series.lines.show = keySettings.showLines === true; + } if (angular.isDefined(keySettings.lineWidth)) { series.lines.lineWidth = keySettings.lineWidth; @@ -1016,18 +1020,18 @@ export default class TbFlot { "properties": { "showLines": { "title": "Show lines", - "type": "boolean", - "default": defaultShowLines + "type": "boolean", + "default": defaultShowLines }, "fillLines": { "title": "Fill lines", - "type": "boolean", - "default": false + "type": "boolean", + "default": false }, "showPoints": { "title": "Show points", - "type": "boolean", - "default": false + "type": "boolean", + "default": false }, "tooltipValueFormatter": { "title": "Tooltip value format function, f(value)", From c683b9c076df5e39d2814ce8adb27dcf0622ec64 Mon Sep 17 00:00:00 2001 From: oleg Date: Wed, 10 Jan 2018 13:31:49 +0200 Subject: [PATCH 05/10] UI:Fix 'Timeseries - Flot' widget (the legend breaks tooltips) --- ui/src/app/widget/lib/flot-widget.js | 81 ++++++++++++++++++---------- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/ui/src/app/widget/lib/flot-widget.js b/ui/src/app/widget/lib/flot-widget.js index 4e5f99f919..981cdd1e5b 100644 --- a/ui/src/app/widget/lib/flot-widget.js +++ b/ui/src/app/widget/lib/flot-widget.js @@ -238,29 +238,23 @@ export default class TbFlot { if (this.ticksFormatterFunction) { return this.ticksFormatterFunction(value); } - if (this.tickDecimals) { - value = value.toFixed(this.tickDecimals); + if (angular.isNumber(this.tickDecimals)) { + var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, + formatted = "" + Math.round(value * factor) / factor; + if (this.tickDecimals != null) { + var decimal = formatted.indexOf("."), + precision = decimal === -1 ? 0 : formatted.length - decimal - 1; + + if (precision < this.tickDecimals) { + value = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); + } + } } if (this.tickUnits) { value = value + ' ' + this.tickUnits; } - if (this.tickSize) { - return value; - } - // var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, - // formatted = "" + Math.round(value * factor) / factor; - // if (this.tickDecimals != null) { - // var decimal = formatted.indexOf("."), - // precision = decimal === -1 ? 0 : formatted.length - decimal - 1; - // - // if (precision < this.tickDecimals) { - // formatted = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); - // } - // } - // formatted += ' ' + this.tickUnits; return value; - }; this.yaxis.tickFormatter = ctx.yAxisTickFormatter; @@ -273,8 +267,16 @@ export default class TbFlot { this.yaxis.labelFont.color = this.yaxis.font.color; this.yaxis.labelFont.size = this.yaxis.font.size+2; this.yaxis.labelFont.weight = "bold"; - this.yaxis.tickSize = settings.yaxis.tickSize || null; - this.yaxis.tickDecimals = settings.yaxis.tickDecimals || null; + if (angular.isNumber(settings.yaxis.tickSize)) { + this.yaxis.tickSize = settings.yaxis.tickSize; + } else { + this.yaxis.tickSize = null; + } + if (angular.isNumber(settings.yaxis.tickDecimals)) { + this.yaxis.tickDecimals = settings.yaxis.tickDecimals + } else { + this.yaxis.tickDecimals = null; + } if (settings.yaxis.ticksFormatter && settings.yaxis.ticksFormatter.length) { try { this.yaxis.ticksFormatterFunction = new Function('value', settings.yaxis.ticksFormatter); @@ -500,9 +502,19 @@ export default class TbFlot { createYAxis(keySettings, units) { var yaxis = angular.copy(this.yaxis); + var tickDecimals, tickSize; var label = keySettings.axisTitle && keySettings.axisTitle.length ? keySettings.axisTitle : yaxis.label; - //var tickDecimals = angular.isDefined(keySettings.axisTickDecimals) ? keySettings.axisTickDecimals : 0; + if (angular.isNumber(keySettings.axisTickDecimals)) { + tickDecimals = keySettings.axisTickDecimals; + } else { + tickDecimals = yaxis.tickDecimals; + } + if (angular.isNumber(keySettings.axisTickSize)) { + tickSize = keySettings.axisTickSize; + } else { + tickSize = yaxis.tickSize; + } var position = keySettings.axisPosition && keySettings.axisPosition.length ? keySettings.axisPosition : "left"; var min = angular.isDefined(keySettings.axisMin) ? keySettings.axisMin : yaxis.min; @@ -512,6 +524,8 @@ export default class TbFlot { yaxis.min = min; yaxis.max = max; yaxis.tickUnits = units; + yaxis.tickDecimals = tickDecimals; + yaxis.tickSize = tickSize; yaxis.alignTicksWithAxis = position == "right" ? 1 : null; yaxis.position = position; @@ -557,7 +571,7 @@ export default class TbFlot { } } yaxis.hidden = hidden; - var newIndex = -1; + var newIndex = 1; if (!yaxis.hidden) { this.options.yaxes.push(yaxis); newIndex = this.options.yaxes.length; @@ -916,11 +930,6 @@ export default class TbFlot { "type": "number", "default": null }, - "tickSize": { - "title": "Step size between ticks", - "type": "number", - "default": null - }, "showLabels": { "title": "Show labels", "type": "boolean", @@ -950,8 +959,12 @@ export default class TbFlot { "title": "The number of decimals to display", "type": "number", "default": 0 + }, + "tickSize": { + "title": "Step size between ticks", + "type": "number", + "default": null } - } } }, @@ -1009,8 +1022,8 @@ export default class TbFlot { "items": [ "yaxis.min", "yaxis.max", - "yaxis.tickSize", "yaxis.tickDecimals", + "yaxis.tickSize", "yaxis.showLabels", "yaxis.title", "yaxis.titleAngle", @@ -1079,6 +1092,16 @@ export default class TbFlot { "type": "string", "default": "" }, + "axisTickDecimals": { + "title": "Axis tick number of digits after floating point", + "type": "number", + "default": 0 + }, + "axisTickSize": { + "title": "Axis step size between ticks", + "type": "number", + "default": null + }, "axisPosition": { "title": "Axis position", "type": "string", @@ -1104,6 +1127,8 @@ export default class TbFlot { "axisMin", "axisMax", "axisTitle", + "axisTickDecimals", + "axisTickSize", { "key": "axisPosition", "type": "rc-select", From ec6b926219b86d8c9ba1707e829d47eeae5505fe Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 19 Jan 2018 18:59:57 +0200 Subject: [PATCH 06/10] Update flot-widget.js --- ui/src/app/widget/lib/flot-widget.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/ui/src/app/widget/lib/flot-widget.js b/ui/src/app/widget/lib/flot-widget.js index 981cdd1e5b..718da76e9d 100644 --- a/ui/src/app/widget/lib/flot-widget.js +++ b/ui/src/app/widget/lib/flot-widget.js @@ -238,23 +238,22 @@ export default class TbFlot { if (this.ticksFormatterFunction) { return this.ticksFormatterFunction(value); } - if (angular.isNumber(this.tickDecimals)) { - var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, - formatted = "" + Math.round(value * factor) / factor; - if (this.tickDecimals != null) { - var decimal = formatted.indexOf("."), - precision = decimal === -1 ? 0 : formatted.length - decimal - 1; - - if (precision < this.tickDecimals) { - value = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); - } + + var factor = this.tickDecimals ? Math.pow(10, this.tickDecimals) : 1, + formatted = "" + Math.round(value * factor) / factor; + if (this.tickDecimals != null) { + var decimal = formatted.indexOf("."), + precision = decimal === -1 ? 0 : formatted.length - decimal - 1; + + if (precision < this.tickDecimals) { + formatted = (precision ? formatted : formatted + ".") + ("" + factor).substr(1, this.tickDecimals - precision); } } if (this.tickUnits) { - value = value + ' ' + this.tickUnits; + formatted += ' ' + this.tickUnits; } - - return value; + + return formatted; }; this.yaxis.tickFormatter = ctx.yAxisTickFormatter; @@ -1445,4 +1444,4 @@ export default class TbFlot { } } -/* eslint-enable angular/angularelement */ \ No newline at end of file +/* eslint-enable angular/angularelement */ From f66e4864cd667d96ce1d89cfb5d438a747bec2b8 Mon Sep 17 00:00:00 2001 From: oleg Date: Tue, 23 Jan 2018 19:17:55 +0200 Subject: [PATCH 07/10] UI:Fix. Timeseries table > divider wrong behavior --- ui/src/app/widget/lib/timeseries-table-widget.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/widget/lib/timeseries-table-widget.tpl.html b/ui/src/app/widget/lib/timeseries-table-widget.tpl.html index 0913483476..349edbac5e 100644 --- a/ui/src/app/widget/lib/timeseries-table-widget.tpl.html +++ b/ui/src/app/widget/lib/timeseries-table-widget.tpl.html @@ -41,7 +41,7 @@ - + From 74aa9ca36974a0deb39a783f51e685da3aa7a3c5 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 1 Feb 2018 10:45:38 +0200 Subject: [PATCH 08/10] Deprecated map widget fix. --- ui/src/app/widget/lib/map-widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/widget/lib/map-widget.js b/ui/src/app/widget/lib/map-widget.js index ef86381438..ab2e6d83ae 100644 --- a/ui/src/app/widget/lib/map-widget.js +++ b/ui/src/app/widget/lib/map-widget.js @@ -276,7 +276,7 @@ export default class TbMapWidget { this.locationsSettings[i].useMarkerImage = true; var url = this.ctx.settings.markerImage; var size = this.ctx.settings.markerImageSize || 34; - this.locationSettings.currentImage = { + this.locationSettings[i].currentImage = { url: url, size: size }; From 6447a0badaa588ea024501d15932cf451d811f54 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 1 Feb 2018 11:01:49 +0200 Subject: [PATCH 09/10] Deprecated map widget fix. --- ui/src/app/widget/lib/map-widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/widget/lib/map-widget.js b/ui/src/app/widget/lib/map-widget.js index ab2e6d83ae..db04023ff0 100644 --- a/ui/src/app/widget/lib/map-widget.js +++ b/ui/src/app/widget/lib/map-widget.js @@ -276,7 +276,7 @@ export default class TbMapWidget { this.locationsSettings[i].useMarkerImage = true; var url = this.ctx.settings.markerImage; var size = this.ctx.settings.markerImageSize || 34; - this.locationSettings[i].currentImage = { + this.locationsSettings[i].currentImage = { url: url, size: size }; From f6da85e9ae08fafa7a5f23a4e888997689556944 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 1 Feb 2018 18:14:06 +0200 Subject: [PATCH 10/10] IE11/Edge fix for iframe mode detection. --- ui/src/app/app.run.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/app/app.run.js b/ui/src/app/app.run.js index 2ab5fe2bd5..7d6c31f07b 100644 --- a/ui/src/app/app.run.js +++ b/ui/src/app/app.run.js @@ -20,7 +20,13 @@ import UrlHandler from './url.handler'; export default function AppRun($rootScope, $window, $injector, $location, $log, $state, $mdDialog, $filter, loginService, userService, $translate) { $window.Flow = Flow; - var frame = $window.frameElement; + var frame = null; + try { + frame = $window.frameElement; + } catch(e) { + // ie11 fix + } + var unauthorizedDialog = null; var forbiddenDialog = null;