andre 1 жил өмнө
parent
commit
0110fd0cf5

+ 1 - 1
core/UI/MainContainerAjax.php

@@ -38,7 +38,7 @@ class MainContainerAjax extends MainContainer
         return $this;
         return $this;
     }
     }
 
 
-    public function addElement($element)
+    public function addElement($element = null, $containerName = null)
     {
     {
         if (is_string($element))
         if (is_string($element))
         {
         {

+ 1 - 1
core/UI/Traits/ContainerElements.php

@@ -180,7 +180,7 @@ trait ContainerElements
     {
     {
         if (!$containerName)
         if (!$containerName)
         {
         {
-            return count($this->elements) > 0;
+            return count((array)$this->elements) > 0;
         }
         }
 
 
         if (in_array($containerName, $this->elementsContainers) && property_exists($this, $containerName))
         if (in_array($containerName, $this->elementsContainers) && property_exists($this, $containerName))

+ 1 - 1
core/UI/ViewAjax.php

@@ -22,7 +22,7 @@ class ViewAjax extends View
     /**
     /**
      * Adds elements to the root element
      * Adds elements to the root element
      */
      */
-    public function addElement($element)
+    public function addElement($element, $containerName = null)
     {
     {
         return $this;
         return $this;
     }
     }

+ 10 - 7
core/UI/Widget/DataTable/DataTable.php

@@ -78,7 +78,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
             'registrations' => self::getVueComponentsRegistrations()]))->setCallBackFunction($this->callBackFunction)->setRefreshTargetIds($this->refreshActionIds);
             'registrations' => self::getVueComponentsRegistrations()]))->setCallBackFunction($this->callBackFunction)->setRefreshTargetIds($this->refreshActionIds);
     }
     }
 
 
-    public function setName($name)
+    public function setName($name = null)
     {
     {
         $this->name = $name;
         $this->name = $name;
         return $this;
         return $this;
@@ -111,7 +111,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
         return $this;
         return $this;
     }
     }
 
 
-    public function setData(\ModulesGarden\ProxmoxAddon\Core\UI\Interfaces\DataSetInterface $data)
+    public function setData(array $data = [])
     {
     {
         $this->recordsSet = $data;
         $this->recordsSet = $data;
 
 
@@ -130,7 +130,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
 
 
     protected function getCount()
     protected function getCount()
     {
     {
-        return count($this->recordsSet->records);
+        return count($this->recordsSet['records']);
     }
     }
 
 
     protected function getRecords()
     protected function getRecords()
@@ -153,7 +153,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
             $this->loadHtml();
             $this->loadHtml();
         }
         }
 
 
-        $this->setData($this->dataProvider->getData($this->columns));
+        $this->setData((array)$this->dataProvider->getData($this->columns));
     }
     }
 
 
     protected function parseDataRecords()
     protected function parseDataRecords()
@@ -164,9 +164,9 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
             return false;
             return false;
         }
         }
 
 
-        foreach ($this->recordsSet->records as $key => $row)
+        foreach ($this->recordsSet['records'] as $key => $row)
         {
         {
-            $this->recordsSet->records[$key] = $this->replaceRowData($row, $replacementFunctions);
+            $this->recordsSet['records'][$key] = $this->replaceRowData($row, $replacementFunctions);
         }
         }
     }
     }
 
 
@@ -206,7 +206,10 @@ class DataTable extends BaseContainer implements \ModulesGarden\ProxmoxAddon\Cor
             return $this;
             return $this;
         }
         }
 
 
-        $row->$colName = $value;
+        if (is_object($row))
+        {
+            $row->$colName = $value;
+        }
 
 
         return $this;
         return $this;
     }
     }

+ 1 - 1
core/UI/Widget/Forms/DataProviders/BaseDataProvider.php

@@ -57,7 +57,7 @@ abstract class BaseDataProvider implements FormDataProviderInterface
 
 
     public function getAvailableValuesById($id)
     public function getAvailableValuesById($id)
     {
     {
-        if (is_array($this->availableValues[$id]) || count($this->availableValues[$id]) > 0)
+        if (!is_null($this->availableValues[$id]) && (is_array($this->availableValues[$id]) || count($this->availableValues[$id]) > 0))
         {
         {
             return $this->availableValues[$id];
             return $this->availableValues[$id];
         }
         }