Pārlūkot izejas kodu

fix(row editor): row editor fix and cleanup of unused code

Torkel Ödegaard 10 gadi atpakaļ
vecāks
revīzija
660ce3a61d

+ 0 - 1
public/app/core/core.ts

@@ -3,7 +3,6 @@
 
 import "./directives/annotation_tooltip";
 import "./directives/body_class";
-import "./directives/config_modal";
 import "./directives/confirm_click";
 import "./directives/dash_edit_link";
 import "./directives/dash_upload";

+ 0 - 46
public/app/core/directives/config_modal.js

@@ -1,46 +0,0 @@
-define([
-  'lodash',
-  'jquery',
-  '../core_module',
-],
-function (_, $, coreModule) {
-  'use strict';
-
-  coreModule.default.directive('configModal', function($modal, $q, $timeout) {
-    return {
-      restrict: 'A',
-      link: function(scope, elem, attrs) {
-        var partial = attrs.configModal;
-        var id = '#' + partial.replace('.html', '').replace(/[\/|\.|:]/g, '-') + '-' + scope.$id;
-
-        elem.bind('click',function() {
-          if ($(id).length) {
-            elem.attr('data-target', id).attr('data-toggle', 'modal');
-            scope.$apply(function() { scope.$broadcast('modal-opened'); });
-            return;
-          }
-
-          var panelModal = $modal({
-            template: partial,
-            persist: false,
-            show: false,
-            scope: scope.$new(),
-            keyboard: false
-          });
-
-          $q.when(panelModal).then(function(modalEl) {
-            elem.attr('data-target', id).attr('data-toggle', 'modal');
-
-            $timeout(function () {
-              if (!modalEl.data('modal').isShown) {
-                modalEl.modal('show');
-              }
-            }, 50);
-          });
-
-          scope.$apply();
-        });
-      }
-    };
-  });
-});

+ 0 - 1
public/app/core/directives/misc.js

@@ -90,7 +90,6 @@ function (angular, coreModule, kbn) {
         var li = '<li' + (item.submenu && item.submenu.length ? ' class="dropdown-submenu"' : '') + '>' +
           '<a tabindex="-1" ng-href="' + (item.href || '') + '"' + (item.click ? ' ng-click="' + item.click + '"' : '') +
           (item.target ? ' target="' + item.target + '"' : '') + (item.method ? ' data-method="' + item.method + '"' : '') +
-          (item.configModal ? ' dash-editor-link="' + item.configModal + '"' : "") +
           '>' + (item.text || '') + '</a>';
 
         if (item.submenu && item.submenu.length) {

+ 7 - 0
public/app/features/dashboard/rowCtrl.js

@@ -61,6 +61,13 @@ function (angular, _, config) {
       });
     };
 
+    $scope.editRow = function() {
+      $scope.appEvent('show-dash-editor', {
+        src: 'public/app/partials/roweditor.html',
+        scope: $scope.$new()
+      });
+    };
+
     $scope.moveRow = function(direction) {
       var rowsList = $scope.dashboard.rows;
       var rowIndex = _.indexOf(rowsList, $scope.row);

+ 0 - 1
public/app/features/panel/panel_menu.js

@@ -53,7 +53,6 @@ function (angular, $, _) {
 
           template += '<a class="panel-menu-link" ';
           if (item.click) { template += ' ng-click="' + item.click + '"'; }
-          if (item.editorLink) { template += ' dash-editor-link="' + item.editorLink + '"'; }
           template += '>';
           template += item.text + '</a>';
         });

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

@@ -65,7 +65,7 @@
 									</ul>
 								</li>
 								<li>
-									<a dash-editor-link="app/partials/roweditor.html">Row editor</a>
+									<a ng-click="editRow()">Row editor</a>
 								</li>
 								<li>
 									<a ng-click="deleteRow()">Delete row</a>

+ 1 - 1
public/app/plugins/datasource/influxdb/partials/query.editor.html

@@ -17,7 +17,7 @@
 			</li>
 		</ul>
 
-		<div class="tight-form-flex-wrapper" ng-show="target.rawQuery">
+		<div class="tight-form-flex-wrapper" ng-show="ctrl.target.rawQuery">
 			<input type="text" class="tight-form-clear-input" ng-model="ctrl.target.query" spellcheck="false" style="width: 100%;" ng-blur="ctrl.refresh()"></input>
 		</div>
 </query-editor-row>

+ 1 - 1
public/app/plugins/datasource/influxdb/query_ctrl.ts

@@ -153,7 +153,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
     this.panelCtrl.refresh();
   }
 
-  toggleQueryMode() {
+  toggleEditorMode() {
     this.target.rawQuery = !this.target.rawQuery;
   }