Просмотр исходного кода

Fixed issue span set to zero. Removed zero option from row editor. Closes #645

Torkel Ödegaard 11 лет назад
Родитель
Сommit
6e9723325f

+ 5 - 1
src/app/controllers/panelBaseCtrl.js

@@ -10,6 +10,10 @@ function (angular, _, $) {
   // when changing arguments to this function
   function PanelBaseCtrl($scope, $rootScope, $timeout) {
 
+    if (!$scope.panel.span) {
+      $scope.panel.span = 12;
+    }
+
     var menu = [
       {
         text: 'Edit',
@@ -131,4 +135,4 @@ function (angular, _, $) {
 
   return PanelBaseCtrl;
 
-});
+});

+ 1 - 1
src/app/partials/dashboard.html

@@ -93,7 +93,7 @@
             <div style="padding-top:0px" ng-if="!row.collapse">
 
               <!-- Panels -->
-              <div ng-repeat="(name, panel) in row.panels|filter:isPanel" ng-hide="panel.hide" class="panel nospace" ng-style="{'width':!panel.span?'100%':(panel.span/1.2)*10+'%'}" data-drop="true" ng-model="row.panels" data-jqyoui-options jqyoui-droppable="{index:$index,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver(true)',onOut:'panelMoveOut'}" ng-class="{'dragInProgress':dashboard.panelDragging}">
+              <div ng-repeat="(name, panel) in row.panels|filter:isPanel" ng-hide="panel.hide" class="panel nospace" ng-style="{'width':(panel.span/1.2)*10+'%'}" data-drop="true" ng-model="row.panels" data-jqyoui-options jqyoui-droppable="{index:$index,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver(true)',onOut:'panelMoveOut'}" ng-class="{'dragInProgress':dashboard.panelDragging}">
                 <!-- Content Panel -->
                 <div style="position:relative">
                   <grafana-panel type="panel.type" ng-cloak></grafana-panel>

+ 2 - 2
src/app/partials/roweditor.html

@@ -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="size for size 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 [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>
@@ -63,4 +63,4 @@
   <button ng-show="editor.index == 1" ng-click="editor.index = 2;" class="btn btn-success" ng-disabled="panel.loadingEditor">Add Panel</button>
   <button ng-show="panel.type && editor.index == 2" ng-click="add_panel(panel); reset_panel(); editor.index = 1;" class="btn btn-success" ng-disabled="panel.loadingEditor">Add Panel</button>
   <button type="button" class="btn btn-info" ng-click="editor.index=0;dismiss();reset_panel();close_edit()">Close</button>
-</div>
+</div>