Parcourir la source

try to use console button

andre il y a 4 ans
Parent
commit
848a234dd6

+ 2 - 2
app/UI/Vms/Buttons/ConsoleButton.php

@@ -41,8 +41,8 @@ class ConsoleButton extends ButtonDataTableModalAction implements ClientArea
 
     public function afterInitContent()
     {
-        $this->htmlAttributes['@click.middle'] = 'redirect($event, ' . $this->parseCustomParams() . ', true)';
-        $this->htmlAttributes['@click'] = 'redirect($event, ' . $this->parseCustomParams() . ', true)';
+        $this->htmlAttributes['@click.middle'] = 'popup($event, ' . $this->parseCustomParams() . ',' . 'width=900,height=700' . ')';
+        $this->htmlAttributes['@click'] = 'popup($event, ' . $this->parseCustomParams() . ',' . 'width=900,height=700' . ')';
 
         logModuleCall(
             'proxmoxCloud',

+ 23 - 0
templates/client/default/assets/js/defaultComponents/__vue_app_object.js

@@ -560,6 +560,29 @@ var mgDefauleVueObject = {
                         window.location = self.targetUrl;
                     }
                 },
+                popup : function (event, params, targetSize) {
+                    var self = this;
+                    var tempUrl = self.targetUrl;
+                    if(params.rawUrl !== undefined){
+                        self.targetUrl = params.rawUrl;
+                    }
+                    if(params.actionElementId !== undefined) {
+                        self.getActionId(event);
+                    }
+                    $.each(params, function(key, value){
+                        if(key === 'rawUrl' || key === 'actionElementId'){
+                            return false;
+                        } else {
+                            self.updateUrlParam(key.replace('__', '-'), value, event);
+                        }
+                    });
+
+                    if (targetSize) {
+                        window.open(self.targetUrl, targetSize);
+                    } else {
+                        window.open(self.targetUrl, 'width=300,height=200');
+                    }
+                },
                 submitFormByEvent : function(event){
                     var self = this;
                     self.submitForm($(event.target).parents("form").first().attr('id'), event);