html/preset_sel/ui.js: Clear UI when socket disconnected.

This commit is contained in:
kevin 2022-12-17 17:50:29 -05:00
parent 0e68bb0233
commit cf024fe85d

View File

@ -1237,6 +1237,11 @@ function ws_on_open()
function ws_on_close() function ws_on_close()
{ {
set_app_title( "Disconnected", "title_disconnected" ); set_app_title( "Disconnected", "title_disconnected" );
// remove the body of UI
var rootEle = dom_id_to_ele(_rootId)
if( rootEle != null )
document.body.removeChild( rootEle )
} }
function ws_form_url(urlSuffix) function ws_form_url(urlSuffix)
@ -1257,7 +1262,6 @@ function main()
{ {
d = { "className":"uiAppDiv", "uuId":_rootId } d = { "className":"uiAppDiv", "uuId":_rootId }
rootEle = ui_create_div( document.body, d ) rootEle = ui_create_div( document.body, d )
//rootEle = dom_id_to_ele(_rootId);
rootEle.uuId = 0; rootEle.uuId = 0;
rootEle.id = _nextEleId; rootEle.id = _nextEleId;
_nextEleId += 1; _nextEleId += 1;