Commit 1742c03b by Torkel Ödegaard

small refactoring

parent 00777ea1
...@@ -7,39 +7,52 @@ function (angular) { ...@@ -7,39 +7,52 @@ function (angular) {
angular angular
.module('kibana.directives') .module('kibana.directives')
.directive('kibanaPanel', function($compile) { .directive('kibanaPanel', function($compile) {
var container = '<div class="panelCont"></div>';
var editorTemplate = var container = '<div class="panel-container"></div>';
var content = '<div class="panel-content"></div>';
'<div class="row-fluid panel-extra"><div class="panel-extra-container">' + var panelHeader =
'<div class="panel-header">'+
'<div class="row-fluid">' +
'<div class="span12 alert-error panel-error" ng-hide="!panel.error">' +
'<a class="close" ng-click="panel.error=false">&times;</a>' +
'<i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}}' +
'</div>' +
'</div>\n' +
'<span class="row-button extra" ng-show="panelMeta.loading == true">' + '<div class="row-fluid panel-extra">' +
'<span>'+ '<div class="panel-extra-container">' +
'<i class="icon-spinner icon-spin icon-large"></i>' +
'<span class="row-button extra" ng-show="panelMeta.loading == true">' +
'<span>'+
'<i class="icon-spinner icon-spin icon-large"></i>' +
'</span>'+
'</span>' +
'<span ng-if="panelMeta.menuItems" class="dropdown" ng-show="panel.title">' +
'<span class="panel-text panel-title pointer" bs-dropdown="panelMeta.menuItems" tabindex="1" ' +
'data-drag=true data-jqyoui-options="{revert: \'invalid\',helper:\'clone\'}"'+
' jqyoui-draggable="'+
'{'+
'animate:false,'+
'mutate:false,'+
'index:{{$index}},'+
'onStart:\'panelMoveStart\','+
'onStop:\'panelMoveStop\''+
'}" ng-model="row.panels" ' +
'>' +
'{{panel.title}}' +
'</span>' +
'</span>'+ '</span>'+
'</span>' +
'<span ng-if="panelMeta.menuItems" class="dropdown" ng-show="panel.title">' + '<span ng-if="!panelMeta.menuItems" config-modal class="panel-text panel-title pointer" ng-show="panel.title">' +
'<span class="panel-text panel-title pointer" bs-dropdown="panelMeta.menuItems" tabindex="1" ' +
'data-drag=true data-jqyoui-options="{revert: \'invalid\',helper:\'clone\'}"'+
' jqyoui-draggable="'+
'{'+
'animate:false,'+
'mutate:false,'+
'index:{{$index}},'+
'onStart:\'panelMoveStart\','+
'onStop:\'panelMoveStop\''+
'}" ng-model="row.panels" ' +
'>' +
'{{panel.title}}' + '{{panel.title}}' +
'</span>' + '</span>'+
'</span>'+
'<span ng-if="!panelMeta.menuItems" config-modal class="panel-text panel-title pointer" ng-show="panel.title">' + '</div>'+
'{{panel.title}}' + '</div>\n'+
'</span>'+ '</div>';
'</div></div>';
return { return {
restrict: 'E', restrict: 'E',
link: function($scope, elem, attr) { link: function($scope, elem, attr) {
...@@ -77,7 +90,9 @@ function (angular) { ...@@ -77,7 +90,9 @@ function (angular) {
$controllers = $controllers.add($module.find('ngcontroller, [ng-controller], .ng-controller')); $controllers = $controllers.add($module.find('ngcontroller, [ng-controller], .ng-controller'));
if ($controllers.length) { if ($controllers.length) {
$controllers.first().prepend(editorTemplate); $controllers.first().prepend(panelHeader);
$controllers.first().find('.panel-header').nextAll().wrapAll(content);
$scope.require([ $scope.require([
'panels/'+nameAsPath+'/module' 'panels/'+nameAsPath+'/module'
], function() { ], function() {
......
...@@ -47,14 +47,6 @@ ...@@ -47,14 +47,6 @@
<!-- Panels --> <!-- Panels -->
<div ng-repeat="(name, panel) in row.panels|filter:isPanel" ng-hide="panel.span == 0 || panel.hide" class="span{{panel.span}} panel nospace" style="min-height:{{row.height}}; position:relative" data-drop="true" ng-model="row.panels" data-jqyoui-options jqyoui-droppable="{index:$index,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver(true)',onOut:'panelMoveOut'}"> <div ng-repeat="(name, panel) in row.panels|filter:isPanel" ng-hide="panel.span == 0 || panel.hide" class="span{{panel.span}} panel nospace" style="min-height:{{row.height}}; position:relative" data-drop="true" ng-model="row.panels" data-jqyoui-options jqyoui-droppable="{index:$index,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver(true)',onOut:'panelMoveOut'}">
<!-- Error Panel -->
<div class="row-fluid">
<div class="span12 alert-error panel-error" ng-hide="!panel.error">
<a class="close" ng-click="panel.error=false">&times;</a>
<i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}}
</div>
</div>
<!-- Content Panel --> <!-- Content Panel -->
<div class="row-fluid" style="position:relative" ng-class="{'dragInProgress':dashboard.panelDragging}" > <div class="row-fluid" style="position:relative" ng-class="{'dragInProgress':dashboard.panelDragging}" >
<kibana-panel type="panel.type" ng-cloak></kibana-panel> <kibana-panel type="panel.type" ng-cloak></kibana-panel>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,12 +51,19 @@ code, pre { ...@@ -51,12 +51,19 @@ code, pre {
background-color: @grayLighter; background-color: @grayLighter;
} }
.panelCont { .panel-container {
padding: 0px 10px 10px 10px; padding: 0px 0px 0px 0px;
background: @kibanaPanelBackground; background: @kibanaPanelBackground;
margin: 0px; margin: 0px;
//border: 1px solid rgba(100, 100, 100, 0.25); }
//outline: 1px solid darken(@bodyBackground, 10%);
.panel-content {
padding: 0px 10px 10px 10px;
}
.panel-title {
border: 0px;
font-weight: bold;
} }
div.editor-row { div.editor-row {
...@@ -231,12 +238,6 @@ form input.ng-invalid { ...@@ -231,12 +238,6 @@ form input.ng-invalid {
z-index: 9999; z-index: 9999;
} }
.panel-title {
border: 0px;
//text-transform: uppercase;
font-weight: bold;
}
.panel div.panel-extra div.panel-extra-container { .panel div.panel-extra div.panel-extra-container {
margin-right: -10px; margin-right: -10px;
margin-top: 3px; margin-top: 3px;
......
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