From d474267934256598081c260ae93afaab96d96088 Mon Sep 17 00:00:00 2001 From: jvasquez Date: Wed, 9 Sep 2015 14:14:27 -0300 Subject: [PATCH] Adding hidden options for widgets. --- rd_ui/app/scripts/controllers/dashboard.js | 6 ++++++ rd_ui/app/scripts/directives/dashboard_directives.js | 4 +++- rd_ui/app/scripts/filters.js | 3 +++ rd_ui/app/views/dashboard.html | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/rd_ui/app/scripts/controllers/dashboard.js b/rd_ui/app/scripts/controllers/dashboard.js index e3e0256c..3eb1b91e 100644 --- a/rd_ui/app/scripts/controllers/dashboard.js +++ b/rd_ui/app/scripts/controllers/dashboard.js @@ -125,6 +125,12 @@ }; var WidgetCtrl = function($scope, $location, Events, Query) { + $scope.disableWidget = {'visibility': 'visible'}; + $scope.checkWidth = function (width) { + if (width == 0) + $scope.disableWidget = {'visibility': 'hidden'}; + } + $scope.deleteWidget = function() { if (!confirm('Are you sure you want to remove "' + $scope.widget.getName() + '" from the dashboard?')) { return; diff --git a/rd_ui/app/scripts/directives/dashboard_directives.js b/rd_ui/app/scripts/directives/dashboard_directives.js index 855724bf..63fa6b33 100644 --- a/rd_ui/app/scripts/directives/dashboard_directives.js +++ b/rd_ui/app/scripts/directives/dashboard_directives.js @@ -123,6 +123,9 @@ replace: true, link: function($scope, element, attrs) { $scope.widgetSizes = [{ + name: 'Hidden', + value: 0 + }, { name: 'Regular', value: 1 }, { @@ -186,7 +189,6 @@ $scope.saveWidget = function() { $scope.saveInProgress = true; - var widget = new Widget({ 'visualization_id': $scope.selectedVis && $scope.selectedVis.id, 'dashboard_id': $scope.dashboard.id, diff --git a/rd_ui/app/scripts/filters.js b/rd_ui/app/scripts/filters.js index d4e66a8d..3600c1ef 100644 --- a/rd_ui/app/scripts/filters.js +++ b/rd_ui/app/scripts/filters.js @@ -48,6 +48,9 @@ angular.module('redash.filters', []). .filter('colWidth', function () { return function (widgetWidth) { + if (widgetWidth == 0) { + return 0; + } if (widgetWidth == 1) { return 6; } diff --git a/rd_ui/app/views/dashboard.html b/rd_ui/app/views/dashboard.html index e53104a2..f9336006 100644 --- a/rd_ui/app/views/dashboard.html +++ b/rd_ui/app/views/dashboard.html @@ -58,7 +58,7 @@ -
+