소스 검색

remove ressource validator

andre 4 년 전
부모
커밋
88cc6d5e5e
2개의 변경된 파일0개의 추가작업 그리고 87개의 파일을 삭제
  1. 0 1
      app/UI/VmCreate/Sections/TopSection.php
  2. 0 86
      app/UI/VmCreate/Validators/RessourceValidator.php

+ 0 - 1
app/UI/VmCreate/Sections/TopSection.php

@@ -26,7 +26,6 @@ class TopSection extends RawSection {
         if($this->configuration()->isPermissionOsTemplate() || $this->configuration()->isLxc()){
             $field =new OsTemplateSelect('osTemplate');
             $field->notEmpty();
-            $field->addValidator(new RessourceValidator());
             $this->addField( $field);
         }
         //description

+ 0 - 86
app/UI/VmCreate/Validators/RessourceValidator.php

@@ -1,86 +0,0 @@
-<?php
-
-
-namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmCreate\Validators;
-
-
-use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ResourceManager;
-use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Validators\BaseValidator;
-use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Traits\WhmcsParams;
-use ModulesGarden\Servers\ProxmoxCloudVps\App\Enum\ConfigurableOption;
-
-class RessourceValidator extends BaseValidator
-{
-    protected function validate($data, $additionalData = null)
-    {
-        $resurceManager = new ResourceManager();
-        $additionalSize = 0;
-        $diskResource = $resurceManager ->disk();
-
-        logModuleCall(
-            'proxmoxCloud',
-            __FUNCTION__,
-            $data,
-            'Debug',
-            $diskResource
-        );
-        return true;
-
-        $diskResource->setTotal($diskResource->getTotal()-$additionalSize);
-        if ($this->isWhmcsConfigOption(ConfigurableOption::STORAGE)) {
-            $this->maxValue = $this->getWhmcsConfigOption(ConfigurableOption::STORAGE) - $diskResource->getUsed();
-        } else {
-            $this->maxValue = $diskResource->free();
-        }
-        if ($this->maxValue > $diskResource->getMax()) {
-            $this->addValidationError('PleaseProvideANumericValueBetween', false, ['minValue' => $this->minValue, 'maxValue' => $diskResource->getMax()]);
-            return false;
-        }
-
-        $this->minValue =  $diskResource->getMin();
-        if(preg_match("/\./", $data)){
-            $this->addValidationError('PleaseProvideANumericValueBetween', false, ['minValue' => $this->minValue, 'maxValue' => $this->maxValue]);
-            return false;
-        }
-        if (is_numeric($data) && $this->minValue === 0 && $this->maxValue === 0)
-        {
-            return true;
-        }
-        //Min & Max
-        if (is_numeric($data) && $this->minValue <= ((int)$data) && ((int)$data) <= $this->maxValue)
-        {
-            return true;
-        }
-        //Min
-        else
-        {
-            if (is_numeric($data) && !is_numeric($this->maxValue) && $this->minValue <= ((int)$data))
-            {
-                return true;
-            }
-        }
-
-        if ($this->minValue === $this->maxValue)
-        {
-            $this->addValidationError('PleaseProvideANumericValue');
-
-            return false;
-        }
-
-        if (is_numeric($this->minValue) && is_numeric($this->maxValue))
-        {
-            $this->addValidationError('PleaseProvideANumericValueBetween', false, ['minValue' => $this->minValue, 'maxValue' => $this->maxValue]);
-        }
-        else
-        {
-            if (is_numeric($this->minValue) && !is_numeric($this->maxValue))
-            {
-                $this->addValidationError('PleaseProvideANumericValueFrom', false, ['minValue' => $this->minValue]);
-            }
-        }
-
-
-        return false;
-    }
-
-}