Added a library scan button (#417)

This commit is contained in:
Michael Green
2024-09-06 01:59:59 +10:00
committed by GitHub
parent 68be24d514
commit f0783fcae8
5 changed files with 187 additions and 49 deletions

View File

@@ -12,7 +12,7 @@ function drawLibrary() {
function (result) {
let newTable = document.getElementById('settings_libraries');
newTable.innerHTML = '';
newTable.appendChild(createTableRow(true, ['Name', 'Path', 'Default Platform', 'Default Library', '']));
newTable.appendChild(createTableRow(true, ['Name', 'Path', 'Default Platform', 'Default Library', '', '']));
for (let i = 0; i < result.length; i++) {
let platformName = '';
@@ -36,6 +36,35 @@ function drawLibrary() {
let controls = document.createElement('div');
controls.style.textAlign = 'right';
let scanButton = document.createElement('img');
scanButton.id = 'startProcess';
scanButton.className = 'taskstart';
scanButton.src = '/images/start-task.svg';
scanButton.title = 'Start Scan';
scanButton.addEventListener('click', function () {
let scanLibrary = new MessageBox('Scan Library', 'Are you sure you want to scan this library?');
scanLibrary.addButton(new ModalButton('OK', 2, scanLibrary, function (callingObject) {
ajaxCall(
'/api/v1.1/Library/' + result[i].id + '/Scan',
'POST',
function () {
callingObject.msgDialog.close();
drawLibrary();
},
function () {
callingObject.msgDialog.close();
drawLibrary();
}
);
}));
scanLibrary.addButton(new ModalButton('Cancel', 0, scanLibrary, function (callingObject) {
callingObject.msgDialog.close();
}));
scanLibrary.open();
});
let deleteButton = '';
if (result[i].isDefaultLibrary == false) {
deleteButton = document.createElement('a');
@@ -80,6 +109,7 @@ function drawLibrary() {
result[i].path,
platformName,
defaultLibrary,
scanButton,
controls
],
'romrow',