1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add library scan button to dashboard

This commit is contained in:
dkanada 2020-10-12 12:29:57 +09:00
parent af3f308abc
commit 7b168608a0
3 changed files with 19 additions and 1 deletions

View file

@ -22,6 +22,9 @@
<button is="emby-button" type="button" id="btnShutdown" class="raised" onclick="DashboardPage.shutdown(this);"> <button is="emby-button" type="button" id="btnShutdown" class="raised" onclick="DashboardPage.shutdown(this);">
<span>${ButtonShutdown}</span> <span>${ButtonShutdown}</span>
</button> </button>
<button is="emby-button" type="button" class="raised btnRefresh">
<span>${ButtonScanAllLibraries}</span>
</button>
</div> </div>
<div style="margin-top: 2em;" class="runningTasksContainer hide"> <div style="margin-top: 2em;" class="runningTasksContainer hide">

View file

@ -3,6 +3,7 @@ import events from 'events';
import itemHelper from 'itemHelper'; import itemHelper from 'itemHelper';
import serverNotifications from 'serverNotifications'; import serverNotifications from 'serverNotifications';
import dom from 'dom'; import dom from 'dom';
import taskButton from 'scripts/taskbutton';
import globalize from 'globalize'; import globalize from 'globalize';
import * as datefns from 'date-fns'; import * as datefns from 'date-fns';
import dfnshelper from 'dfnshelper'; import dfnshelper from 'dfnshelper';
@ -827,9 +828,17 @@ import 'emby-itemscontainer';
refreshActiveRecordings(view, apiClient); refreshActiveRecordings(view, apiClient);
loading.hide(); loading.hide();
} }
taskButton({
mode: 'on',
taskKey: 'RefreshLibrary',
button: page.querySelector('.btnRefresh')
});
}); });
view.addEventListener('viewbeforehide', function () { view.addEventListener('viewbeforehide', function () {
const apiClient = ApiClient; const apiClient = ApiClient;
const page = this;
events.off(serverNotifications, 'RestartRequired', onRestartRequired); events.off(serverNotifications, 'RestartRequired', onRestartRequired);
events.off(serverNotifications, 'ServerShuttingDown', onServerShuttingDown); events.off(serverNotifications, 'ServerShuttingDown', onServerShuttingDown);
events.off(serverNotifications, 'ServerRestarting', onServerRestarting); events.off(serverNotifications, 'ServerRestarting', onServerRestarting);
@ -841,6 +850,12 @@ import 'emby-itemscontainer';
if (apiClient) { if (apiClient) {
DashboardPage.stopInterval(apiClient); DashboardPage.stopInterval(apiClient);
} }
taskButton({
mode: 'off',
taskKey: 'RefreshLibrary',
button: page.querySelector('.btnRefresh')
});
}); });
view.addEventListener('viewdestroy', function () { view.addEventListener('viewdestroy', function () {
const page = this; const page = this;

View file

@ -13,7 +13,7 @@ export default function (options) {
function updateTasks(tasks) { function updateTasks(tasks) {
const task = tasks.filter(function (t) { const task = tasks.filter(function (t) {
return t.ScheduledTask.Key == options.taskKey; return t.Key == options.taskKey;
})[0]; })[0];
if (options.panel) { if (options.panel) {