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

Merge pull request #6543 from thornbill/fix-shutdown-buttons

Fix restart and shutdown buttons
This commit is contained in:
Bill Thornton 2025-02-20 17:07:06 -05:00 committed by GitHub
commit 1c2d7ef918
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 8 deletions

View file

@ -23,10 +23,10 @@
<button is="emby-button" type="button" class="raised btnRefresh">
<span>${ButtonScanAllLibraries}</span>
</button>
<button is="emby-button" type="button" id="btnRestartServer" class="raised" onclick="DashboardPage.restart(this);">
<button is="emby-button" type="button" id="btnRestartServer" class="raised">
<span>${Restart}</span>
</button>
<button is="emby-button" type="button" id="btnShutdown" class="raised" onclick="DashboardPage.shutdown(this);">
<button is="emby-button" type="button" id="btnShutdown" class="raised">
<span>${ButtonShutdown}</span>
</button>
</div>

View file

@ -714,30 +714,34 @@ const DashboardPage = {
pollForInfo(page, ApiClient);
});
},
restart: function (btn) {
restart: function (event) {
confirm({
title: globalize.translate('Restart'),
text: globalize.translate('MessageConfirmRestart'),
confirmText: globalize.translate('Restart'),
primary: 'delete'
}).then(function () {
const page = dom.parentWithClass(btn, 'page');
}).then(() => {
const page = dom.parentWithClass(event.target, 'page');
page.querySelector('#btnRestartServer').disabled = true;
page.querySelector('#btnShutdown').disabled = true;
ApiClient.restartServer();
}).catch(() => {
// Confirm dialog closed
});
},
shutdown: function (btn) {
shutdown: function (event) {
confirm({
title: globalize.translate('ButtonShutdown'),
text: globalize.translate('MessageConfirmShutdown'),
confirmText: globalize.translate('ButtonShutdown'),
primary: 'delete'
}).then(function () {
const page = dom.parentWithClass(btn, 'page');
}).then(() => {
const page = dom.parentWithClass(event.target, 'page');
page.querySelector('#btnRestartServer').disabled = true;
page.querySelector('#btnShutdown').disabled = true;
ApiClient.shutdownServer();
}).catch(() => {
// Confirm dialog closed
});
}
};
@ -817,7 +821,11 @@ export default function (view) {
taskKey: 'RefreshLibrary',
button: page.querySelector('.btnRefresh')
});
page.querySelector('#btnRestartServer').addEventListener('click', DashboardPage.restart);
page.querySelector('#btnShutdown').addEventListener('click', DashboardPage.shutdown);
});
view.addEventListener('viewbeforehide', function () {
const apiClient = ApiClient;
const page = this;
@ -839,6 +847,9 @@ export default function (view) {
taskKey: 'RefreshLibrary',
button: page.querySelector('.btnRefresh')
});
page.querySelector('#btnRestartServer').removeEventListener('click', DashboardPage.restart);
page.querySelector('#btnShutdown').removeEventListener('click', DashboardPage.shutdown);
});
view.addEventListener('viewdestroy', function () {
const page = this;