diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs
index 1c2c2dd69..4f18f97aa 100644
--- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs
+++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs
@@ -59,6 +59,9 @@
{{/each}}
+
+ Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '
$webSocketURL' is available and re-try again.
+
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}
diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js
index dc9a16476..b7ac7f692 100644
--- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js
+++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js
@@ -303,6 +303,15 @@ function connect(target) {
}
}
};
+ ws.onerror = function (event) {
+ var websocketURL = event.currentTarget.url;
+ websocketURL = websocketURL.replace("wss://","https://");
+ var uriParts = websocketURL.split("/");
+ websocketURL = uriParts[0] + "//" + uriParts[2];
+ var errorMsg = $("#websocker-onerror").html();
+ errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
+ $("#stat-section").html("" + errorMsg + "
");
+ };
}
}
diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.hbs b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.hbs
index be691a2b5..7be56cc2d 100644
--- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.hbs
+++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.hbs
@@ -32,6 +32,9 @@
href="{{@app.context}}/device/{{device.type}}/analytics?deviceId={{device.deviceIdentifier}}&deviceName={{device.name}}">
View Device Analytics
+
+ Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '
$webSocketURL' is available and re-try again.
+
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}
diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js
index 1489e9cd8..fba86c2c5 100644
--- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js
+++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js
@@ -96,6 +96,16 @@ function connect(target) {
chartData.shift();
graph.update();
};
+ ws.onerror = function (event) {
+ var websocketURL = event.currentTarget.url;
+ websocketURL = websocketURL.replace("wss://","https://");
+ var uriParts = websocketURL.split("/");
+ websocketURL = uriParts[0] + "//" + uriParts[2];
+ var errorMsg = $("#websocker-onerror").html();
+ errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
+ $(graph.element).parent().html("" + errorMsg + "
");
+ $(graph.element).hide();
+ };
}
}
diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.hbs b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.hbs
index be691a2b5..7be56cc2d 100644
--- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.hbs
+++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.hbs
@@ -32,6 +32,9 @@
href="{{@app.context}}/device/{{device.type}}/analytics?deviceId={{device.deviceIdentifier}}&deviceName={{device.name}}">
View Device Analytics
+
+ Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '
$webSocketURL' is available and re-try again.
+
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}
diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/public/js/device-stats.js b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/public/js/device-stats.js
index 04feca7ec..8ffeb046a 100644
--- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/public/js/device-stats.js
+++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/public/js/device-stats.js
@@ -96,6 +96,16 @@ function connect(target) {
chartData.shift();
graph.update();
};
+ ws.onerror = function (event) {
+ var websocketURL = event.currentTarget.url;
+ websocketURL = websocketURL.replace("wss://","https://");
+ var uriParts = websocketURL.split("/");
+ websocketURL = uriParts[0] + "//" + uriParts[2];
+ var errorMsg = $("#websocker-onerror").html();
+ errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
+ $(graph.element).parent().html("" + errorMsg + "
");
+ $(graph.element).hide();
+ };
}
}
diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js
index dbf6d2006..3385758b4 100755
--- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js
+++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js
@@ -99,6 +99,15 @@ function connect(target) {
chartData.shift();
graph.update();
};
+ ws.onerror = function (event) {
+ var websocketURL = event.currentTarget.url;
+ websocketURL = websocketURL.replace("wss://","https://");
+ var uriParts = websocketURL.split("/");
+ websocketURL = uriParts[0] + "//" + uriParts[2];
+ var errorMsg = $("#websocker-onerror").html();
+ errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
+ $("#div-chart").html("" + errorMsg + "
");
+ };
}
}