mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add device upload options
This commit is contained in:
parent
8ff293076b
commit
9ae5d347c1
8 changed files with 327 additions and 2 deletions
90
dashboard-ui/scripts/devices.js
Normal file
90
dashboard-ui/scripts/devices.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
(function () {
|
||||
|
||||
function deleteDevice(page, id) {
|
||||
|
||||
var msg = Globalize.translate('DeleteDeviceConfirmation');
|
||||
|
||||
Dashboard.confirm(msg, Globalize.translate('HeaderDeleteDevice'), function (result) {
|
||||
|
||||
if (result) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl('Devices', {
|
||||
Id: id
|
||||
})
|
||||
|
||||
}).done(function () {
|
||||
|
||||
loadData(page);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function load(page, devices) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="minus">';
|
||||
|
||||
html += devices.map(function (d) {
|
||||
|
||||
var deviceHtml = '';
|
||||
deviceHtml += '<li>';
|
||||
|
||||
deviceHtml += '<a href="#">';
|
||||
|
||||
deviceHtml += '<h3>';
|
||||
deviceHtml += d.Name;
|
||||
deviceHtml += '</h3>';
|
||||
|
||||
if (d.LastUserName) {
|
||||
deviceHtml += '<p style="color:green;">';
|
||||
deviceHtml += Globalize.translate('DeviceLastUsedByUserName', d.LastUserName);
|
||||
deviceHtml += '</p>';
|
||||
}
|
||||
|
||||
deviceHtml += '</a>';
|
||||
|
||||
deviceHtml += '<a href="#" data-icon="minus" class="btnDeleteDevice" data-id="' + d.Id + '">';
|
||||
deviceHtml += Globalize.translate('Delete');
|
||||
deviceHtml += '</a>';
|
||||
|
||||
|
||||
deviceHtml += '</li>';
|
||||
return deviceHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
var elem = $('.devicesList', page).html(html).trigger('create');
|
||||
|
||||
$('.btnDeleteDevice', elem).on('click', function () {
|
||||
|
||||
deleteDevice(page, this.getAttribute('data-id'));
|
||||
});
|
||||
}
|
||||
|
||||
function loadData(page) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Devices')).done(function (devices) {
|
||||
|
||||
load(page, devices);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#devicesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
loadData(page);
|
||||
|
||||
});
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue