More work on removing modals
This commit is contained in:
@@ -63,7 +63,7 @@ function (angular, app, _) {
|
||||
});
|
||||
|
||||
module.controller('EditViewCtrl', function($scope) {
|
||||
$scope.editPanelSrc = 'app/partials/dasheditor.html';
|
||||
$scope.editPanelSrc = null;
|
||||
|
||||
$scope.onAppEvent('show-edit-panel', function(evt, payload) {
|
||||
if (payload.src === $scope.editPanelSrc) {
|
||||
|
||||
@@ -23,7 +23,6 @@ function (angular, _, moment, config, store) {
|
||||
$scope.onAppEvent('zoom-out', function() {
|
||||
$scope.zoom(2);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$scope.set_default = function() {
|
||||
|
||||
@@ -4,6 +4,7 @@ define([
|
||||
'./grafanaPanel',
|
||||
'./grafanaSimplePanel',
|
||||
'./ngBlur',
|
||||
'./dashEditLink',
|
||||
'./ngModelOnBlur',
|
||||
'./tip',
|
||||
'./confirmClick',
|
||||
|
||||
@@ -16,12 +16,6 @@ function (angular, _, $) {
|
||||
var id = '#' + partial.replace('.html', '').replace(/[\/|\.|:]/g, '-') + '-' + scope.$id;
|
||||
|
||||
elem.bind('click',function() {
|
||||
$timeout(function() {
|
||||
scope.exitFullscreen();
|
||||
scope.emitAppEvent('show-edit-panel', {src: partial});
|
||||
});
|
||||
//return;
|
||||
|
||||
if ($(id).length) {
|
||||
elem.attr('data-target', id).attr('data-toggle', 'modal');
|
||||
scope.$apply(function() { scope.$broadcast('modal-opened'); });
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
define([
|
||||
'angular',
|
||||
'jquery'
|
||||
],
|
||||
function (angular, $) {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('grafana.directives')
|
||||
.directive('dashEditorLink', function($timeout) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, elem, attrs) {
|
||||
var partial = attrs.dashEditorLink;
|
||||
|
||||
elem.bind('click',function() {
|
||||
$timeout(function() {
|
||||
scope.exitFullscreen();
|
||||
scope.emitAppEvent('show-dash-editor', { src: partial, scope: scope });
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
angular
|
||||
.module('grafana.directives')
|
||||
.directive('dashEditorView', function($compile) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, elem) {
|
||||
var editorScope;
|
||||
var lastEditor;
|
||||
|
||||
|
||||
scope.onAppEvent('show-dash-editor', function(evt, payload) {
|
||||
if (lastEditor === payload.src) {
|
||||
editorScope.dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
lastEditor = payload.src;
|
||||
editorScope = payload.scope.$new();
|
||||
editorScope.dismiss = function() {
|
||||
editorScope.$destroy();
|
||||
elem.empty();
|
||||
lastEditor = null;
|
||||
};
|
||||
|
||||
var src = "'" + payload.src + "'";
|
||||
var view = $('<div class="dashboard-edit-view" ng-include="' + src + '"></div>');
|
||||
elem.append(view);
|
||||
$compile(elem.contents())(editorScope);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div ng-controller="EditViewCtrl">
|
||||
<div class="dashboard-edit-view" ng-if="editPanelSrc" ng-include="editPanelSrc">
|
||||
</div>
|
||||
<div dash-editor-view>
|
||||
</div>
|
||||
|
||||
<div class="main-view-container">
|
||||
@@ -19,7 +17,7 @@
|
||||
<div class="row-control-inner" style="padding:0px;margin:0px;position:relative;">
|
||||
<div class="row-close" ng-show="row.collapse" data-placement="bottom" >
|
||||
<div class="row-close-buttons">
|
||||
<span class="row-button bgWarning" config-modal="app/partials/roweditor.html" class="pointer">
|
||||
<span class="row-button bgWarning" dash-editor-link="app/partials/roweditor.html" class="pointer">
|
||||
<i bs-tooltip="'Configure row'" data-placement="right" ng-show="row.editable" class="icon-cog pointer"></i>
|
||||
</span>
|
||||
<span class="row-button bgPrimary" ng-click="toggle_row(row)">
|
||||
@@ -70,7 +68,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a config-modal="app/partials/roweditor.html">Row editor</a>
|
||||
<a dash-editor-link="app/partials/roweditor.html">Row editor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a ng-click="delete_row()">Delete row</a>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<li class="grafana-menu-home"><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/'><i class='icon-home'></i></a></li>
|
||||
|
||||
<li class="grafana-menu-edit" ng-show="dashboard.editable" bs-tooltip="'Configure dashboard'" data-placement="bottom"><a class="link" config-modal="app/partials/dasheditor.html"><i class='icon-cog pointer'></i></a></li>
|
||||
<li class="grafana-menu-edit" ng-show="dashboard.editable" bs-tooltip="'Configure dashboard'" data-placement="bottom"><a class="link" dash-editor-link="app/partials/dasheditor.html"><i class='icon-cog pointer'></i></a></li>
|
||||
|
||||
<li class="grafana-menu-stop-playlist hide">
|
||||
<a class='small' ng-click='stopPlaylist(2)'>
|
||||
|
||||
Reference in New Issue
Block a user