Skip to content

Commit

Permalink
Fix program search, add clear button
Browse files Browse the repository at this point in the history
  • Loading branch information
keimoon committed Oct 25, 2016
1 parent 1896b6a commit 046da50
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logtrail",
"version": "0.1.4-anduin",
"version": "0.1.4-anduin-1",
"description": "Plugin to view, search & tail logs in Kibana",
"main": "gulpfile.js",
"scripts": {
Expand Down
14 changes: 13 additions & 1 deletion public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams, es, c
}
};

$scope.clearSearch = function() {
$scope.userSearchText = null;
searchText = '*';
$scope.selectedHost = null;
var host = 'All';
$scope.userDateTimeSeeked = null;
var time = 'Now';
$location.path('/').search({q: searchText, h: host, t:time});
$scope.pickedDateTime = null;
doSearch(null,'desc', ['overwrite','reverse'],null);
}

$scope.showDatePicker = function () {
$scope.datePickerVisible = true;
if ($scope.pickedDateTime == null) {
Expand Down Expand Up @@ -383,7 +395,7 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams, es, c
};

$scope.onProgramClick = function (program) {
$scope.userSearchText = config.fields.mapping['program'] + ': \'' + program + '\'';
$scope.userSearchText = config.fields.mapping['program'] + ': "' + program + '"';
$scope.onSearchClick();
};

Expand Down
3 changes: 2 additions & 1 deletion public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ html,body {
color: black;
}

.time-option-select-btn {
.time-option-select-btn,
.clear-search-btn {
padding: .6em;
margin-left: .3em;
font-weight: bold;
Expand Down
2 changes: 2 additions & 0 deletions public/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<input type="text" ng-model="userSearchText" class="search-box form-control flex-item-search"
placeholder='Example: "access denied" 1.2.3.4 -sshd'></input>
<button class="submit btn search-btn flex-item-search" >Search</button>
<button type="button" id="clearSearchBtn" class="btn clear-search-btn flex-item-search"
ng-click="clearSearch()">Clear</button>
<button type="button" id="showHostPickerBtn" class="btn host-option-select-btn flex-item-search"
ng-click="showHostPicker()">{{selectedHost == null ? 'All Systems' : selectedHost}}</button>
<button type="button" id="showDatePickerBtn" class="time-option-select-btn btn flex-item-search"
Expand Down

0 comments on commit 046da50

Please sign in to comment.