mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(row editor): row editor fix and cleanup of unused code
This commit is contained in:
parent
edf5868c38
commit
660ce3a61d
@ -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";
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user