Merge branch 'master' of github.com:thingsboard/thingsboard
This commit is contained in:
commit
2c28b4f639
@ -28,14 +28,17 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Thingsboard Server Application</name>
|
||||
<url>http://thingsboard.org</url>
|
||||
<url>https://thingsboard.io</url>
|
||||
<description>Open-source IoT Platform - Device management, data collection, processing and visualization
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<main.dir>${basedir}/..</main.dir>
|
||||
<pkg.name>thingsboard</pkg.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -196,6 +199,13 @@
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.winsw</groupId>
|
||||
<artifactId>winsw</artifactId>
|
||||
<classifier>bin</classifier>
|
||||
<type>exe</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thingsboard</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
@ -291,6 +301,38 @@
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<filters>
|
||||
<filter>src/main/filters/unix.properties</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-win-conf</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${pkg.win.dist}/conf</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>logback.xml</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/conf</directory>
|
||||
<excludes>
|
||||
<exclude>thingsboard.conf</exclude>
|
||||
</excludes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<filters>
|
||||
<filter>src/main/filters/windows.properties</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
@ -307,6 +349,28 @@
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<filters>
|
||||
<filter>src/main/filters/unix.properties</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-windows-control</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${pkg.win.dist}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/scripts/windows</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<filters>
|
||||
<filter>src/main/filters/windows.properties</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
@ -361,6 +425,25 @@
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-winsw-service</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>com.sun.winsw</groupId>
|
||||
<artifactId>winsw</artifactId>
|
||||
<classifier>bin</classifier>
|
||||
<type>exe</type>
|
||||
<destFileName>service.exe</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${pkg.win.dist}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -385,7 +468,7 @@
|
||||
<excludeDevtools>true</excludeDevtools>
|
||||
<embeddedLaunchScriptProperties>
|
||||
<confFolder>${pkg.installFolder}/conf</confFolder>
|
||||
<logFolder>${pkg.logFolder}</logFolder>
|
||||
<logFolder>${pkg.unixLogFolder}</logFolder>
|
||||
<logFilename>${pkg.name}.out</logFilename>
|
||||
</embeddedLaunchScriptProperties>
|
||||
</configuration>
|
||||
@ -412,7 +495,7 @@
|
||||
<arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>
|
||||
<arg>-PpkgName=${pkg.name}</arg>
|
||||
<arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
|
||||
<arg>-PpkgLogFolder=${pkg.logFolder}</arg>
|
||||
<arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>
|
||||
</args>
|
||||
</configuration>
|
||||
<executions>
|
||||
@ -424,6 +507,25 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${pkg.name}</finalName>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/windows.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.xolstice.maven.plugins</groupId>
|
||||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
@ -434,4 +536,14 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jenkins</id>
|
||||
<name>Jenkins Repository</name>
|
||||
<url>http://repo.jenkins-ci.org/releases</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
|
||||
79
application/src/main/assembly/windows.xml
Normal file
79
application/src/main/assembly/windows.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<!--
|
||||
|
||||
Copyright © 2016-2017 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.
|
||||
|
||||
-->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
|
||||
<id>windows</id>
|
||||
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
|
||||
<!-- Workaround to create logs directory -->
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${pkg.win.dist}</directory>
|
||||
<outputDirectory>logs</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>*/**</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${pkg.win.dist}/conf</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/extensions</directory>
|
||||
<outputDirectory>extensions</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/data</directory>
|
||||
<outputDirectory>data</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</source>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<destName>${pkg.name}.jar</destName>
|
||||
</file>
|
||||
<file>
|
||||
<source>${pkg.win.dist}/service.exe</source>
|
||||
<outputDirectory/>
|
||||
<destName>${pkg.name}.exe</destName>
|
||||
</file>
|
||||
<file>
|
||||
<source>${pkg.win.dist}/service.xml</source>
|
||||
<outputDirectory/>
|
||||
<destName>${pkg.name}.xml</destName>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</file>
|
||||
<file>
|
||||
<source>${pkg.win.dist}/install.bat</source>
|
||||
<outputDirectory/>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</file>
|
||||
<file>
|
||||
<source>${pkg.win.dist}/uninstall.bat</source>
|
||||
<outputDirectory/>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
||||
1
application/src/main/filters/unix.properties
Normal file
1
application/src/main/filters/unix.properties
Normal file
@ -0,0 +1 @@
|
||||
pkg.logFolder=${pkg.unixLogFolder}
|
||||
2
application/src/main/filters/windows.properties
Normal file
2
application/src/main/filters/windows.properties
Normal file
@ -0,0 +1,2 @@
|
||||
pkg.logFolder=${BASE}\\logs
|
||||
pkg.winWrapperLogFolder=%BASE%\\logs
|
||||
90
application/src/main/scripts/windows/install.bat
Normal file
90
application/src/main/scripts/windows/install.bat
Normal file
@ -0,0 +1,90 @@
|
||||
@ECHO OFF
|
||||
|
||||
setlocal ENABLEEXTENSIONS
|
||||
|
||||
IF %PROCESSOR_ARCHITECTURE%==AMD64 GOTO CHECK_JAVA_64
|
||||
IF %PROCESSOR_ARCHITECTURE%==x86 GOTO CHECK_JAVA_32
|
||||
|
||||
@ECHO Detecting Java version installed.
|
||||
:CHECK_JAVA_64
|
||||
@ECHO Detecting if it is 64 bit machine
|
||||
set KEY_NAME="HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Runtime Environment"
|
||||
set VALUE_NAME=CurrentVersion
|
||||
|
||||
FOR /F "usebackq skip=2 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
|
||||
set ValueName=%%A
|
||||
set ValueType=%%B
|
||||
set ValueValue=%%C
|
||||
)
|
||||
@ECHO CurrentVersion %ValueValue%
|
||||
|
||||
SET KEY_NAME="%KEY_NAME:~1,-1%\%ValueValue%"
|
||||
SET VALUE_NAME=JavaHome
|
||||
|
||||
if defined ValueName (
|
||||
FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
|
||||
set ValueName2=%%A
|
||||
set ValueType2=%%B
|
||||
set JRE_PATH2=%%C
|
||||
|
||||
if defined ValueName2 (
|
||||
set ValueName = %ValueName2%
|
||||
set ValueType = %ValueType2%
|
||||
set ValueValue = %JRE_PATH2%
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
IF NOT "%JRE_PATH2%" == "" GOTO JAVA_INSTALLED
|
||||
IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED
|
||||
|
||||
:CHECK_JAVA_32
|
||||
@ECHO Detecting if it is 32 bit machine
|
||||
set KEY_NAME="HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment"
|
||||
set VALUE_NAME=CurrentVersion
|
||||
|
||||
FOR /F "usebackq skip=2 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
|
||||
set ValueName=%%A
|
||||
set ValueType=%%B
|
||||
set ValueValue=%%C
|
||||
)
|
||||
@ECHO CurrentVersion %ValueValue%
|
||||
|
||||
SET KEY_NAME="%KEY_NAME:~1,-1%\%ValueValue%"
|
||||
SET VALUE_NAME=JavaHome
|
||||
|
||||
if defined ValueName (
|
||||
FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
|
||||
set ValueName2=%%A
|
||||
set ValueType2=%%B
|
||||
set JRE_PATH2=%%C
|
||||
|
||||
if defined ValueName2 (
|
||||
set ValueName = %ValueName2%
|
||||
set ValueType = %ValueType2%
|
||||
set ValueValue = %JRE_PATH2%
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED
|
||||
|
||||
:JAVA_INSTALLED
|
||||
|
||||
@ECHO Java 1.8 found!
|
||||
@ECHO Installing ${pkg.name} ...
|
||||
${pkg.name}.exe install
|
||||
|
||||
@ECHO DONE.
|
||||
|
||||
GOTO END
|
||||
|
||||
:JAVA_NOT_INSTALLED
|
||||
@ECHO Java 1.8 or above is not installed
|
||||
@ECHO Please go to https://java.com/ and install Java. Then retry installation.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
:END
|
||||
|
||||
|
||||
12
application/src/main/scripts/windows/service.xml
Normal file
12
application/src/main/scripts/windows/service.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<service>
|
||||
<id>${pkg.name}</id>
|
||||
<name>${project.name}</name>
|
||||
<description>${project.description}</description>
|
||||
<workingdirectory>%BASE%\conf</workingdirectory>
|
||||
<logpath>${pkg.winWrapperLogFolder}</logpath>
|
||||
<logmode>rotate</logmode>
|
||||
<env name="LOADER_PATH" value="%BASE%\conf,%BASE%\extensions" />
|
||||
<executable>java</executable>
|
||||
<startargument>-jar</startargument>
|
||||
<startargument>%BASE%\lib\${pkg.name}.jar</startargument>
|
||||
</service>
|
||||
9
application/src/main/scripts/windows/uninstall.bat
Normal file
9
application/src/main/scripts/windows/uninstall.bat
Normal file
@ -0,0 +1,9 @@
|
||||
@ECHO OFF
|
||||
|
||||
@ECHO Stopping ${pkg.name} ...
|
||||
net stop ${pkg.name}
|
||||
|
||||
@ECHO Uninstalling ${pkg.name} ...
|
||||
${pkg.name}.exe uninstall
|
||||
|
||||
@ECHO DONE.
|
||||
File diff suppressed because one or more lines are too long
19
pom.xml
19
pom.xml
@ -24,12 +24,12 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Thingsboard</name>
|
||||
<url>http://thingsboard.io</url>
|
||||
<url>https://thingsboard.io</url>
|
||||
<inceptionYear>2016</inceptionYear>
|
||||
|
||||
<properties>
|
||||
<main.dir>${basedir}</main.dir>
|
||||
<spring-boot.version>1.4.2.RELEASE</spring-boot.version>
|
||||
<spring-boot.version>1.4.3.RELEASE</spring-boot.version>
|
||||
<spring.version>4.3.4.RELEASE</spring.version>
|
||||
<spring-security.version>4.2.0.RELEASE</spring-security.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
@ -70,6 +70,7 @@
|
||||
<jar-plugin.version>3.0.2</jar-plugin.version>
|
||||
<springfox-swagger.version>2.6.1</springfox-swagger.version>
|
||||
<bouncycastle.version>1.56</bouncycastle.version>
|
||||
<winsw.version>2.0.1</winsw.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@ -127,6 +128,11 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
@ -264,6 +270,7 @@
|
||||
<exclude>src/font/**</exclude>
|
||||
<exclude>src/sh/**</exclude>
|
||||
<exclude>src/main/scripts/control/**</exclude>
|
||||
<exclude>src/main/scripts/windows/**</exclude>
|
||||
</excludes>
|
||||
<mapping>
|
||||
<proto>JAVADOC_STYLE</proto>
|
||||
@ -700,6 +707,14 @@
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<version>${bouncycastle.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.winsw</groupId>
|
||||
<artifactId>winsw</artifactId>
|
||||
<version>${winsw.version}</version>
|
||||
<classifier>bin</classifier>
|
||||
<type>exe</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"angular-gridster": "^0.13.14",
|
||||
"angular-hotkeys": "^1.7.0",
|
||||
"angular-jwt": "^0.1.6",
|
||||
"angular-material": "^1.1.1",
|
||||
"angular-material": "1.1.1",
|
||||
"angular-material-data-table": "^0.10.9",
|
||||
"angular-material-icons": "^0.7.1",
|
||||
"angular-messages": "1.5.8",
|
||||
|
||||
@ -357,23 +357,8 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic
|
||||
return data;
|
||||
}
|
||||
|
||||
function generateSeries(dataKey) {
|
||||
|
||||
function generateSeries(dataKey, startTime, endTime) {
|
||||
var data = [];
|
||||
var startTime;
|
||||
var endTime;
|
||||
|
||||
if (realtime) {
|
||||
endTime = (new Date).getTime();
|
||||
if (dataKey.lastUpdateTime) {
|
||||
startTime = dataKey.lastUpdateTime + frequency;
|
||||
} else {
|
||||
startTime = endTime - datasourceSubscription.subscriptionTimewindow.realtimeWindowMs;
|
||||
}
|
||||
} else {
|
||||
startTime = datasourceSubscription.subscriptionTimewindow.fixedWindow.startTimeMs;
|
||||
endTime = datasourceSubscription.subscriptionTimewindow.fixedWindow.endTimeMs;
|
||||
}
|
||||
var prevSeries;
|
||||
var datasourceKeyData = datasourceData[dataKey.key];
|
||||
if (datasourceKeyData.length > 0) {
|
||||
@ -429,9 +414,33 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic
|
||||
}
|
||||
|
||||
function onTick() {
|
||||
for (var key in dataKeys) {
|
||||
dataGenFunction(dataKeys[key]);
|
||||
var key;
|
||||
if (datasourceSubscription.type === types.widgetType.timeseries.value) {
|
||||
var startTime;
|
||||
var endTime;
|
||||
for (key in dataKeys) {
|
||||
var dataKey = dataKeys[key];
|
||||
if (!startTime) {
|
||||
if (realtime) {
|
||||
endTime = (new Date).getTime();
|
||||
if (dataKey.lastUpdateTime) {
|
||||
startTime = dataKey.lastUpdateTime + frequency;
|
||||
} else {
|
||||
startTime = endTime - datasourceSubscription.subscriptionTimewindow.realtimeWindowMs;
|
||||
}
|
||||
} else {
|
||||
startTime = datasourceSubscription.subscriptionTimewindow.fixedWindow.startTimeMs;
|
||||
endTime = datasourceSubscription.subscriptionTimewindow.fixedWindow.endTimeMs;
|
||||
}
|
||||
}
|
||||
generateSeries(dataKey, startTime, endTime);
|
||||
}
|
||||
} else if (datasourceSubscription.type === types.widgetType.latest.value) {
|
||||
for (key in dataKeys) {
|
||||
generateLatest(dataKeys[key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!history) {
|
||||
timer = $timeout(onTick, frequency / 2, false);
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ export default angular.module('thingsboard.api.telemetryWebsocket', [thingsboard
|
||||
.factory('telemetryWebsocketService', TelemetryWebsocketService)
|
||||
.name;
|
||||
|
||||
const RECONNECT_INTERVAL = 5000;
|
||||
const RECONNECT_INTERVAL = 2000;
|
||||
const WS_IDLE_TIMEOUT = 90000;
|
||||
|
||||
/*@ngInject*/
|
||||
@ -145,6 +145,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
}
|
||||
|
||||
function subscribe (subscriber) {
|
||||
isActive = true;
|
||||
var cmdId = nextCmdId();
|
||||
subscribers[cmdId] = subscriber;
|
||||
subscribersCount++;
|
||||
@ -163,6 +164,8 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
}
|
||||
|
||||
function unsubscribe (subscriber) {
|
||||
if (isActive) {
|
||||
var cmdId = null;
|
||||
if (subscriber.subscriptionCommand) {
|
||||
subscriber.subscriptionCommand.unsubscribe = true;
|
||||
if (subscriber.type === types.dataKeyType.timeseries) {
|
||||
@ -170,13 +173,17 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
} else if (subscriber.type === types.dataKeyType.attribute) {
|
||||
cmdsWrapper.attrSubCmds.push(subscriber.subscriptionCommand);
|
||||
}
|
||||
delete subscribers[subscriber.subscriptionCommand.cmdId];
|
||||
cmdId = subscriber.subscriptionCommand.cmdId;
|
||||
} else if (subscriber.historyCommand) {
|
||||
delete subscribers[subscriber.historyCommand.cmdId];
|
||||
cmdId = subscriber.historyCommand.cmdId;
|
||||
}
|
||||
if (cmdId && subscribers[cmdId]) {
|
||||
delete subscribers[cmdId];
|
||||
subscribersCount--;
|
||||
}
|
||||
publishCommands();
|
||||
}
|
||||
}
|
||||
|
||||
function checkToClose () {
|
||||
if (subscribersCount === 0 && isOpened) {
|
||||
@ -187,7 +194,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
}
|
||||
|
||||
function tryOpenSocket () {
|
||||
isActive = true;
|
||||
if (isActive) {
|
||||
if (!isOpened && !isOpening) {
|
||||
isOpening = true;
|
||||
if (userService.isJwtTokenValid()) {
|
||||
@ -206,6 +213,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
socketCloseTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function openSocket(token) {
|
||||
dataStream = $websocket(telemetryUri + '?token=' + token);
|
||||
@ -222,7 +230,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
}
|
||||
}
|
||||
|
||||
function reset(closeSocket) {
|
||||
function reset(close) {
|
||||
if (socketCloseTimer) {
|
||||
$timeout.cancel(socketCloseTimer);
|
||||
socketCloseTimer = null;
|
||||
@ -233,7 +241,7 @@ function TelemetryWebsocketService($rootScope, $websocket, $timeout, $window, ty
|
||||
cmdsWrapper.tsSubCmds = [];
|
||||
cmdsWrapper.historyCmds = [];
|
||||
cmdsWrapper.attrSubCmds = [];
|
||||
if (closeSocket) {
|
||||
if (close) {
|
||||
closeSocket();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,12 +35,10 @@
|
||||
tb-mouseup="vm.widgetMouseUp($event, widget)"
|
||||
ng-click=""
|
||||
tb-contextmenu="vm.openWidgetContextMenu($event, widget, $mdOpenMousepointMenu)"
|
||||
style="
|
||||
cursor: pointer;
|
||||
color: {{vm.widgetColor(widget)}};
|
||||
background-color: {{vm.widgetBackgroundColor(widget)}};
|
||||
padding: {{vm.widgetPadding(widget)}}
|
||||
">
|
||||
ng-style="{cursor: 'pointer',
|
||||
color: vm.widgetColor(widget),
|
||||
backgroundColor: vm.widgetBackgroundColor(widget),
|
||||
padding: vm.widgetPadding(widget)}">
|
||||
<div class="tb-widget-title" layout="column" ng-show="vm.showWidgetTitle(widget) || vm.hasTimewindow(widget)">
|
||||
<span ng-show="vm.showWidgetTitle(widget)" class="md-subhead">{{widget.config.title}}</span>
|
||||
<tb-timewindow ng-if="vm.hasTimewindow(widget)" ng-model="widget.config.timewindow"></tb-timewindow>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
class=" pull-right fa fa-chevron-down md-toggle-icon"
|
||||
ng-class="{'tb-toggled' : sectionActive()}"></span>
|
||||
</md-button>
|
||||
<ul id="docs-menu-{{section.name | nospace}}" class="tb-menu-toggle-list" style="height: {{sectionHeight()}};">
|
||||
<ul id="docs-menu-{{section.name | nospace}}" class="tb-menu-toggle-list" ng-style="{height: sectionHeight()}">
|
||||
<li ng-repeat="page in section.pages">
|
||||
<tb-menu-link section="page"></tb-menu-link>
|
||||
</li>
|
||||
|
||||
@ -119,6 +119,10 @@ export default function AttributeTableDirective($compile, $templateCache, $rootS
|
||||
scope.attributesDeferred.resolve();
|
||||
}
|
||||
if (scope.deviceId && scope.attributeScope) {
|
||||
scope.attributes = {
|
||||
count: 0,
|
||||
data: []
|
||||
};
|
||||
scope.checkSubscription();
|
||||
scope.attributesDeferred = deviceService.getDeviceAttributes(scope.deviceId, scope.attributeScope.value,
|
||||
scope.query, function(attributes, update) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user