Commit f42de5f4 by Rashid Khan

Added button to remove panels without using the row editor

parent 5db838a7
define([
'./dash',
'./dashLoader',
'./row',
'./row'
], function () {});
\ No newline at end of file
......@@ -5,5 +5,6 @@ define([
'./kibanaPanel',
'./ngBlur',
'./ngModelOnBlur',
'./tip'
'./tip',
'./confirmClick'
], function () {});
\ No newline at end of file
define([
'angular',
'kbn'
],
function (angular) {
'use strict';
var module = angular.module('kibana.directives');
module.directive('confirmClick', function() {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
elem.bind('click', function() {
var message = attrs.confirmation || "Are you sure you want to do that?";
if (window.confirm(message)) {
var action = attrs.confirmClick;
if (action) {
scope.$apply(scope.$eval(action));
}
}
});
},
};
});
});
\ No newline at end of file
......@@ -11,10 +11,8 @@ function (angular) {
'<i class="icon-spinner small icon-spin icon-large panel-loading"' +
'ng-show="panelMeta.loading == true && !panel.title"></i>' +
// Editor link
'<span class="panelextra">' +
'<span ng-repeat="task in panelMeta.modals" ng-show="task.show">' +
'<span bs-modal="task.partial" class="pointer"><i ' +
'bs-tooltip="task.description" ng-class="task.icon" class="pointer"></i></span>'+
......@@ -25,6 +23,12 @@ function (angular) {
'<i class="icon-cog pointer" bs-tooltip="\'Configure\'"></i></span>'+
' / </span>' +
'<span ng-show="panel.editable != false">' +
'<span confirm-click="row.panels = _.without(row.panels,panel)" '+
'confirmation="Are you sure you want to remove this {{panel.type}} panel?" class="pointer">'+
'<i class="icon-remove-sign pointer" bs-tooltip="\'Remove\'"></i></span>'+
' / </span>' +
'<span class="small strong">{{panel.type}}</span> ' +
'</span>' +
......
......@@ -36,7 +36,7 @@
<tr ng-repeat="panel in row.panels">
<td>{{panel.title}}</td>
<td>{{panel.type}}</td>
<td><select ng-hide="panel.sizeable == false" class="input-mini" ng-model="panel.span" ng-options="f for f in [0,1,2,3,4,5,6,7,8,9,10,11,12]"></select></td>
<td><select ng-hide="panel.sizeable == false" class="input-mini" ng-model="panel.span" ng-options="size for size in [0,1,2,3,4,5,6,7,8,9,10,11,12]"></select></td>
<td><i ng-click="row.panels = _.without(row.panels,panel)" class="pointer icon-remove"></i></td>
<td><i ng-click="_.move(row.panels,$index,$index-1)" ng-hide="$first" class="pointer icon-arrow-up"></i></td>
<td><i ng-click="_.move(row.panels,$index,$index+1)" ng-hide="$last" class="pointer icon-arrow-down"></i></td>
......@@ -48,7 +48,7 @@
<div class="row-fluid" ng-show="editor.index == 2">
<h4>Select Panel Type</h4>
<form class="form-inline">
<select class="input-medium input-append" ng-model="panel.type" ng-options="f for f in config.panel_names|stringSort"></select>
<select class="input-medium input-append" ng-model="panel.type" ng-options="panelType for panelType in config.panel_names|stringSort"></select>
<small ng-show="rowSpan(row) > 11">
Note: This row is full, new panels will wrap to a new line. You should add another row.
</small>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment