mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Refactor browse path function
This commit is contained in:
parent
f0d4fd5523
commit
3dc36c3b92
3 changed files with 22 additions and 22 deletions
|
@ -114,19 +114,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#import_database_path_browse').click(function () {
|
||||
$('#browse-path-type').text('Database File');
|
||||
$('#browse-path-modal').modal('show');
|
||||
browsePath(null, null, '.db');
|
||||
});
|
||||
$('#select-browse-file').click(function () {
|
||||
$('#browse-path-modal').modal('hide');
|
||||
$("#import_database_path").val($('#browse-path').val());
|
||||
$("#import_database_path_browse").click(function () {
|
||||
openBrowsePath(null, null, '.db', 'Database File', 'import_database_path');
|
||||
});
|
||||
|
||||
$('#import_database_file').change(function() {
|
||||
$("#import_database_file").change(function() {
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#import_database_file_name').val($(this)[0].files[0].name);
|
||||
$("#import_database_file_name").val($(this)[0].files[0].name);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -134,7 +128,7 @@
|
|||
$(this).prop('disabled', true);
|
||||
|
||||
var app = $("#import_app").val();
|
||||
var database_file = $('#import_database_file')[0].files[0];
|
||||
var database_file = $("#import_database_file")[0].files[0];
|
||||
var database_path = $("#import_database_path").val();
|
||||
var method = $("#import_method").val();
|
||||
var backup = $("#import_backup_db").is(':checked');
|
||||
|
|
|
@ -62,26 +62,20 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#import_config_path_browse').click(function () {
|
||||
$('#browse-path-type').text('Config File');
|
||||
$('#browse-path-modal').modal('show');
|
||||
browsePath(null, null, '.ini');
|
||||
});
|
||||
$('#select-browse-file').click(function () {
|
||||
$('#browse-path-modal').modal('hide');
|
||||
$("#import_config_path").val($('#browse-path').val());
|
||||
$("#import_config_path_browse").click(function () {
|
||||
openBrowsePath(null, null, '.ini', 'Configuration File', 'import_config_path');
|
||||
});
|
||||
|
||||
$('#import_config_file').change(function() {
|
||||
$("#import_config_file").change(function() {
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#import_config_file_name').val($(this)[0].files[0].name);
|
||||
$("#import_config_file_name").val($(this)[0].files[0].name);
|
||||
}
|
||||
});
|
||||
|
||||
$("#import_config").click(function() {
|
||||
$(this).prop('disabled', true);
|
||||
|
||||
var config_file = $('#import_config_file')[0].files[0];
|
||||
var config_file = $("#import_config_file")[0].files[0];
|
||||
var config_path = $("#import_config_path").val();
|
||||
var backup = $("#import_backup_config").is(':checked');
|
||||
|
||||
|
|
|
@ -2027,6 +2027,18 @@ Rating: {rating}/10 --> Rating: /10
|
|||
});
|
||||
}
|
||||
|
||||
function openBrowsePath(key, path, filter_ext, file_description, select_target) {
|
||||
$("#browse-path-type").text(file_description);
|
||||
$("#browse-path-modal").modal('show');
|
||||
|
||||
$("#select-browse-file").click(function () {
|
||||
$("#browse-path-modal").modal('hide');
|
||||
$("#" + select_target).val($("#browse-path").val());
|
||||
});
|
||||
|
||||
browsePath(key, path, filter_ext);
|
||||
}
|
||||
|
||||
function browsePath(key, path, filter_ext) {
|
||||
$("#browse-path-status-message").html('<i class="fa fa-fw fa-spin fa-refresh"></i>');
|
||||
getBrowsePath(key, path, filter_ext).then(function (data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue