Преглед на файлове

Removed add-panel tab from row editor, only add panels from the row menu now, do not want to ways to do the same thing

Torkel Ödegaard преди 11 години
родител
ревизия
2f3a96f7a7

+ 1 - 1
src/app/controllers/grafanaCtrl.js

@@ -80,7 +80,7 @@ function (angular, config, _, $) {
       var count = 0;
       console.log("registering digest counter");
 
-      $scope.$watch(function() {
+      $scope.$watch(function digestCounter() {
         console.log(1);
         count++;
       }, function() {

+ 0 - 35
src/app/directives/addPanel.js

@@ -1,35 +0,0 @@
-define([
-  'angular',
-  'app',
-  'lodash'
-],
-function (angular, app, _) {
-  'use strict';
-
-  angular
-    .module('grafana.directives')
-    .directive('addPanel', function($compile) {
-      return {
-        restrict: 'A',
-        link: function($scope, elem) {
-
-          $scope.$on("$destroy",function() {
-            elem.remove();
-          });
-
-          $scope.$watch('panel.type', function() {
-            var _type = $scope.panel.type;
-            $scope.reset_panel(_type);
-            if(!_.isUndefined($scope.panel.type)) {
-              $scope.panel.loadingEditor = true;
-              $scope.require(['panels/'+$scope.panel.type.replace(".","/") +'/module'], function () {
-                var template = '<div ng-controller="'+$scope.panel.type+'" ng-include="\'app/partials/paneladd.html\'"></div>';
-                elem.html($compile(angular.element(template))($scope));
-                $scope.panel.loadingEditor = false;
-              });
-            }
-          });
-        }
-      };
-    });
-});

+ 1 - 2
src/app/directives/all.js

@@ -1,5 +1,4 @@
 define([
-  './addPanel',
   './arrayJoin',
   './dashUpload',
   './grafanaPanel',
@@ -17,4 +16,4 @@ define([
   './graphiteFuncEditor',
   './grafanaVersionCheck',
   './influxdbFuncEditor'
-], function () {});
+], function () {});

+ 1 - 1
src/app/directives/grafanaPanel.js

@@ -38,7 +38,7 @@ function (angular, $) {
                 'index:{{$index}},'+
                 'onStart:\'panelMoveStart\','+
                 'onStop:\'panelMoveStop\''+
-                '}"  ng-model="row.panels" ' +
+                '}"  ng-model="panel" ' +
                 '>' +
                 '{{panel.title || "No title"}}' +
               '</span>' +

+ 10 - 5
src/app/partials/dashboard.html

@@ -98,11 +98,16 @@
 							</div>
 
               <!-- Panels -->
-              <div ng-repeat="(name, panel) in row.panels" 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>
-                </div>
+							<div ng-repeat="(name, panel) in row.panels"
+									 class="panel nospace"
+									 style="position:relative"
+									 ng-style="{'width':(panel.span/1.2)*10+'%'}"
+									 data-drop="true"
+									 ng-model="panel"
+									 data-jqyoui-options
+									 jqyoui-droppable="{index:$index,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver(true)',onOut:'panelMoveOut'}"
+									 ng-class="{'dragInProgress':dashboard.$$panelDragging}">
+                <grafana-panel type="panel.type" ng-cloak></grafana-panel>
               </div>
 
               <div ng-show="dashboard.rowSpan(row) < 10 && dashboard.$$panelDragging" class="panel" style="margin:5px;width:30%;background:rgba(100,100,100,0.50)" ng-class="{'dragInProgress':dashboard.panelDragging}" ng-style="{height:row.height}" data-drop="true" ng-model="row.panels" data-jqyoui-options jqyoui-droppable="{index:row.panels.length,mutate:false,onDrop:'panelMoveDrop',onOver:'panelMoveOver',onOut:'panelMoveOut'}">

+ 1 - 14
src/app/partials/roweditor.html

@@ -2,7 +2,7 @@
   <div class="pull-right editor-title">Row settings</div>
 
   <div ng-model="editor.index" bs-tabs>
-    <div ng-repeat="tab in ['General','Panels','Add Panel']" data-title="{{tab}}">
+    <div ng-repeat="tab in ['General','Panels']" data-title="{{tab}}">
     </div>
   </div>
 
@@ -43,19 +43,6 @@
       </table>
     </div>
   </div>
-  <div class="row-fluid" ng-if="editor.index == 2">
-    <h4>Select Panel Type</h4>
-    <form class="form-inline">
-      <select class="input-medium" ng-model="panel.type" ng-options="panelType for panelType in availablePanels|stringSort"></select>
-      <small ng-show="dashboard.rowSpan(row) > 11">
-        Note: This row is full, new panels will wrap to a new line. You should add another row.
-      </small>
-    </form>
-
-    <div ng-show="!(_.isUndefined(panel.type))">
-      <div add-panel="{{panel.type}}"></div>
-    </div>
-  </div>
 </div>
 <div class="modal-footer">
   <button ng-show="editor.index == 1" ng-click="editor.index = 2;" class="btn btn-success" ng-disabled="panel.loadingEditor">Add Panel</button>

+ 1 - 1
src/index.html

@@ -27,7 +27,7 @@
       <strong>{{alert.title}}</strong> <span ng-bind-html='alert.text'></span> <div style="padding-right:10px" class='pull-right small'> {{$index + 1}} alert(s) </div>
     </div>
 
-    <div ng-view ></div>
+    <div ng-view></div>
 
   </body>
 </html>