From: Marcin Haba Date: Thu, 9 May 2019 14:42:45 +0000 (+0200) Subject: baculum: Use on web interface side new API endpoints to label volume with and without... X-Git-Tag: Release-9.6.0~236 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=781cec232a90cc8ea1404a9233ada215eef4482c;p=thirdparty%2Fbacula.git baculum: Use on web interface side new API endpoints to label volume with and without barcodes --- diff --git a/gui/baculum/protected/Web/Portlets/LabelVolume.php b/gui/baculum/protected/Web/Portlets/LabelVolume.php index cd154fe883..7ca4ac0748 100644 --- a/gui/baculum/protected/Web/Portlets/LabelVolume.php +++ b/gui/baculum/protected/Web/Portlets/LabelVolume.php @@ -53,18 +53,25 @@ class LabelVolume extends Portlets { } public function labelVolumes($sender, $param) { - $cmd = array('label'); + $result = null; if ($this->Barcodes->Checked == true) { - $cmd[] = 'barcodes'; - $cmd[] = 'slots="' . $this->SlotsLabel->Text . '"'; + $params = array( + 'slots' => $this->SlotsLabel->Text, + 'drive' => $this->DriveLabel->Text, + 'storageid' => $this->StorageLabel->SelectedValue, + 'poolid' => $this->PoolLabel->SelectedValue + ); + $result = $this->getModule('api')->create(array('volumes', 'label', 'barcodes'), $params); } else { - $cmd[] = 'volume="' . $this->LabelName->Text . '"'; - $cmd[] = 'slot="' . $this->SlotLabel->Text . '"'; + $params = array( + 'slot' => $this->SlotLabel->Text, + 'volume' => $this->LabelName->Text, + 'drive' => $this->DriveLabel->Text, + 'storageid' => $this->StorageLabel->SelectedValue, + 'poolid' => $this->PoolLabel->SelectedValue + ); + $result = $this->getModule('api')->create(array('volumes', 'label'), $params); } - $cmd[] = 'drive="' . $this->DriveLabel->Text . '"'; - $cmd[] = 'storage="'. $this->StorageLabel->SelectedItem->Text . '"'; - $cmd[] = 'pool="'. $this->PoolLabel->SelectedItem->Text . '"'; - $result = $this->getModule('api')->set(array('console'), $cmd); if ($result->error === 0) { $this->LabelVolumeLog->Text = implode(PHP_EOL, $result->output); } else {