]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Use on web interface side new API endpoints to label volume with and without...
authorMarcin Haba <marcin.haba@bacula.pl>
Thu, 9 May 2019 14:42:45 +0000 (16:42 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 14:50:00 +0000 (15:50 +0100)
gui/baculum/protected/Web/Portlets/LabelVolume.php

index cd154fe883c28cf6d4086890e86972e8dadc0733..7ca4ac0748cd12d046ba0332ea732e85084f7965 100644 (file)
@@ -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 {