Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard - fullscreen - open in new tab #2920

Merged
merged 1 commit into from
Dec 4, 2017
Merged

Dashboard - fullscreen - open in new tab #2920

merged 1 commit into from
Dec 4, 2017

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Dec 4, 2017

This makes the "Full Screen" button in Dashboard widgets open the fullscreen version in a new window/tab.

Cc @martinpovolny, @ZitaNemeckova

This makes the "Full Screen" button in Dashboard widgets open the fullscreen version in a new window/tab.
@himdel
Copy link
Contributor Author

himdel commented Dec 4, 2017

There was already support for clickAction - but onclick can't be used in angular html (compile error), so to use that we'd have to

diff --git a/app/assets/javascripts/components/dropdown-menu.js b/app/assets/javascripts/components/dropdown-menu.js
index 3e8aa2474e..655fccc43e 100644
--- a/app/assets/javascripts/components/dropdown-menu.js
+++ b/app/assets/javascripts/components/dropdown-menu.js
@@ -11,6 +11,15 @@ ManageIQ.angular.app.component('dropdownMenu', {
       vm.dropdown_id = 'btn_' + vm.id;
       vm.buttons = JSON.parse(vm.buttonsData);
     };
+
+    this.customAction = function($event, action) {
+      if (!action) {
+        return;
+      }
+
+      (new Function(action)).call($event.target);
+      $event.preventDefault();
+    };
   },
   templateUrl: "/static/dropdown-menu.html.haml",
 });
diff --git a/app/views/static/dropdown-menu.html.haml b/app/views/static/dropdown-menu.html.haml
index 621000be0f..571ba5d86a 100644
--- a/app/views/static/dropdown-menu.html.haml
+++ b/app/views/static/dropdown-menu.html.haml
@@ -15,6 +15,7 @@
          'ng-attr-data-remote' => "{{button.dataRemote}}",
          'data-confirm'        => "{{button.confirm}}",
          'href'                => "{{button.href}}",
-         'data-miq_sparkle_on' => "{{button.sparkleOn ? 'true' : 'false'}}"}
+         'data-miq_sparkle_on' => "{{button.sparkleOn ? 'true' : 'false'}}",
+         'ng-click'            => "vm.customAction($event, button.clickAction)"}
         %span{'ng-class' => "button.fonticon"}
         {{button.name}}

.. and the we hit the problem that the function does not read data-confirm, only data-miq_confirm, etc.

Seems cleaner to drop the clickAction code and just add support for target.

@miq-bot
Copy link
Member

miq-bot commented Dec 4, 2017

Checked commit https://github.com/himdel/manageiq-ui-classic/commit/ae76b7d038904d82166dc164aa99a339aa289da1 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

app/presenters/widget_presenter.rb

  • ❗ - Line 67, Col 20 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.

@h-kataria
Copy link
Contributor

looks good.

@dclarizio dclarizio merged commit a5bb860 into ManageIQ:master Dec 4, 2017
@dclarizio dclarizio added this to the Sprint 75 Ending Dec 11, 2017 milestone Dec 4, 2017
@himdel himdel deleted the widget-fullscreen branch December 4, 2017 23:33
simaishi pushed a commit that referenced this pull request Dec 5, 2017
Dashboard - fullscreen - open in new tab
(cherry picked from commit a5bb860)
@simaishi
Copy link
Contributor

simaishi commented Dec 5, 2017

Gaprindashvili backport details:

$ git log -1
commit ebdf125bfe7e70329109dd4cb000c33edc95c19d
Author: Dan Clarizio <[email protected]>
Date:   Mon Dec 4 15:31:56 2017 -0800

    Merge pull request #2920 from himdel/widget-fullscreen
    
    Dashboard - fullscreen - open in new tab
    (cherry picked from commit a5bb860375fb541530f8752e25f017639c1d4cad)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants