Commit 3157fc65 by Torkel Ödegaard

Fixed dashboard import view, did not hide search results

parent dd4f27e3
...@@ -42,26 +42,23 @@ function (angular, $) { ...@@ -42,26 +42,23 @@ function (angular, $) {
} }
} }
scope.onAppEvent('hide-dash-editor', function() { function hideEditorPane() {
if (editorScope) { if (editorScope) { editorScope.dismiss(); }
editorScope.dismiss(); }
}
}); scope.onAppEvent("dashboard-loaded", hideEditorPane);
scope.onAppEvent('hide-dash-editor', hideEditorPane);
scope.onAppEvent('show-dash-editor', function(evt, payload) { scope.onAppEvent('show-dash-editor', function(evt, payload) {
if (lastEditor === payload.src) { hideEditorPane();
editorScope.dismiss();
return;
}
if (editorScope) { if (lastEditor === payload.src) { return; }
editorScope.dismiss();
}
scope.exitFullscreen(); scope.exitFullscreen();
lastEditor = payload.src; lastEditor = payload.src;
editorScope = payload.scope ? payload.scope.$new() : scope.$new(); editorScope = payload.scope ? payload.scope.$new() : scope.$new();
editorScope.dismiss = function() { editorScope.dismiss = function() {
editorScope.$destroy(); editorScope.$destroy();
elem.empty(); elem.empty();
......
...@@ -15,8 +15,9 @@ function (angular) { ...@@ -15,8 +15,9 @@ function (angular) {
var readerOnload = function() { var readerOnload = function() {
return function(e) { return function(e) {
var dashboard = JSON.parse(e.target.result); var dashboard = JSON.parse(e.target.result);
scope.emitAppEvent('setup-dashboard', dashboard); scope.$apply(function() {
scope.$apply(); scope.emitAppEvent('setup-dashboard', dashboard);
});
}; };
}; };
for (var i = 0, f; f = files[i]; i++) { for (var i = 0, f; f = files[i]; i++) {
......
<style> <div ng-controller="SearchCtrl" ng-init="init()">
#grafana-search {
position: fixed; <div class="dashboard-editor-header">
right: 0; <div class="dashboard-editor-title" style="border: 0; line-height: 41px;">
left: 0; <i class="icon icon-search"></i>
top: 39px; Search
margin-right: auto; </div>
margin-left: auto;
/* give it dimensions */ <div class="grafana-search-panel">
min-height: 10em; <div class="search-field-wrapper">
width: 90%; <button class="btn btn-success pull-right" dash-editor-link="app/partials/playlist.html" editor-scope="isolated">
} <i class="icon-play"></i>
</style> Playlist
<div ng-controller="SearchCtrl" ng-init="init()"> </button>
<div class="dashboard-editor-header"> <button class="btn btn-success pull-right" ng-click="toggleImport($event)">
<div class="dashboard-editor-title" style="border: 0; line-height: 41px;"> <i class="icon-download-alt"></i>
<i class="icon icon-search"></i> Import
Search </button>
<button class="btn btn-success pull-right" ng-click="newDashboard()">
<i class="icon-th-large"></i>
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>
</span>
</div> </div>
</div>
</div>
<div class="grafana-search-panel"> <div ng-if="!showImport">
<div class="search-field-wrapper"> <h6 ng-hide="results.dashboards.length">No dashboards matching your query were found.</h6>
<button class="btn btn-success pull-right" dash-editor-link="app/partials/playlist.html" editor-scope="isolated"> <div class="search-results-container" ng-if="tagsOnly">
<i class="icon-play"></i> <div ng-repeat="tag in results.tags" class="pointer" style="width: 180px; float: left;"
Playlist ng-class="{'selected': $index === selectedIndex }"
</button> ng-click="filterByTag(tag.term, $event)">
<button class="btn btn-success pull-right" ng-click="toggleImport($event)"> <a class="search-result-tag label label-tag" tag-color-from-name>
<i class="icon-download-alt"></i> <i class="icon icon-tag"></i>
Import <span>{{tag.term}} &nbsp;({{tag.count}})</span>
</button> </a>
<button class="btn btn-success pull-right" ng-click="newDashboard()">
<i class="icon-th-large"></i>
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>
</span>
</div>
</div> </div>
</div>
<h6 ng-hide="results.dashboards.length">No dashboards matching your query were found.</h6> <div class="search-results-container" ng-if="!tagsOnly">
<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-results-container" ng-if="tagsOnly"> <div class="search-result-actions small">
<div ng-repeat="tag in results.tags" class="pointer" style="width: 180px; float: left;" <a ng-click="shareDashboard(row.id, row.id, $event)" config-modal="app/partials/dashLoaderShare.html">
ng-class="{'selected': $index === selectedIndex }" <i class="icon-share"></i> share &nbsp;&nbsp;&nbsp;
ng-click="filterByTag(tag.term, $event)"> </a>
<a class="search-result-tag label label-tag" tag-color-from-name> <a ng-click="deleteDashboard(row.id, $event)">
<i class="icon icon-tag"></i> <i class="icon-remove"></i> delete
<span>{{tag.term}} &nbsp;({{tag.count}})</span> </a>
</a>
</div>
</div> </div>
<div class="search-results-container" ng-if="!tagsOnly"> <div class="search-result-tags">
<div class="search-result-item pointer" <a ng-click="filterByTag(tag, $event)" ng-repeat="tag in row.tags" tag-color-from-name class="label label-tag">
bindonce ng-repeat="row in results.dashboards" {{tag}}
ng-class="{'selected': $index === selectedIndex }" ng-click="goToDashboard(row.id)"> </a>
<div class="search-result-actions small">
<a ng-click="shareDashboard(row.id, row.id, $event)" config-modal="app/partials/dashLoaderShare.html">
<i class="icon-share"></i> share &nbsp;&nbsp;&nbsp;
</a>
<a ng-click="deleteDashboard(row.id, $event)">
<i class="icon-remove"></i> delete
</a>
</div>
<div class="search-result-tags">
<a ng-click="filterByTag(tag, $event)" ng-repeat="tag in row.tags" tag-color-from-name class="label label-tag">
{{tag}}
</a>
</div>
<a class="search-result-link">
<i class="icon icon-th-large"></i>
<span bo-text="row.title"></span>
</a>
</div>
</div> </div>
</div> <a class="search-result-link">
</li> <i class="icon icon-th-large"></i>
<span bo-text="row.title"></span>
</a>
<li ng-if="showImport" style="margin: 20px;"> </div>
<div class="editor-row">
<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>
</form>
</div>
</div>
</div>
</li>
</div> </div>
</div>
<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>
</form>
</div>
</div>
</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