Skip to content

Commit

Permalink
Add load dialog to discover, Re: #31
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed Apr 21, 2014
1 parent fae20ba commit 301faba
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/kibana/apps/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ define(function (require) {
var moment = require('moment');
var settingsHtml = require('text!../partials/settings.html');
var saveHtml = require('text!../partials/save_search.html');
var loadHtml = require('text!../partials/load_search.html');

var interval = require('utils/interval');
var datemath = require('utils/datemath');

Expand Down Expand Up @@ -58,6 +60,8 @@ define(function (require) {
index: config.get('defaultIndex'),
};

console.log(stateDefaults);

var $state = $scope.state = new SyncedState(stateDefaults);

// Check that we have any index patterns before going further, and that index being requested
Expand Down Expand Up @@ -200,6 +204,15 @@ define(function (require) {
}
};

$scope.toggleLoad = function () {
// Close if already open
if ($scope.configTemplate === loadHtml) {
delete $scope.configTemplate;
} else {
$scope.configTemplate = loadHtml;
}
};

$scope.resetQuery = function () {
$state.query = stateDefaults.query;
$state.sort = stateDefaults.sort;
Expand Down
2 changes: 2 additions & 0 deletions src/kibana/apps/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<ul class="nav navbar-nav navbar-right">
<li><a class="navbar-link" ng-click="resetQuery()"><i class="fa fa-ban"></i></a></li>
<li><a class="navbar-link" ng-click="toggleSave()"><i class="fa fa-save"></i></a></li>
<li><a class="navbar-link" ng-click="toggleLoad()"><i class="fa fa-folder"></i></a></li>

<li><a class="navbar-link" ng-click="toggleConfig()"><i class="fa fa-gear"></i></a></li>
</ul>
<form class="navbar-form" ng-submit="fetch()">
Expand Down
1 change: 1 addition & 0 deletions src/kibana/apps/discover/partials/load_search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<saved-object-finder title="Load" type="searches"></saved-object-finder>
21 changes: 16 additions & 5 deletions src/kibana/apps/discover/saved_searches/saved_searches.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,22 @@ define(function (require) {
type: 'search',
body: {
query: {
multi_match: {
query: searchString || '',
type: 'phrase_prefix',
fields: ['title^3', 'description'],
zero_terms_query: 'all'
bool: {
should : [
{
wildcard: {
title: {
value: searchString + '*',
boost: 3
}
}
},
{
wildcard: {
description: searchString + '*'
}
},
],
}
}
}
Expand Down

0 comments on commit 301faba

Please sign in to comment.