diff --git a/templates/live.html.ep b/templates/live.html.ep index 4336d8ef66fad0ef12aba8478e825e0e2f55e65c..0cbb79d94d617945a7baa10875e02f2e5d18bdf2 100644 --- a/templates/live.html.ep +++ b/templates/live.html.ep @@ -5,9 +5,11 @@ <table id="Streams" class="table table--bordered" data-row-style="rowStyle" + data-unique-id="id" data-url="/api/streams?live=true"> <thead> <tr> + <th data-field="id" data-visible="false">ID</th> <th data-field="name" data-width="60" data-width-unit="%">Stream</th> <th data-field="publish_user_name" data-width="30" data-width-unit="%">Vysílá</th> <th data-field="recording" data-width="10" data-width-unit="%" data-formatter="formatterRecording">Nahrávání</th> @@ -26,8 +28,10 @@ $('#Streams').bootstrapTable({ url: '/streams/' + row.id + '/recording', data: { action: (value ? 'stop':'start') }, success: function(rc) { - var content = formatterRecording(rc.recording, row); - $element.html(content); + $('#Streams').bootstrapTable('updateByUniqueId', { + id: row.id, + row: rc + }); } }); } @@ -58,7 +62,7 @@ function rowStyle(row, index) { } } -var ws = new WebSocket('<%= $c->config->{ws_url} %>'); +var ws = new WebSocket('<%= $c->config->{ws_url} %>/streams'); ws.onmessage = function (event) { console.log(event.data);