Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos-webui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Bergkemper <frank.bergkemper@bareos.com>2017-10-17 12:31:57 +0300
committerFrank Bergkemper <frank.bergkemper@bareos.com>2017-10-20 12:54:14 +0300
commit275905bf480ed921ffd55d30deae17b2ad4ae414 (patch)
treeaae3faf3916d947b9eadc6215548f029fc213b30
parent0f1d99fc6fe04be0efb871138eb34cc31a92aae2 (diff)
Restore: Filebrowser adjustmentsRelease/17.2.4-rc2
-rw-r--r--module/Restore/src/Restore/Controller/RestoreController.php8
-rw-r--r--module/Restore/src/Restore/Model/RestoreModel.php115
-rw-r--r--module/Restore/view/restore/restore/index.phtml44
3 files changed, 112 insertions, 55 deletions
diff --git a/module/Restore/src/Restore/Controller/RestoreController.php b/module/Restore/src/Restore/Controller/RestoreController.php
index e532a4e..d432981 100644
--- a/module/Restore/src/Restore/Controller/RestoreController.php
+++ b/module/Restore/src/Restore/Controller/RestoreController.php
@@ -272,11 +272,11 @@ class RestoreController extends AbstractActionController
else {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
- $this->directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobids'], $this->restore_params['id'], $this->restore_params['limit']);
+ $this->directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobids'], $this->restore_params['id']);
}
}
else {
- $this->directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobid'], $this->restore_params['id'], $this->restore_params['limit']);
+ $this->directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobid'], $this->restore_params['id']);
}
}
catch(Exception $e) {
@@ -300,11 +300,11 @@ class RestoreController extends AbstractActionController
else {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
- $this->files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobids'], $this->restore_params['id'], $this->restore_params['limit']);
+ $this->files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobids'], $this->restore_params['id']);
}
}
else {
- $this->files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobid'], $this->restore_params['id'], $this->restore_params['limit']);
+ $this->files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobid'], $this->restore_params['id']);
}
}
catch(Exception $e) {
diff --git a/module/Restore/src/Restore/Model/RestoreModel.php b/module/Restore/src/Restore/Model/RestoreModel.php
index b65720b..1c43368 100644
--- a/module/Restore/src/Restore/Model/RestoreModel.php
+++ b/module/Restore/src/Restore/Model/RestoreModel.php
@@ -34,34 +34,63 @@ class RestoreModel
* @param $bsock
* @param $jobid
* @param $pathid
- * @param $limit
*
* @return array
*/
- public function getDirectories(&$bsock=null, $jobid=null, $pathid=null, $limit=null) {
+ public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
if(isset($bsock)) {
- if($pathid == null || $pathid== "#") {
- $cmd = '.bvfs_lsdirs jobid='.$jobid.' path=';
- }
- else {
- $cmd = '.bvfs_lsdirs jobid='.$jobid.' pathid='.abs($pathid).' limit='.$limit;
- }
- $result = $bsock->send_command($cmd, 2, $jobid);
- $directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($directories['result']['directories'])) {
- $cmd = '.bvfs_lsdirs jobid='.$jobid.' path=@ limit='.$limit;
- $result = $bsock->send_command($cmd, 2, $jobid);
+
+ $limit = 1000;
+ $offset = 0;
+ $retval = array();
+
+ while (true) {
+
+ if($pathid == null || $pathid== "#") {
+ $cmd_1 = '.bvfs_lsdirs jobid='.$jobid.' path= limit='.$limit.' offset='.$offset;
+ }
+ else {
+ $cmd_1 = '.bvfs_lsdirs jobid='.$jobid.' pathid='.abs($pathid).' limit='.$limit.' offset='.$offset;
+ }
+
+ $result = $bsock->send_command($cmd_1, 2, $jobid);
$directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+
if(empty($directories['result']['directories'])) {
- return null;
+ $cmd_2 = '.bvfs_lsdirs jobid='.$jobid.' path=@ limit='.$limit;
+ $result = $bsock->send_command($cmd_2, 2, $jobid);
+ $directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(count($directories['result']['directories']) == 2) {
+ $retval = array_merge($retval, $directories['result']['directories']);
+ // as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
+ foreach($retval as $key => $value) {
+ if($retval[$key]['name'] === "." || $retval[$key]['name'] === "..")
+ unset($retval[$key]);
+ }
+ return $retval;
+ }
+ else {
+ $retval = array_merge($retval, $directories['result']['directories']);
+ }
+ }
+ // no more results?
+ elseif (count($directories['result']['directories']) == 2) {
+ $retval = array_merge($retval, $directories['result']['directories']);
+ // as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
+ foreach($retval as $key => $value) {
+ if($retval[$key]['name'] === "." || $retval[$key]['name'] === "..")
+ unset($retval[$key]);
+ }
+ return $retval;
}
+ // continue
else {
- return $directories['result']['directories'];
+ $retval = array_merge($retval, $directories['result']['directories']);
}
+ $offset = $offset + $limit;
+
}
- else {
- return $directories['result']['directories'];
- }
+
}
else {
throw new \Exception('Missing argument.');
@@ -74,34 +103,46 @@ class RestoreModel
* @param $bsock
* @param $jobid
* @param $pathid
- * @param $limit
*
* @return array
*/
- public function getFiles(&$bsock=null, $jobid=null, $pathid=null, $limit=null) {
- if(isset($bsock, $limit)) {
- if($pathid == null || $pathid == "#") {
- $cmd = '.bvfs_lsfiles jobid='.$jobid.' path=';
- }
- else {
- $cmd = '.bvfs_lsfiles jobid='.$jobid.' pathid='.abs($pathid).' limit='.$limit;
- }
- $result = $bsock->send_command($cmd, 2, $jobid);
- $files = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($files['result']['files'])) {
- $cmd = '.bvfs_lsfiles jobid='.$jobid.' path=@ limit='.$limit;
- $result = $bsock->send_command($cmd, 2, $jobid);
+ public function getFiles(&$bsock=null, $jobid=null, $pathid=null) {
+ if(isset($bsock)) {
+
+ $limit = 1000;
+ $offset = 0;
+ $retval = array();
+
+ while (true) {
+
+ if($pathid == null || $pathid == "#") {
+ $cmd_1 = '.bvfs_lsfiles jobid='.$jobid.' path= limit='.$limit.' offset='.$offset;
+ }
+ else {
+ $cmd_1 = '.bvfs_lsfiles jobid='.$jobid.' pathid='.abs($pathid).' limit='.$limit.' offset='.$offset;
+ }
+
+ $result = $bsock->send_command($cmd_1, 2, $jobid);
$files = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+
if(empty($files['result']['files'])) {
- return null;
+ $cmd_2 = '.bvfs_lsfiles jobid='.$jobid.' path=@ limit='.$limit.' offset='.$offset;
+ $result = $bsock->send_command($cmd_2, 2, $jobid);
+ $files = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(empty($files['result']['files'])) {
+ return $retval;
+ }
+ else {
+ $retval = array_merge($retval, $files['result']['files']);
+ }
}
else {
- return $files['result']['files'];
+ $retval = array_merge($retval, $files['result']['files']);
}
+ $offset = $offset + $limit;
+
}
- else {
- return $files['result']['files'];
- }
+
}
else {
throw new \Exception('Missing argument.');
diff --git a/module/Restore/view/restore/restore/index.phtml b/module/Restore/view/restore/restore/index.phtml
index 6a9b52e..58ebd3c 100644
--- a/module/Restore/view/restore/restore/index.phtml
+++ b/module/Restore/view/restore/restore/index.phtml
@@ -98,6 +98,7 @@ $this->headTitle($title);
echo '<p>'.$this->formRow($form->get('restorejob')).'</p>';
echo '<p>'.$this->formRow($form->get('replace')).'</p>';
echo '<p>'.$this->formRow($form->get('where')).'</p>';
+ echo '<p><br />'.$this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary')).'</p>';
// Hidden fields
echo $this->formRow($form->get('checked_files'));
echo $this->formRow($form->get('checked_directories'));
@@ -120,7 +121,7 @@ $this->headTitle($title);
echo '<strong>';
echo $this->translate("File selection");
echo '</strong>';
-
+/*
echo '<div class="form-group">';
echo '<label class="control-label col-md-1">';
echo $this->formLabel($form->get('limit'));
@@ -129,8 +130,8 @@ $this->headTitle($title);
echo $this->formText($form->get('limit'));
echo '</div>';
echo '</div>';
-
- echo '<div class="panel panel-default" style="height: 600px; overflow: scroll;"><div id="filebrowser"></div></div>';
+*/
+ echo '<div class="panel panel-default" style="height: 550px; overflow: auto; resize: both;"><div id="filebrowser"></div></div>';
/*
echo '<div class="input-group">';
@@ -143,12 +144,7 @@ $this->headTitle($title);
}
?>
</div>
-</div>
-<div class="row">
- <div class="col-md-3">
- <?php echo $this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary')); ?>
- </div>
</div>
<?php
@@ -167,6 +163,15 @@ $this->headTitle($title);
echo $this->headLink()->prependStylesheet($this->basePath() . '/css/jstree.min.css');
?>
+<style>
+
+.jsTreeGridHeader {
+ background-color: #eeeeee;
+ color: #000000;
+}
+
+</style>
+
<script type="text/javascript">
function format_bytes(v) {
@@ -271,27 +276,37 @@ $this->headTitle($title);
});
$('#filebrowser').jstree({
+ 'plugins' : [ "grid", "checkbox", "state", "sort", "search", "types" ],
'core' : {
+ 'animation': false,
+ 'force_text': true,
+ 'error': function () {
+ alert('Oops, something went wrong, probably too many files.')
+ },
'data' :{
'url' : '<?php echo $this->basePath() . "/restore/filebrowser?type=" . $this->restore_params['type'] . "&jobid=" . $this->restore_params['jobid'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs'] . "&limit=" . $this->restore_params['limit']; ?>',
'dataType' : 'json',
'data' : function (node) {
return { 'id' : node.id };
},
- //'error' : alert('Error loading filetree') // debug
- }
+ },
},
- 'plugins' : [ "grid", "checkbox", "state", "sort", "search", "types" ],
'grid' : {
+ width: '100%',
+ fixedHeader: true,
+ resizable: false,
columns: [
{
- width: 500,
+ width: '100%',
+ height: '100%',
header: '<?php echo $this->translate("Name"); ?>',
+ headerClass: 'jsTreeGridHeader',
title: "_DATA_"
},
{
- width: 125,
+ width: 150,
header: '<?php echo $this->translate("Size"); ?>',
+ headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data.stat.size == 0) {
return null;
@@ -302,7 +317,9 @@ $this->headTitle($title);
}
},
{
+ width: 150,
header: '<?php echo $this->translate("Date"); ?>',
+ headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data.stat.mtime == 0) {
return null;
@@ -313,7 +330,6 @@ $this->headTitle($title);
}
}
],
- resizable: true,
},
'search' : {
"case_sensitive" : false,