Navigation Menu

Skip to content

Commit

Permalink
webui: change the construction of the restore form element "where"
Browse files Browse the repository at this point in the history
Use a placeholder or the "where" directive from the selected restore
job instead of a fixed value during form element construction.
  • Loading branch information
fbergkemper committed Mar 24, 2020
1 parent 7fc7420 commit 737ee72
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions webui/module/Restore/src/Restore/Form/RestoreForm.php
Expand Up @@ -408,7 +408,7 @@ public function __construct($restore_params=null, $clients=null, $filesets=null,
}

// Where
if(isset($this->restore_params['client'])) {
if(isset($this->restore_params['restorejob'])) {
$this->add(array(
'name' => 'where',
'type' => 'text',
Expand All @@ -417,31 +417,51 @@ public function __construct($restore_params=null, $clients=null, $filesets=null,
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'value' => '/tmp/bareos-restores/',
'value' => $this->determineWhereDirective($this->restore_params['restorejob']),
'id' => 'where',
'size' => '30',
'placeholder' => _('e.g. / or /tmp/bareos-restores/')
'placeholder' => _('e.g. / or /tmp/bareos-restores/'),
'required' => 'required'
)
)
);
}
else {
$this->add(array(
'name' => 'where',
'type' => 'text',
'options' => array(
'label' => _('Restore location on client')
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'value' => '/tmp/bareos-restores/',
'id' => 'where',
'size' => '30',
'placeholder' => _('e.g. / or /tmp/bareos-restores/'),
'disabled' => true
)
)
);
if(!empty($this->restore_params['client']) && count($this->getRestoreJobList()) > 0) {
$this->add(array(
'name' => 'where',
'type' => 'text',
'options' => array(
'label' => _('Restore location on client')
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'value' => @array_pop($this->getRestoreJobWhereDirectives()),
'id' => 'where',
'size' => '30',
'placeholder' => _('e.g. / or /tmp/bareos-restores/'),
'required' => 'required'
)
)
);
} else {
$this->add(array(
'name' => 'where',
'type' => 'text',
'options' => array(
'label' => _('Restore location on client')
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'id' => 'where',
'size' => '30',
'placeholder' => _('e.g. / or /tmp/bareos-restores/'),
'required' => 'required',
'disabled' => true
)
)
);
}
}

// JobIds hidden
Expand Down

0 comments on commit 737ee72

Please sign in to comment.