|
@@ -58,6 +58,7 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
|
|
|
|
|
$isAdmin = isAdmin();
|
|
$isAdmin = isAdmin();
|
|
|
//create
|
|
//create
|
|
|
|
|
+ $resurceManager = new ResourceManager();
|
|
|
if(!$isAdmin){
|
|
if(!$isAdmin){
|
|
|
$createButton = new ButtonRedirect('createVmButton');
|
|
$createButton = new ButtonRedirect('createVmButton');
|
|
|
$createButton->setShowTitle();
|
|
$createButton->setShowTitle();
|
|
@@ -65,12 +66,16 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
$createButton->setRawUrl($url);
|
|
$createButton->setRawUrl($url);
|
|
|
$createButton->setIcon('lu-zmdi lu-zmdi-plus');
|
|
$createButton->setIcon('lu-zmdi lu-zmdi-plus');
|
|
|
$createButton->replaceClasses(['lu-btn lu-btn--primary']);
|
|
$createButton->replaceClasses(['lu-btn lu-btn--primary']);
|
|
|
- $this->addTitleButton($createButton);
|
|
|
|
|
- $sidebars = sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChildren();
|
|
|
|
|
- if (isset($sidebars['vmcreate'])) {
|
|
|
|
|
- $this->createSidebar = 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);
|
|
|
|
|
+ sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->add($vmCreateSidebar);
|
|
|
}
|
|
}
|
|
|
- $this->createButton = $createButton;
|
|
|
|
|
|
|
+ $this->addTitleButton($createButton);
|
|
|
}
|
|
}
|
|
|
//import
|
|
//import
|
|
|
if($isAdmin){
|
|
if($isAdmin){
|
|
@@ -99,30 +104,6 @@ class VmsDataTable extends DataTable implements ClientArea, AdminArea
|
|
|
->addColumn((new Column('memory')))
|
|
->addColumn((new Column('memory')))
|
|
|
->addColumn((new Column('disk')))
|
|
->addColumn((new Column('disk')))
|
|
|
->addColumn((new Column('osTemplate')));
|
|
->addColumn((new Column('osTemplate')));
|
|
|
- $resurceManager = new ResourceManager();
|
|
|
|
|
- $sidebars = sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChildren();
|
|
|
|
|
- //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
|
|
|
|
|
- if (isset($sidebars['vmcreate'])) {
|
|
|
|
|
- sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmcreate")->delete();
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!isset($sidebars['vmcreate'])) {
|
|
|
|
|
- sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->add($this->createSidebar);
|
|
|
|
|
- }
|
|
|
|
|
- // $this->createButton->addHtmlAttribute("enabled",true);
|
|
|
|
|
-
|
|
|
|
|
-/* logModuleCall(
|
|
|
|
|
- 'proxmoxCloud',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChildren(),
|
|
|
|
|
- 'Debug',
|
|
|
|
|
- $this
|
|
|
|
|
- ); */
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|