mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge pull request #884 from rasika/fix-1659
Adding notification for the user on a Websocket handshake failure
This commit is contained in:
commit
a3b261e7e3
@ -59,6 +59,9 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
</div>
|
</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"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/moment.min.js"}}
|
{{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}}">
|
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
|
<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>
|
</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 -->
|
<!-- /statistics -->
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/moment.min.js"}}
|
{{js "js/moment.min.js"}}
|
||||||
|
|||||||
@ -96,6 +96,16 @@ function connect(target) {
|
|||||||
chartData.shift();
|
chartData.shift();
|
||||||
graph.update();
|
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}}">
|
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
|
<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>
|
</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 -->
|
<!-- /statistics -->
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/moment.min.js"}}
|
{{js "js/moment.min.js"}}
|
||||||
|
|||||||
@ -96,6 +96,16 @@ function connect(target) {
|
|||||||
chartData.shift();
|
chartData.shift();
|
||||||
graph.update();
|
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();
|
chartData.shift();
|
||||||
graph.update();
|
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…
Reference in New Issue
Block a user