Merge pull request #6933 from thornbill/item-count-widget
Add item count widget to dashboard
This commit is contained in:
@@ -20,13 +20,13 @@
|
||||
</div>
|
||||
|
||||
<div class="dashboardActionsContainer">
|
||||
<button is="emby-button" type="button" class="raised btnRefresh">
|
||||
<button is="emby-button" type="button" class="raised btnRefresh button-submit">
|
||||
<span>${ButtonScanAllLibraries}</span>
|
||||
</button>
|
||||
<button is="emby-button" type="button" id="btnRestartServer" class="raised">
|
||||
<button is="emby-button" type="button" id="btnRestartServer" class="raised button-delete">
|
||||
<span>${Restart}</span>
|
||||
</button>
|
||||
<button is="emby-button" type="button" id="btnShutdown" class="raised">
|
||||
<button is="emby-button" type="button" id="btnShutdown" class="raised button-delete">
|
||||
<span>${ButtonShutdown}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -36,6 +36,8 @@
|
||||
<div id="divRunningTasks" class="paperList" style="padding: 1em;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="itemCounts"></div>
|
||||
</div>
|
||||
|
||||
<div class="dashboardSection">
|
||||
|
||||
@@ -33,6 +33,7 @@ import 'elements/emby-itemscontainer/emby-itemscontainer';
|
||||
import 'components/listview/listview.scss';
|
||||
import 'styles/flexstyles.scss';
|
||||
import './dashboard.scss';
|
||||
import ItemCountsWidget from '../components/widgets/ItemCountsWidget';
|
||||
|
||||
function showPlaybackInfo(btn, session) {
|
||||
let title;
|
||||
@@ -748,7 +749,7 @@ const DashboardPage = {
|
||||
|
||||
export default function (view) {
|
||||
const serverId = ApiClient.serverId();
|
||||
let unmountPathsWidget;
|
||||
let unmountWidgetFns = [];
|
||||
|
||||
function onRestartRequired(evt, apiClient) {
|
||||
console.debug('onRestartRequired not implemented', evt, apiClient);
|
||||
@@ -824,7 +825,8 @@ export default function (view) {
|
||||
button: page.querySelector('.btnRefresh')
|
||||
});
|
||||
|
||||
unmountPathsWidget = renderComponent(ServerPathWidget, {}, page.querySelector('#serverPaths'));
|
||||
unmountWidgetFns.push(renderComponent(ItemCountsWidget, {}, page.querySelector('#itemCounts')));
|
||||
unmountWidgetFns.push(renderComponent(ServerPathWidget, {}, page.querySelector('#serverPaths')));
|
||||
|
||||
page.querySelector('#btnRestartServer').addEventListener('click', DashboardPage.restart);
|
||||
page.querySelector('#btnShutdown').addEventListener('click', DashboardPage.shutdown);
|
||||
@@ -852,7 +854,10 @@ export default function (view) {
|
||||
button: page.querySelector('.btnRefresh')
|
||||
});
|
||||
|
||||
if (unmountPathsWidget) unmountPathsWidget();
|
||||
unmountWidgetFns.forEach(unmount => {
|
||||
unmount();
|
||||
});
|
||||
unmountWidgetFns = [];
|
||||
|
||||
page.querySelector('#btnRestartServer').removeEventListener('click', DashboardPage.restart);
|
||||
page.querySelector('#btnShutdown').removeEventListener('click', DashboardPage.shutdown);
|
||||
|
||||
Reference in New Issue
Block a user