Kaynağa Gözat

bugfix max disk size

andre 4 yıl önce
ebeveyn
işleme
d6c34ceba0
1 değiştirilmiş dosya ile 6 ekleme ve 18 silme
  1. 6 18
      app/UI/VmCreate/Sections/Qemu/GeneralSection.php

+ 6 - 18
app/UI/VmCreate/Sections/Qemu/GeneralSection.php

@@ -40,23 +40,6 @@ class GeneralSection extends HalfPageSection
         $this->initIds('generalSection');
         $this->resourceManager = new ResourceManager();
         $this->initFields();
-        $rangeField = $this->getField('disk');
-        $rangeField->setMinValue($this->configuration()->serverDiskSize->min);
-        $rangeField->setDefaultValue($this->configuration()->serverDiskSize->min);
-        if ($this->configuration()->serverDiskSize->max > ($this->resourceManager->disk()->free())) {
-            $rangeField->setMaxValue(125);
-        } else {
-            $rangeField->setMaxValue(215);
-        }
-
-        logModuleCall(
-            'proxmoxCloud',
-            __FUNCTION__,
-            $this->resourceManager->disk(),
-            'Debug',
-            $this->resourceManager->disk()->free()
-        );
-
     }
 
     public function initFields()  {
@@ -147,7 +130,12 @@ class GeneralSection extends HalfPageSection
         $field->setDescription('description');
         $this->addField($field);
         //disk
-        $field = new Range('disk', 0,0);
+        if ($this->configuration()->serverDiskSize->max > ($this->resourceManager->disk()->free())) {
+            $maxRange = $this->resourceManager->disk()->free();
+        } else {
+            $maxRange = $this->configuration()->serverDiskSize->max;
+        }
+        $field = new Range('disk', $this->configuration()->serverDiskSize->min, $maxRange);
         $field->addValidator(new DiskSizeValidator('disk',true));
         $field->setDescription('description');
         $this->addField($field);