Commit 7d6e04ac by Torkel Ödegaard

Small fixes to dasheditor and firefox fixes for search

parent 6502cff8
...@@ -28,7 +28,7 @@ function (angular, _, config, $) { ...@@ -28,7 +28,7 @@ function (angular, _, config, $) {
$scope.keyDown = function (evt) { $scope.keyDown = function (evt) {
if (evt.keyCode === 27) { if (evt.keyCode === 27) {
$element.find('.dropdown-toggle').dropdown('toggle'); $scope.emitAppEvent('hide-dash-editor');
} }
if (evt.keyCode === 40) { if (evt.keyCode === 40) {
$scope.selectedIndex++; $scope.selectedIndex++;
...@@ -134,13 +134,18 @@ function (angular, _, config, $) { ...@@ -134,13 +134,18 @@ function (angular, _, config, $) {
module.directive('xngFocus', function() { module.directive('xngFocus', function() {
return function(scope, element, attrs) { return function(scope, element, attrs) {
$(element).click(function(e) { element.click(function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
scope.$watch(attrs.xngFocus,function (newValue) { scope.$watch(attrs.xngFocus,function (newValue) {
if (!newValue) {
return;
}
setTimeout(function() { setTimeout(function() {
newValue && element.focus(); element.focus();
var pos = element.val().length * 2;
element[0].setSelectionRange(pos, pos);
}, 200); }, 200);
},true); },true);
}; };
......
...@@ -31,6 +31,16 @@ function (angular, $) { ...@@ -31,6 +31,16 @@ function (angular, $) {
var editorScope; var editorScope;
var lastEditor; var lastEditor;
function hideScrollbars(value) {
if (value) {
document.documentElement.style.overflow = 'hidden'; // firefox, chrome
document.body.scroll = "no"; // ie only
} else {
document.documentElement.style.overflow = 'auto';
document.body.scroll = "yes";
}
}
scope.onAppEvent('hide-dash-editor', function() { scope.onAppEvent('hide-dash-editor', function() {
if (editorScope) { if (editorScope) {
editorScope.dismiss(); editorScope.dismiss();
...@@ -56,8 +66,12 @@ function (angular, $) { ...@@ -56,8 +66,12 @@ function (angular, $) {
elem.empty(); elem.empty();
lastEditor = null; lastEditor = null;
editorScope = null; editorScope = null;
hideScrollbars(false);
}; };
// hide page scrollbars while edit pane is visible
hideScrollbars(true);
var src = "'" + payload.src + "'"; var src = "'" + payload.src + "'";
var view = $('<div class="dashboard-edit-view" ng-include="' + src + '"></div>'); var view = $('<div class="dashboard-edit-view" ng-include="' + src + '"></div>');
elem.append(view); elem.append(view);
......
...@@ -11,7 +11,7 @@ function (angular) { ...@@ -11,7 +11,7 @@ function (angular) {
restrict: 'A', restrict: 'A',
link: function(scope, elem) { link: function(scope, elem) {
if (grafanaVersion[0] === '@') { if (grafanaVersion[0] === '@') {
return; // return;
} }
$http({ method: 'GET', url: 'https://grafanarel.s3.amazonaws.com/latest.json' }) $http({ method: 'GET', url: 'https://grafanarel.s3.amazonaws.com/latest.json' })
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;"> <div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
<div ng-repeat="tab in ['General', 'Rows', 'Controls', 'Import']" data-title="{{tab}}"> <div ng-repeat="tab in ['General', 'Rows', 'Features', 'Import']" data-title="{{tab}}">
</div> </div>
<div ng-repeat="tab in dashboard.nav" data-title="{{tab.type}}"> <div ng-repeat="tab in dashboard.nav" data-title="{{tab.type}}">
</div> </div>
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
</bootstrap-tagsinput> </bootstrap-tagsinput>
<tip>Press enter to a add tag</tip> <tip>Press enter to a add tag</tip>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -91,13 +92,12 @@ ...@@ -91,13 +92,12 @@
</div> </div>
<div class="dashboard-editor-footer"> <div class="dashboard-editor-footer">
<div class="pull-left" ng-if="editor.index == 0"> <div class="grafana-version-info" ng-show="editor.index === 0">
<span class="editor-option small" style="line-height: 20px;"> <span class="editor-option small">
Grafana version: {{grafanaVersion}} Grafana version: {{grafanaVersion}} &nbsp;&nbsp;
</span>
<span grafana-version-check>
</span> </span>
<span> | <a ng-click="toggleConsole()" ng-show="!consoleEnabled">enable console</a> <a ng-click="toggleConsole()" ng-show="consoleEnabled">disable console</a></span>
<div class="small" grafana-version-check>
</div>
</div> </div>
<button type="button" class="btn btn-success pull-right" ng-click="editor.index=0;dismiss();reset_panel();dashboard.emit_refresh()">Close</button> <button type="button" class="btn btn-success pull-right" ng-click="editor.index=0;dismiss();reset_panel();dashboard.emit_refresh()">Close</button>
......
...@@ -32,10 +32,6 @@ ...@@ -32,10 +32,6 @@
} }
} }
body {
overflow-y: hidden;
}
// Search // Search
.grafana-search-panel { .grafana-search-panel {
.search-field-wrapper { .search-field-wrapper {
...@@ -518,6 +514,7 @@ select.grafana-target-segment-input { ...@@ -518,6 +514,7 @@ select.grafana-target-segment-input {
.dashboard-edit-view { .dashboard-edit-view {
padding: 20px; padding: 20px;
background-color: @grafanaPanelBackground; background-color: @grafanaPanelBackground;
position: relative;
} }
.dashboard-editor-body { .dashboard-editor-body {
...@@ -554,3 +551,11 @@ select.grafana-target-segment-input { ...@@ -554,3 +551,11 @@ select.grafana-target-segment-input {
} }
} }
.grafana-version-info {
position: absolute;
bottom: 2px;
left: 3px;
font-size: 80%;
color: darken(@gray, 25%);
a { color: darken(@gray, 25%); }
}
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