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 1c2c2dd69a..4f18f97aa1 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 dc9a16476b..b7ac7f6926 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 be691a2b54..7be56cc2d8 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 1489e9cd83..fba86c2c5e 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 be691a2b54..7be56cc2d8 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 04feca7ec0..8ffeb046aa 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 dbf6d2006f..3385758b40 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 + "
");
+ };
}
}