Преглед изворни кода

try to disable delete button on root disk

andre пре 4 година
родитељ
комит
27121b7bdd
2 измењених фајлова са 14 додато и 1 уклоњено
  1. 1 1
      app/UI/Disk/Buttons/DeleteButton.php
  2. 13 0
      app/UI/Disk/Forms/DeleteForm.php

+ 1 - 1
app/UI/Disk/Buttons/DeleteButton.php

@@ -29,7 +29,7 @@ class DeleteButton extends ButtonDataTableModalAction implements ClientArea
     public function initContent()
     public function initContent()
     {
     {
         $this->initIds('deleteDiskButton');
         $this->initIds('deleteDiskButton');
-        $this->setDisableByColumnValue("Name", "Disk 1");
+        $this->setDisableByColumnValue("master", true);
         $this->switchToRemoveBtn();
         $this->switchToRemoveBtn();
         $this->initLoadModalAction(new DeleteModal());
         $this->initLoadModalAction(new DeleteModal());
     }
     }

+ 13 - 0
app/UI/Disk/Forms/DeleteForm.php

@@ -35,6 +35,19 @@ class DeleteForm extends BaseForm implements ClientArea
         $this->setProvider(new DiskProvider());
         $this->setProvider(new DiskProvider());
         $this->initFields();
         $this->initFields();
         $this->loadDataToForm();
         $this->loadDataToForm();
+        $diskName = parent::getFormData()['Name'];
+        if ($diskName == 'Disk 1') {
+            $deleteField = $this->getField('deleteDiskButton');
+
+            logModuleCall(
+                'proxmoxCloud',
+                __FUNCTION__,
+                $diskName,
+                'Debug',
+                $deleteField
+            );
+
+        }
     }
     }
 
 
     public function getAllowedActions()
     public function getAllowedActions()