andre 4 лет назад
Родитель
Сommit
129f57dd1f
1 измененных файлов с 12 добавлено и 15 удалено
  1. 12 15
      app/UI/Vms/Buttons/ConsoleButton.php

+ 12 - 15
app/UI/Vms/Buttons/ConsoleButton.php

@@ -32,29 +32,26 @@ class ConsoleButton extends ButtonDataTableModalAction implements ClientArea
 
     public function initContent()
     {
-        //noVNC
+        if (isAdmin() || $this->configuration()->isPermissionNovnc())
+        {
+
+            $redirectButton = new RedirectButton('novnc');
+            $redirectButton->setImageUrl(BuildUrl::getAppAssetsURL() . DS . 'img' . DS . 'buttons' . DS . 'novnc.png');
+            $redirectButton->setHref("#");
+            $redirectButton->setIcon('lu-zmdi lu-zmdi-fullscreen');
+            $this->addButton($redirectButton);
+        }
         $this->initIds('consoleButton');
         $this->setDisableByColumnValue("vmid", 0);
-        $url ="#";
+        $url ="clientarea.php?action=productdetails&id={$this->getWhmcsParamByKey('serviceid')}&modop=custom&a=management&mg-page=vm";
         $this->setRawUrl($url)
             ->setRedirectParams(['vm' => ':id']);
     }
 
     public function afterInitContent()
     {
-        $this->serviceUrl = new UrlServiceHelper();
-
-        logModuleCall(
-            'proxmoxCloud',
-            __FUNCTION__,
-            $this,
-            'Debug',
-            $this->serviceUrl
-        );
-        
-//        $this->vmModel = \ModulesGarden\ProxmoxAddon\Core\Helper\sl('Vm')->getVmModel();
-
-//        $this->htmlAttributes['@click'] = "window.open('{$this->serviceUrl->getNoVncConsoleUrl()}', '', 'width=900,height=700'); return false;";
+        $this->htmlAttributes['@click.middle'] = 'redirect($event, ' . $this->parseCustomParams() . ', true)';
+        $this->htmlAttributes['@click'] = 'redirect($event, ' . $this->parseCustomParams() . ')';
     }
 
     public function setRawUrl($url)