Merge pull request #884 from rasika/fix-1659

Adding notification for the user on a Websocket handshake failure
revert-dabc3590
Madawa Soysa 7 years ago committed by GitHub
commit a3b261e7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,6 +59,9 @@
{{/each}}
</div>
<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>
{{#zone "bottomJs"}}
{{js "js/moment.min.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("<div class='alert alert-danger'>" + errorMsg + "</div>");
};
}
}

@ -32,6 +32,9 @@
href="{{@app.context}}/device/{{device.type}}/analytics?deviceId={{device.deviceIdentifier}}&deviceName={{device.name}}">
<span class="fw-stack"> <i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-statistics fw-stack-1x"></i> <span class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke"></i> <i class="fw fw-clock fw-stack-1x fw-inverse"></i> </span> </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"}}

@ -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("<div class='alert alert-danger'>" + errorMsg + "</div>");
$(graph.element).hide();
};
}
}

@ -32,6 +32,9 @@
href="{{@app.context}}/device/{{device.type}}/analytics?deviceId={{device.deviceIdentifier}}&deviceName={{device.name}}">
<span class="fw-stack"> <i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-statistics fw-stack-1x"></i> <span class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke"></i> <i class="fw fw-clock fw-stack-1x fw-inverse"></i> </span> </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"}}

@ -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("<div class='alert alert-danger'>" + errorMsg + "</div>");
$(graph.element).hide();
};
}
}

@ -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("<div class='alert alert-danger'>" + errorMsg + "</div>");
};
}
}

Loading…
Cancel
Save