Skip to content

Commit 9d4cee2

Browse files
authored
Merge pull request #225 from sivasamyk/issue/220
Issue/220
2 parents 66b442d + 479cd57 commit 9d4cee2

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

public/app.js

+4
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ uiModules.get('app/logtrail').directive('clickOutside', function ($document) {
545545
e.target.id === 'host-picker-btn' ||
546546
e.target.id === 'settings-btn') {
547547
scope.popup = angular.element('#' + e.target.id.replace('-btn','')).removeClass('ng-hide');
548+
var buttonCenter = e.target.getBoundingClientRect().x + (e.target.getBoundingClientRect().width/2);
549+
var popupWidth = scope.popup.width();
550+
scope.popup.css("left",buttonCenter - (popupWidth/2));
551+
scope.popup.css("min-width",popupWidth);
548552
}
549553
}
550554
});

public/css/main.css

+11-7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ html,body {
4040
margin-left: 1em;
4141
font-weight: bold;
4242
color: black;
43+
max-width: 20em;
44+
text-overflow: ellipsis;
45+
overflow: hidden;
46+
white-space: nowrap;
4347
}
4448

4549
.time-option-select-btn {
@@ -128,14 +132,14 @@ html,body {
128132
}
129133

130134
.host-picker {
131-
position: absolute;
135+
position: fixed;
132136
background: white;
133137
border: 4px solid rgb(128,128,128);
134-
width: 16em;
138+
max-width: 50em;
139+
min-width: 15em;
135140
height: auto;
136141
border-radius: 6px;
137142
bottom: 5.5em;
138-
left: 71em;
139143
padding: 0;
140144
}
141145

@@ -190,19 +194,19 @@ html,body {
190194
.host-picker-search {
191195
border: 2px solid #84BACC;
192196
background: white;
197+
width: 90%;
193198
}
194199

195200

196201
.date-picker {
197-
position: absolute;
202+
position: fixed;
198203
background: white;
199204
border: 4px solid rgb(128,128,128);
200205
padding: 1em;
201206
width: 25em;
202207
height: 7em;
203208
border-radius: 6px;
204209
bottom: 5.5em;
205-
left: 72em;
206210
}
207211

208212
.date-picker:after, .date-picker:before {
@@ -235,6 +239,7 @@ html,body {
235239
margin-left: .2em;
236240
font-weight: bold;
237241
color: black;
242+
background-color: darkgray;
238243
}
239244

240245
.flex-container-date-picker > .submit:enabled:hover {
@@ -340,14 +345,13 @@ html,body {
340345
}
341346

342347
.settings {
343-
position: absolute;
348+
position: fixed;
344349
background: white;
345350
border: 4px solid rgb(128,128,128);
346351
width: 20em;
347352
height: auto;
348353
border-radius: 6px;
349354
bottom: 5.5em;
350-
left: 80em;
351355
padding: 0;
352356
color: black;
353357
padding: 1em;

public/templates/index.html

+8-7
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
placeholder='"access denied" 1.2.3.4 -sshd' title='Default search field : message'></input>
2424
<div ng-hide="userSearchText !== null && userSearchText.length > 0" class="lucene-hint"><a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-query-string-query.html#query-string-syntax" target="_blank">Uses lucene query syntax</a></div>
2525
<button class="submit btn search-btn flex-item-search" >Search</button>
26-
<button type="button" id="host-picker-btn" class="btn host-option-select-btn flex-item-search"
27-
ng-click="showHostPicker()">{{selectedHost == null ? 'All Systems' : selectedHost}}</button>
28-
<button type="button" id="date-picker-btn" class="time-option-select-btn btn flex-item-search"
29-
ng-click="showDatePicker()">{{ isNullorEmpty(userDateTimeSeeked) ? 'Now' : userDateTimeSeeked }}</button>
30-
<button type="button" id="settings-btn" class="settings-select-btn btn flex-item-search"
31-
ng-click="showSettings()">Settings</button>
26+
<button type="button" id="host-picker-btn" class="btn host-option-select-btn flex-item-search">
27+
{{selectedHost == null ? 'All Systems' : selectedHost}}</button>
28+
<button type="button" id="date-picker-btn" class="time-option-select-btn btn flex-item-search">
29+
{{ isNullorEmpty(userDateTimeSeeked) ? 'Now' : userDateTimeSeeked }}</button>
30+
<button type="button" id="settings-btn" class="settings-select-btn btn flex-item-search">Settings</button>
3231
</div>
3332
</form>
3433
<div class="date-picker ng-hide" id="date-picker" click-outside>
@@ -47,7 +46,9 @@
4746

4847
<div class="host-picker ng-hide" id="host-picker" click-outside>
4948
<ul class="host-picker-list">
50-
<li ng-repeat="host in hosts" ng-hide="hostSearchText != null && !host.includes(hostSearchText)"><a href ng-click="onHostSelected(host)">{{host}}</a></li>
49+
<li ng-repeat="host in hosts" ng-hide="hostSearchText != null && !host.includes(hostSearchText)"><a href ng-click="onHostSelected(host)">{{host}}</a></li>
50+
</ul>
51+
<ul class="host-picker-list">
5152
<li> <a href ng-click="onHostSelected('*')"> [ All Systems ] </a></li>
5253
<li ng-hide="hosts.length < 11"><input class="host-picker-search" type="search" name="host-search-input" ng-model="hostSearchText"/></li>
5354
</ul>

server/routes/init_server_context.js

+2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ function loadConfigFromES(server,context) {
2525
function updateKeywordInfo(server,indexPattern, fieldKey) {
2626
return new Promise((resolve,reject) => {
2727
var field = indexPattern.fields.mapping[fieldKey];
28+
//check if the direct field is of type keyword
2829
checkIfFieldIsKeyword(server,indexPattern, field).then(async function(result) {
2930
if (result) {
3031
indexPattern.fields.mapping[fieldKey + ".keyword"] = field;
3132
} else {
33+
//else check if we have .keyword mapping added by logstash template.
3234
result = await checkIfFieldIsKeyword(server,indexPattern, field + ".keyword");
3335
if (result) {
3436
indexPattern.fields.mapping[fieldKey + ".keyword"] = field + ".keyword";

server/routes/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { initServerContext, updateKeywordInfo } from "./init_server_context.js"
33
function getMessageTemplate(handlebar, selected_config) {
44
var message_format = selected_config.fields.message_format;
55
//Append <a> tags for click to message format except for message field
6-
var message_format_regex = /({{{(\S+)}}})/g; // e.g. {{pid}} : {{syslog_message}}
6+
var message_format_regex = /({{{[\[]?([\w+\.\_]+)[\]]?}}})/g; // e.g. {{{[pid]}}} {{{program}}} : {{syslog_message}}
77
var ng_click_template = handlebar.compile("<a class=\"ng-binding\" ng-click=\"onClick('{{name_no_braces}}','{{name}}')\">{{name}}</a>",
88
{
99
knownHelpers: {
@@ -172,7 +172,7 @@ module.exports = function (server) {
172172
}
173173
};
174174
var hostnameField = selected_config.fields.mapping.hostname;
175-
if (selected_config.fields['hostname.keyword']) {
175+
if (selected_config.fields.mapping['hostname.keyword']) {
176176
hostnameField += '.keyword';
177177
}
178178
termQuery.term[hostnameField] = request.payload.hostname;

0 commit comments

Comments
 (0)