Rasika Perera 7 years ago
parent bb899b06aa
commit 16c2a7a0f3

@ -52,6 +52,10 @@
</span>
</span> View Device Analytics
</a>
<div class="hide" id="websocker-onerror">
Realtime Analytics for $sensorType not available. Failed to connect to the websocket. Please make sure; '<a style="color: white" href="$webSocketURL">$webSocketURL</a>' is available and re-try again.
</div>
<!-- /statistics -->
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}

@ -114,6 +114,17 @@ function connect(wsConnection, target, chartData, graph, sensorType) {
chartData.shift();
graph.update();
};
wsConnection.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('\\$sensorType', 'g'), sensorType);
errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
$(graph.element).parent().html("<div class='alert alert-danger'>" + errorMsg + "</div>");
$(graph.element).hide();
};
}
if (sensorType == "temperature") {
wsConnectionTemperature = wsConnection;

@ -37,6 +37,9 @@
<i class="fw fw-statistics fw-stack-1x"></i>
</span> View Device Analytics
</a>
<div class="hide" id="websocker-onerror">
Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '<a style="color: white" href="$webSocketURL">$webSocketURL</a>' is available and re-try again.
</div>
<!-- /statistics -->
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}

@ -104,6 +104,16 @@ function connect(wsConnection, target, chartData, graph) {
chartData.shift();
graph.update();
};
wsConnection.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("<div class='alert alert-danger'>" + errorMsg + "</div>");
$(graph.element).hide();
};
}
}

Loading…
Cancel
Save