Commit 3157fc65 by Torkel Ödegaard

Fixed dashboard import view, did not hide search results

parent dd4f27e3
......@@ -42,26 +42,23 @@ function (angular, $) {
}
}
scope.onAppEvent('hide-dash-editor', function() {
if (editorScope) {
editorScope.dismiss();
function hideEditorPane() {
if (editorScope) { editorScope.dismiss(); }
}
});
scope.onAppEvent("dashboard-loaded", hideEditorPane);
scope.onAppEvent('hide-dash-editor', hideEditorPane);
scope.onAppEvent('show-dash-editor', function(evt, payload) {
if (lastEditor === payload.src) {
editorScope.dismiss();
return;
}
hideEditorPane();
if (editorScope) {
editorScope.dismiss();
}
if (lastEditor === payload.src) { return; }
scope.exitFullscreen();
lastEditor = payload.src;
editorScope = payload.scope ? payload.scope.$new() : scope.$new();
editorScope.dismiss = function() {
editorScope.$destroy();
elem.empty();
......
......@@ -15,8 +15,9 @@ function (angular) {
var readerOnload = function() {
return function(e) {
var dashboard = JSON.parse(e.target.result);
scope.$apply(function() {
scope.emitAppEvent('setup-dashboard', dashboard);
scope.$apply();
});
};
};
for (var i = 0, f; f = files[i]; i++) {
......
<style>
#grafana-search {
position: fixed;
right: 0;
left: 0;
top: 39px;
margin-right: auto;
margin-left: auto;
/* give it dimensions */
min-height: 10em;
width: 90%;
}
</style>
<div ng-controller="SearchCtrl" ng-init="init()">
<div ng-controller="SearchCtrl" ng-init="init()">
<div class="dashboard-editor-header">
<div class="dashboard-editor-title" style="border: 0; line-height: 41px;">
<i class="icon icon-search"></i>
......@@ -33,21 +21,16 @@
New
</button>
<span style="position: relative;">
<input type="text"
placeholder="search dashboards, metrics, or graphs"
xng-focus="giveSearchFocus"
ng-keydown="keyDown($event)"
ng-model="query.query" spellcheck='false'
ng-change="search()" />
<a class="search-tagview-switch" href="javascript:void(0);"
ng-class="{'active': tagsOnly}"
ng-click="showTags($event)">tags</a>
<input type="text" placeholder="search dashboards, metrics, or graphs" xng-focus="giveSearchFocus"
ng-keydown="keyDown($event)" ng-model="query.query" spellcheck='false' ng-change="search()" />
<a class="search-tagview-switch" href="javascript:void(0);" ng-class="{'active': tagsOnly}" ng-click="showTags($event)">tags</a>
</span>
</div>
</div>
</div>
<div ng-if="!showImport">
<h6 ng-hide="results.dashboards.length">No dashboards matching your query were found.</h6>
<div class="search-results-container" ng-if="tagsOnly">
<div ng-repeat="tag in results.tags" class="pointer" style="width: 180px; float: left;"
ng-class="{'selected': $index === selectedIndex }"
......@@ -60,8 +43,7 @@
</div>
<div class="search-results-container" ng-if="!tagsOnly">
<div class="search-result-item pointer"
bindonce ng-repeat="row in results.dashboards"
<div class="search-result-item pointer" bindonce ng-repeat="row in results.dashboards"
ng-class="{'selected': $index === selectedIndex }" ng-click="goToDashboard(row.id)">
<div class="search-result-actions small">
......@@ -86,20 +68,17 @@
</div>
</div>
</div>
</li>
<li ng-if="showImport" style="margin: 20px;">
<div class="editor-row">
<div class="editor-row" ng-if="showImport">
<div class="section">
<div class="editor-option">
<h5>Local File <tip>Load dashboard JSON layout from file</tip></h5>
<form>
<input type="file" id="dashupload" dash-upload /><br>
<input type="file" id="dashupload" dash-upload/><br>
</form>
</div>
</div>
</div>
</li>
</div>
</div>
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