]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add path field to restore wizard to narrow down search file results to speci...
authorMarcin Haba <marcin.haba@bacula.pl>
Wed, 11 Nov 2020 09:21:42 +0000 (10:21 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Wed, 11 Nov 2020 09:21:42 +0000 (10:21 +0100)
13 files changed:
gui/baculum/protected/Web/Lang/en/messages.mo
gui/baculum/protected/Web/Lang/en/messages.po
gui/baculum/protected/Web/Lang/ja/messages.mo
gui/baculum/protected/Web/Lang/ja/messages.po
gui/baculum/protected/Web/Lang/pl/messages.mo
gui/baculum/protected/Web/Lang/pl/messages.po
gui/baculum/protected/Web/Lang/pt/messages.mo
gui/baculum/protected/Web/Lang/pt/messages.po
gui/baculum/protected/Web/Lang/ru/messages.mo
gui/baculum/protected/Web/Lang/ru/messages.po
gui/baculum/protected/Web/Pages/RestoreWizard.page
gui/baculum/protected/Web/Pages/RestoreWizard.php
gui/baculum/themes/Baculum-v2/css/baculum.css

index da64c859968de7dd39730ded3561d6e9e1dd1bcd..a833fb463e432810e7c409b624bbe6cea9480280 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ
index 524fd8d7fcb6243bd314aa6a0f5f67a2c7b415ea..3c74a4ae2d4f94b28688167eaf418300660acafc 100644 (file)
@@ -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."
+
index c30058fb8295332b094a2ae7d438efd823c6b947..3e765f7e8998e77ae171c0d869647f2582061597 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ
index 2850cab13df474cb2e1ee9f7d61071ca1ac825da..ced1b91a2c408949c2005d9429f37a81502b26e3 100644 (file)
@@ -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."
+
index 9183a864fedf1b663307e4b401b34ae30cd52d6b..42cc53d09c3372bcbccbfd733d969c13a13ab370 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ
index fe027e422d0f0c1a20d8f1a5b0f05d7aaf2dc0ca..e2c8dd986a3941024afe303b170b2b93625a815f 100644 (file)
@@ -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."
+
index 7721e920d6bd5e7e60e422aa8ac420cfe4c95a6a..67c155c803aabd437261cd530c252a6f9460440d 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ
index 974b065508f10bccca3f5bcecb6edc12da915bb4..b93d08fe32afbd9fd4c605c32bdc3fb90e0db010 100644 (file)
@@ -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."
+
index b02760ce429475ee8ec3a2705e8a4d4531bf4627..7ea98c190ff800ec668ec198f4e2c2da822f1b51 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ
index 43e19e73300e73c531f05f33aeb731129177c51f..716ed5e19da74920f350e043c0c084b4ad7b96bb 100644 (file)
@@ -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."
+
index df85974b4556f6baa9de471e4d14b1856f6edefa..389dc6d5082535f500eeda5fd14d53224e519475 100644 (file)
                        <div id="backup_to_restore_field" style="display: <%=!$this->OnlySelectedBackupSelection->Checked ? 'none' : 'block'%>">
                                <p><strong><%[ 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. ]%></strong></p>
                                <div id="table_filters_body">
-                                       <span class="text"><%[ Find job by filename (without path): ]%></span> <input type="text" class="w3-text" id="restore_wizard_find_job_by_filename" /> <i id="restore_wizard_find_job_by_filename_btn" class="fas fa-search"  style="cursor: pointer"></i>
-                                       <span  title="<%[ With this option are searched files with names equal provided filename, otherwise there are searched files with names containing provided filename like *filename*. ]%>" style="margin-left: 10px"><input type="checkbox" class="w3-check" id="restore_wizard_find_strict" value="1" /> <span class="text"><%[ match exact filename ]%></span></span> &nbsp;<i id="restore_wizard_find_job_by_filename_loader" class="fas fa-sync fa-spin" style="display: none"></i>
+                                       <span class="text"><%[ Find job by filename (without path): ]%></span> <input type="text" class="w3-text" id="restore_wizard_find_job_by_filename" /> <i id="restore_wizard_find_job_by_filename_btn" class="fas fa-search" style="cursor: pointer; margin-right: 10px;"></i>
+                                       <span  title="<%[ With this option are searched files with names equal provided filename, otherwise there are searched files with names containing provided filename like *filename*. ]%>" style="margin-right: 10px"><input type="checkbox" class="w3-check" id="restore_wizard_find_strict" value="1" /> <span class="text"><%[ match exact filename ]%></span></span>
+                                       <span title="<%[ With the given path, the results narrow down to the files in the path only. ]%>"><span class="text"><%[ Path (optional): ]%></span><input type="text" class="w3-text" id="restore_wizard_find_using_path" /> &nbsp;<i id="restore_wizard_find_job_by_filename_loader" class="fas fa-sync fa-spin" style="visibility: hidden;"></i>
                                </div>
                                <table id="job_to_restore_list" style="width: 100%">
                                        <thead>
@@ -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;
index 559e8de485a0e301eb3a2ce50777dacececb81ea..f8fca1c88e80955d7c3796f2a19fbb2281f253ce 100644 (file)
@@ -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();
index 1da9320d3dbe263f11a768c90056253436f0e672..74e617e4ca5a44d3f11ef70b2352d5b5dc88fddd 100644 (file)
@@ -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;
 }