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

Fixes #251, text panel change is now updating panel correctly. Changed button text from Cancel to Close

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

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

@@ -318,7 +318,7 @@ function (angular, $, kbn, moment, _) {
           }
         });
 
-        function render_panel_as_graphite_png(url) {          
+        function render_panel_as_graphite_png(url) {
           url += '&width=' + elem.width();
           url += '&height=' + elem.css('height').replace('px', '');
           url += '&bgcolor=1f1f1f'; // @grayDarker & @kibanaPanelBackground

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

@@ -73,7 +73,7 @@ function (angular, $, _) {
             elem.removeClass("ng-cloak");
           }
 
-          newScope.$on('$destroy',function(){
+          newScope.$on('$destroy',function() {
             elem.unbind();
             elem.remove();
           });

+ 4 - 2
src/app/panels/text/editor.html

@@ -8,9 +8,11 @@
     </div>
   </div>
 
-  <label class=small>Content 
+  <label class=small>Content
     <span ng-show="panel.mode == 'html'">(This area uses HTML sanitized via AngularJS's <a href='http://docs.angularjs.org/api/ngSanitize.$sanitize'>$sanitize</a> service)</span>
     <span ng-show="panel.mode == 'markdown'">(This area uses <a target="_blank" href="http://en.wikipedia.org/wiki/Markdown">Markdown</a>. HTML is not supported)</span>
   </label>
-  <textarea ng-model="panel.content" rows="6" style="width:95%"></textarea>
+
+  <textarea ng-model="panel.content" rows="6" style="width:95%" ng-change="render()" ng-model-onblur>
+  </textarea>
 </div>

+ 1 - 1
src/app/panels/text/module.html

@@ -1,4 +1,4 @@
-<div ng-controller='text' ng-init="init()">
+<div ng-controller='text' ng-init="init()" style="min-height:{{panel.height || row.height}}">
   <!--<p ng-style="panel.style" ng-bind-html-unsafe="panel.content | striphtml | newlines"></p>-->
   <markdown ng-show="ready && panel.mode == 'markdown'">
     {{panel.content}}

+ 4 - 0
src/app/panels/text/module.js

@@ -48,6 +48,10 @@ function (angular, app, _, require) {
       $scope.ready = false;
     };
 
+    $scope.render = function() {
+      $scope.$emit('render');
+    };
+
   });
 
   module.directive('markdown', function() {

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

@@ -156,5 +156,5 @@
   </div>
 
   <button ng-click="add_row(dashboard.current,row); reset_row();" class="btn btn-success" ng-show="editor.index == 1">Create Row</button>
-  <button type="button" class="btn btn-danger" ng-click="editor.index=0;dismiss();reset_panel();dashboard.refresh()">Close</button>
+  <button type="button" class="btn btn-info" ng-click="editor.index=0;dismiss();reset_panel();dashboard.refresh()">Close</button>
 </div>

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

@@ -19,5 +19,5 @@
 
 <div class="modal-footer">
   <!-- close_edit() is provided here to allow for a scope to perform action on dismiss -->
-  <button type="button" class="btn btn-danger" ng-click="editor.index=0;dismiss()">Cancel</button>
+  <button type="button" class="btn btn-info" ng-click="editor.index=0;dismiss()">Close</button>
 </div>