Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Restore bugfix and improvements
Browse files Browse the repository at this point in the history
Bugfix:

- Removes an unnecessary field from restore form, which prevented form validation.

Improvement:

- As long as we're are not able to sort results via api2,
we return arrays in reverse order (desc).

- Removes some more code no longer needed
  • Loading branch information
fbergkemper committed Sep 7, 2015
1 parent e20b015 commit 1b71dee
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 59 deletions.
6 changes: 2 additions & 4 deletions module/Job/src/Job/Controller/JobController.php
Expand Up @@ -297,8 +297,7 @@ private function getJobs()
$director = $this->getServiceLocator()->get('director');
$result = $director->send_command('llist jobs', 2, null);
$jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
array_multisort($jobs['result']['jobs'], SORT_DESC);
return $jobs['result']['jobs'];
return array_reverse($jobs['result']['jobs']);
}

private function getJobsByStatus($status=null, $days=null, $hours=null)
Expand All @@ -315,8 +314,7 @@ private function getJobsByStatus($status=null, $days=null, $hours=null)
$result = $director->send_command('llist jobs jobstatus='.$status, 2, null);
}
$jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
array_multisort($jobs['result']['jobs'], SORT_DESC);
return $jobs['result']['jobs'];
return array_reverse($jobs['result']['jobs']);
}
else {
return null;
Expand Down
37 changes: 2 additions & 35 deletions module/Restore/src/Restore/Form/RestoreForm.php
Expand Up @@ -52,41 +52,6 @@ public function __construct($restore_params=null, $jobs=null, $clients=null, $fi
$this->jobids = $jobids;
$this->backups = $backups;

// Mode
if(isset($restore_params['mode'])) {
$this->add(array(
'name' => 'mode',
'type' => 'checkbox',
'options' => array(
'label' => 'Expert mode',
'use_hidden_element' => true,
'checked_value' => '1',
'unchecked_value' => '0',
),
'attributes' => array(
'id' => 'mode',
'value' => $restore_params['mode']
)
)
);
}
else {
$this->add(array(
'name' => 'mode',
'type' => 'checkbox',
'options' => array(
'label' => 'Expert mode',
'use_hidden_element' => true,
'checked_value' => '1',
'unchecked_value' => '0',
),
'attributes' => array(
'id' => 'mode',
)
)
);
}

// Job
if(isset($restore_params['jobid'])) {
$this->add(array(
Expand Down Expand Up @@ -427,6 +392,8 @@ public function __construct($restore_params=null, $jobs=null, $clients=null, $fi
),
'attributes' => array(
'value' => '/tmp/bareos-restores/',
'id' => 'where',
'size' => '30',
'placeholder' => 'e.g. / or /tmp/bareos-restores/'
)
)
Expand Down
19 changes: 0 additions & 19 deletions module/Restore/src/Restore/Model/RestoreTable.php
Expand Up @@ -25,27 +25,8 @@

namespace Restore\Model;

use Zend\Db\TableGateway\TableGateway;

class RestoreTable
{
protected $tableGateway;

public function __construct(TableGateway $tableGateway)
{
$this->tableGateway = $tableGateway;
}
/*
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
return $resultSet;
}
*/

public function __construct()
{
}

}

2 changes: 1 addition & 1 deletion module/Restore/view/restore/restore/index.phtml
Expand Up @@ -32,7 +32,7 @@ $this->headTitle($title);

<div class="row">
<div class="col-md-12">
<pre style="font-size: 8pt;">
<pre>
<code>
<?php echo $this->result; ?>
</code>
Expand Down

0 comments on commit 1b71dee

Please sign in to comment.