Skip to content

Commit

Permalink
Backup Restore Sort Alpha (#8792)
Browse files Browse the repository at this point in the history
* Sort alpha

* Sort alpha

* sorting force zip

* clean up

cut down code

* select the file

* select the file

* restore inc zip

* restore core inc zip

* restore core inc zip
  • Loading branch information
BKSteve authored Oct 7, 2024
1 parent 57e43b7 commit 74ce06f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 12 additions & 2 deletions sickchill/gui/slick/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@
let list = null;
let link = null;

const innerData = $.grep(data, (value, index) => index !== 0);
// Separate folders and files
const folders = data.filter(item => item.isFile === false);
const files = data.filter(item => item.isFile === true);

// Sort folders and files alphabetically
folders.sort((a, b) => a.name.localeCompare(b.name));
files.sort((a, b) => a.name.localeCompare(b.name));

// Concatenate sorted folders and files
const innerData = [data[1], ...folders, ...files];

const inputContainer = $('<div class="fileBrowserFieldContainer"></div>');

$('<input type="text" class="form-control input-sm">').val(currentBrowserPath).on('keypress', event => {
Expand Down Expand Up @@ -128,7 +138,7 @@
class: 'btn',
click() {
// Store the browsed path to the associated text field
callback(newOptions.includeFiles ? $(this).find('.fileBrowserField').val() : currentBrowserPath, newOptions);
callback(newOptions.includeFiles ? currentBrowserPath : $(this).find('.fileBrowserField').val(), newOptions);
$(this).dialog('close');
},
}, {
Expand Down
4 changes: 3 additions & 1 deletion sickchill/gui/slick/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ const SICKCHILL = {
});

$('#backupDirectory').fileBrowser({title: _('Select backup folder to save to'), key: 'backupPath'});
$('#backupFile').fileBrowser({title: _('Select backup files to restore'), key: 'backupFile', includeFiles: 1});
$('#backupFile').fileBrowser({
title: _('Select backup files to restore'), key: 'backupFile', includeFiles: 1, fileTypes: ['zip'],
});
$('#config-components').tabs();
},
notifications() {
Expand Down

0 comments on commit 74ce06f

Please sign in to comment.