|
|
@@ -58,7 +58,6 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
|
|
|
$isAdmin = isAdmin();
|
|
|
//create
|
|
|
- $resurceManager = new ResourceManager();
|
|
|
if(!$isAdmin){
|
|
|
$createButton = new ButtonRedirect('createVmButton');
|
|
|
$createButton->setShowTitle();
|
|
|
@@ -66,15 +65,6 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
$createButton->setRawUrl($url);
|
|
|
$createButton->setIcon('lu-zmdi lu-zmdi-plus');
|
|
|
$createButton->replaceClasses(['lu-btn lu-btn--primary']);
|
|
|
- $vmCreateSidebar = $vmCreateSidebar ? $vmCreateSidebar : sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmcreate");
|
|
|
- //deaktivate createVM Button in case of lack of ressources
|
|
|
- if($resurceManager->disk()->free() < $resurceManager->disk()->getMin() || $resurceManager->vcpus()->free() < $resurceManager->vcpus()->getMin() || $resurceManager->memory()->free() < $resurceManager->memory()->getMin()) {
|
|
|
- $createButton->addHtmlAttribute("disabled",true);
|
|
|
- //delete sidebar button
|
|
|
- sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmcreate")->delete();
|
|
|
- } else {
|
|
|
- $createButton->addHtmlAttribute("enabled",true);
|
|
|
- }
|
|
|
$this->addTitleButton($createButton);
|
|
|
}
|
|
|
//import
|
|
|
@@ -104,6 +94,15 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
->addColumn((new Column('memory')))
|
|
|
->addColumn((new Column('disk')))
|
|
|
->addColumn((new Column('osTemplate')));
|
|
|
+ $resurceManager = new ResourceManager();
|
|
|
+ //deaktivate createVM Button in case of lack of ressources
|
|
|
+ if($resurceManager->disk()->free() < $resurceManager->disk()->getMin() || $resurceManager->vcpus()->free() < $resurceManager->vcpus()->getMin() || $resurceManager->memory()->free() < $resurceManager->memory()->getMin()) {
|
|
|
+ $this->createButton->addHtmlAttribute("disabled",true);
|
|
|
+ //delete sidebar button
|
|
|
+ sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmcreate")->delete();
|
|
|
+ } else {
|
|
|
+ $this->createButton->addHtmlAttribute("enabled",true);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|