From: Marcin Haba Date: Wed, 11 Nov 2020 09:21:42 +0000 (+0100) Subject: baculum: Add path field to restore wizard to narrow down search file results to speci... X-Git-Tag: Release-9.6.7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a230007b1638ce37ca84f6385bbf9e2c5d6557;p=thirdparty%2Fbacula.git baculum: Add path field to restore wizard to narrow down search file results to specific path - idea proposed by Wanderlei Huttel --- diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index da64c8599..a833fb463 100644 Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/en/messages.po b/gui/baculum/protected/Web/Lang/en/messages.po index 524fd8d7f..3c74a4ae2 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -3073,3 +3073,10 @@ msgstr "deleted" msgid "last %days days" msgstr "last %days days" + +msgid "Path (optional):" +msgstr "Path (optional):" + +msgid "With the given path, the results narrow down to the files in the path only." +msgstr "With the given path, the results narrow down to the files in the path only." + diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index c30058fb8..3e765f7e8 100644 Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ja/messages.po b/gui/baculum/protected/Web/Lang/ja/messages.po index 2850cab13..ced1b91a2 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -3159,3 +3159,10 @@ msgstr "deleted" msgid "last %days days" msgstr "last %days days" + +msgid "Path (optional):" +msgstr "Path (optional):" + +msgid "With the given path, the results narrow down to the files in the path only." +msgstr "With the given path, the results narrow down to the files in the path only." + diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index 9183a864f..42cc53d09 100644 Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pl/messages.po b/gui/baculum/protected/Web/Lang/pl/messages.po index fe027e422..e2c8dd986 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -3084,3 +3084,10 @@ msgstr "skasowany" msgid "last %days days" msgstr "ostatnie %days dni" + +msgid "Path (optional):" +msgstr "Ścieżka (opcjonalna):" + +msgid "With the given path, the results narrow down to the files in the path only." +msgstr "Z podaną ścieżką wyniki zawężają się wyłącznie do plików w ścieżce." + diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index 7721e920d..67c155c80 100644 Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pt/messages.po b/gui/baculum/protected/Web/Lang/pt/messages.po index 974b06550..b93d08fe3 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -3084,3 +3084,9 @@ msgstr "itens excluídos" msgid "last %days days" msgstr "últimos %days dias" +msgid "Path (optional):" +msgstr "Path (optional):" + +msgid "With the given path, the results narrow down to the files in the path only." +msgstr "With the given path, the results narrow down to the files in the path only." + diff --git a/gui/baculum/protected/Web/Lang/ru/messages.mo b/gui/baculum/protected/Web/Lang/ru/messages.mo index b02760ce4..7ea98c190 100644 Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ru/messages.po b/gui/baculum/protected/Web/Lang/ru/messages.po index 43e19e733..716ed5e19 100644 --- a/gui/baculum/protected/Web/Lang/ru/messages.po +++ b/gui/baculum/protected/Web/Lang/ru/messages.po @@ -3084,3 +3084,9 @@ msgstr "удалено" msgid "last %days days" msgstr "последние %days дней" +msgid "Path (optional):" +msgstr "Path (optional):" + +msgid "With the given path, the results narrow down to the files in the path only." +msgstr "With the given path, the results narrow down to the files in the path only." + diff --git a/gui/baculum/protected/Web/Pages/RestoreWizard.page b/gui/baculum/protected/Web/Pages/RestoreWizard.page index df85974b4..389dc6d50 100644 --- a/gui/baculum/protected/Web/Pages/RestoreWizard.page +++ b/gui/baculum/protected/Web/Pages/RestoreWizard.page @@ -165,8 +165,9 @@

<%[ Note: if you select incremental or differential backup, on the next step will be also loaded all directories and files from older backups required to do the job restore. In other words, the selected backup determines time point from which will be loaded the selected backup and other older backups (incremental, differential) backups up till closest full backup. ]%>

