Change admin streams list to render progressively.

This commit is contained in:
Brock Whittaker
2017-04-20 12:49:28 -07:00
committed by Tim Abbott
parent 0e4f2f732d
commit db40d62092
2 changed files with 32 additions and 12 deletions

View File

@@ -19,10 +19,20 @@ function failed_listing_streams(xhr) {
function populate_streams(streams_data) {
var streams_table = $("#admin_streams_table").expectOne();
all_streams = streams_data;
streams_table.find("tr.stream_row").remove();
_.each(streams_data.streams, function (stream) {
streams_table.append(templates.render("admin_streams_list", {stream: stream}));
});
list_render(streams_table, all_streams.streams, {
name: "admin_streams_list",
modifier: function (item) {
return templates.render("admin_streams_list", { stream: item });
},
filter: {
element: streams_table.closest(".settings-section").find(".search"),
callback: function (item, value) {
return item.name.toLowerCase().match(value);
},
},
}).init();
loading.destroy_indicator($('#admin_page_streams_loading_indicator'));
}

View File

@@ -1,16 +1,26 @@
<div id="admin-streams-list" class="settings-section" data-name="streams-list-admin">
<div class="settings-section-title"><i class="icon-vector-exchange settings-section-icon"></i>
{{t "Delete streams" }}</div>
<div class="settings-section-title">
<div class="table-title">
<i class="icon-vector-exchange settings-section-icon"></i>
{{t "Delete streams" }}
</div>
<input type="text" class="search" placeholder="{{t 'Search streams' }}" />
<div class="clear-float"></div>
</div>
<div class="side-padded-container">
<p class="admin-streams-note">{{#tr this}}Most stream administration is done on the <a href="/#streams">Streams page</a>.{{/tr}}</p>
</div>
<table class="table table-condensed table-striped">
<tbody id="admin_streams_table" class="admin_stream_table">
<th>{{t "Name" }}</th>
<th>{{t "Actions" }}</th>
</tbody>
</table>
<div class="progressive-table-wrapper">
<table class="table table-condensed table-striped">
<thead>
<th>{{t "Name" }}</th>
<th>{{t "Actions" }}</th>
</thead>
<tbody id="admin_streams_table" class="admin_stream_table"></tbody>
</table>
</div>
<div id="admin_page_streams_loading_indicator"></div>
</div>