Skip to content

Commit 046da50

Browse files
committed
Fix program search, add clear button
1 parent 1896b6a commit 046da50

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logtrail",
3-
"version": "0.1.4-anduin",
3+
"version": "0.1.4-anduin-1",
44
"description": "Plugin to view, search & tail logs in Kibana",
55
"main": "gulpfile.js",
66
"scripts": {

public/app.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams, es, c
306306
}
307307
};
308308

309+
$scope.clearSearch = function() {
310+
$scope.userSearchText = null;
311+
searchText = '*';
312+
$scope.selectedHost = null;
313+
var host = 'All';
314+
$scope.userDateTimeSeeked = null;
315+
var time = 'Now';
316+
$location.path('/').search({q: searchText, h: host, t:time});
317+
$scope.pickedDateTime = null;
318+
doSearch(null,'desc', ['overwrite','reverse'],null);
319+
}
320+
309321
$scope.showDatePicker = function () {
310322
$scope.datePickerVisible = true;
311323
if ($scope.pickedDateTime == null) {
@@ -383,7 +395,7 @@ app.controller('logtrail', function ($scope, kbnUrl, $route, $routeParams, es, c
383395
};
384396

385397
$scope.onProgramClick = function (program) {
386-
$scope.userSearchText = config.fields.mapping['program'] + ': \'' + program + '\'';
398+
$scope.userSearchText = config.fields.mapping['program'] + ': "' + program + '"';
387399
$scope.onSearchClick();
388400
};
389401

public/css/main.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ html,body {
4242
color: black;
4343
}
4444

45-
.time-option-select-btn {
45+
.time-option-select-btn,
46+
.clear-search-btn {
4647
padding: .6em;
4748
margin-left: .3em;
4849
font-weight: bold;

public/templates/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<input type="text" ng-model="userSearchText" class="search-box form-control flex-item-search"
2323
placeholder='Example: "access denied" 1.2.3.4 -sshd'></input>
2424
<button class="submit btn search-btn flex-item-search" >Search</button>
25+
<button type="button" id="clearSearchBtn" class="btn clear-search-btn flex-item-search"
26+
ng-click="clearSearch()">Clear</button>
2527
<button type="button" id="showHostPickerBtn" class="btn host-option-select-btn flex-item-search"
2628
ng-click="showHostPicker()">{{selectedHost == null ? 'All Systems' : selectedHost}}</button>
2729
<button type="button" id="showDatePickerBtn" class="time-option-select-btn btn flex-item-search"

0 commit comments

Comments
 (0)