Commit 660ce3a6 by Torkel Ödegaard

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

parent edf5868c
......@@ -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";
......
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();
});
}
};
});
});
......@@ -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) {
......
......@@ -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);
......
......@@ -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>';
});
......
......@@ -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>
......
......@@ -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>
......
......@@ -153,7 +153,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
this.panelCtrl.refresh();
}
toggleQueryMode() {
toggleEditorMode() {
this.target.rawQuery = !this.target.rawQuery;
}
......
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