- <%[ Find job by filename (without path): ]%> - <%[ match exact filename ]%>   + <%[ Find job by filename (without path): ]%> + <%[ match exact filename ]%> + <%[ Path (optional): ]%>  
@@ -226,6 +227,7 @@ var oJobsToRestoreList = { find_job_by_filename_btn: 'restore_wizard_find_job_by_filename_btn', find_job_by_filename_loader: 'restore_wizard_find_job_by_filename_loader', find_strict: 'restore_wizard_find_strict', + find_path: 'restore_wizard_find_using_path', no_backup_msg: 'no_backup_to_restore_msg' }, data: [], @@ -258,20 +260,31 @@ var oJobsToRestoreList = { document.getElementById(this.ids.find_job_by_filename_btn).addEventListener('click', function(e) { this.load_jobs(); }.bind(this)); + document.getElementById(this.ids.find_path).addEventListener('keyup', function(e) { + if (e.keyCode == 13) { + e.preventDefault(); + this.load_jobs(); + } + }.bind(this)); }, load_jobs: function() { var cb = <%=$this->JobListCb->ActiveControl->Javascript%>; - var fjbf = document.getElementById(this.ids.find_job_by_filename); - var fs = document.getElementById(this.ids.find_strict); + var fjbf = document.getElementById(this.ids.find_job_by_filename).value.trim(); + var fs = document.getElementById(this.ids.find_strict).checked; + var fp = document.getElementById(this.ids.find_path).value.trim(); + if (fp.length > 0 && fp.slice(-1) !== '/') { + fp += '/'; + } cb.setCallbackParameter({ - filename: fjbf.value, - strict: fs.checked + filename: fjbf, + strict: fs, + path: fp }); cb.dispatch(); }, show_find_job_by_filename_loader: function(show) { var loader = document.getElementById(this.ids.find_job_by_filename_loader); - loader.style.display = (show) ? '' : 'none'; + loader.style.visibility = (show) ? 'visible' : 'hidden'; }, update_table: function(data, list_type) { oJobsToRestoreList.data = data; diff --git a/gui/baculum/protected/Web/Pages/RestoreWizard.php b/gui/baculum/protected/Web/Pages/RestoreWizard.php index 559e8de48..f8fca1c88 100644 --- a/gui/baculum/protected/Web/Pages/RestoreWizard.php +++ b/gui/baculum/protected/Web/Pages/RestoreWizard.php @@ -322,14 +322,16 @@ class RestoreWizard extends BaculumWebPage * * @param string $filename filename to find a backup * @param boolean $strict strict mode with exact matching name == filename + * @param string $path path to narrow down results to given path * @return array job list with files */ - private function loadBackupsByFilename($filename, $strict) { + private function loadBackupsByFilename($filename, $strict, $path) { $clientid = $this->BackupClient->SelectedValue; $query = [ 'clientid' => $clientid, 'filename' => rawurlencode($filename), - 'strict' => $strict + 'strict' => $strict, + 'path' => $path ]; $params = [ 'jobs', @@ -361,7 +363,7 @@ class RestoreWizard extends BaculumWebPage $list_type = self::JOB_LIST_BY_CLIENT; if (is_object($prop) && !empty($prop->filename)) { $list_type = self::JOB_LIST_BY_FILENAME; - $jobs = $this->loadBackupsByFilename($prop->filename, $prop->strict); + $jobs = $this->loadBackupsByFilename($prop->filename, $prop->strict, $prop->path); } else { $list_type = self::JOB_LIST_BY_CLIENT; $jobs = $this->loadBackupsForClient(); diff --git a/gui/baculum/themes/Baculum-v2/css/baculum.css b/gui/baculum/themes/Baculum-v2/css/baculum.css index 1da9320d3..74e617e4c 100644 --- a/gui/baculum/themes/Baculum-v2/css/baculum.css +++ b/gui/baculum/themes/Baculum-v2/css/baculum.css @@ -131,7 +131,7 @@ div.table_toolbar select { #table_filters { display: inline-block; - vertical-align: text-top; + vertical-align: top; } #table_filters span.text { @@ -143,6 +143,14 @@ div.table_toolbar select { top: 0; } +#table_filters_body { + border: 1px solid gray; + padding: 9px 13px; + border-radius: 4px; + position: relative; + top: -6px; +} + table.dataTable tbody > tr.selected, table.dataTable tbody > tr > .selected { background-color: #f5a55b !important; }