Skip to content

Commit 3a035bc

Browse files
GoTo functionality implemented
1 parent 5816a20 commit 3a035bc

File tree

5 files changed

+59
-39
lines changed

5 files changed

+59
-39
lines changed

src/modules/main/logViewer/logViewer.html

+10-25
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,11 @@ <h1>
4949
<div
5050
class="slds-m-left--xx-small search-button"
5151
>
52-
<div
53-
class="slds-button-group actionBarButtonGroup"
54-
role="group"
55-
>
56-
<button
57-
class="slds-button slds-button_neutral action-bar-action-inlineEditReport reportAction report-action-inlineEditReport filtersButton"
58-
type="button"
59-
>
60-
<svg
61-
aria-hidden="true"
62-
class="slds-button__icon slds-button__icon_left"
63-
viewBox="0 0 52 52"
64-
>
65-
<g>
66-
<path
67-
d="M9.5 33.4l8.9 8.9c.4.4 1 .4 1.4 0L42 20c.4-.4.4-1 0-1.4l-8.8-8.8c-.4-.4-1-.4-1.4 0L9.5 32.1c-.4.4-.4 1 0 1.3zM36.1 5.7c-.4.4-.4 1 0 1.4l8.8 8.8c.4.4 1 .4 1.4 0l2.5-2.5c1.6-1.5 1.6-3.9 0-5.5l-4.7-4.7c-1.6-1.6-4.1-1.6-5.7 0l-2.3 2.5zM2.1 48.2c-.2 1 .7 1.9 1.7 1.7l10.9-2.6c.4-.1.7-.3.9-.5l.2-.2c.2-.2.3-.9-.1-1.3l-9-9c-.4-.4-1.1-.3-1.3-.1l-.2.2c-.3.3-.4.6-.5.9L2.1 48.2z"
68-
></path>
69-
</g></svg
70-
>Enable Field
71-
Editing
72-
</button>
73-
</div>
52+
<ui-input
53+
has-label={goTohasLabel}
54+
placeholder={goToPlaceholder}
55+
oninputchange={goToLine}
56+
></ui-input>
7457
</div>
7558
<div
7659
class="slds-m-left--xx-small"
@@ -87,7 +70,9 @@ <h1>
8770
line-height: 1;
8871
"
8972
>
90-
<div>
73+
<div
74+
class="search-button"
75+
>
9176
<div
9277
role="button"
9378
tabindex="-1"
@@ -117,7 +102,7 @@ <h1>
117102
<div
118103
class="slds-m-left--xx-small"
119104
>
120-
<div
105+
<!-- <div
121106
class="slds-button-group actionBarButtonGroup"
122107
role="group"
123108
>
@@ -139,7 +124,7 @@ <h1>
139124
></path></svg
140125
>Add Chart
141126
</button>
142-
</div>
127+
</div> -->
143128
</div>
144129
<div
145130
class="slds-m-left--xx-small"

src/modules/main/logViewer/logViewer.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/* eslint-disable inclusive-language/use-inclusive-words */
22
import { LightningElement, track } from 'lwc';
3-
import { subscribe, publish } from 'services/pubsub';
3+
import { subscribe } from 'services/pubsub';
44

55
export default class logViewer extends LightningElement {
6+
goToPlaceholder = 'Go to line';
7+
goTohasLabel = false;
68
reRenderVal = false;
79
isLoading = false;
810
isSearching = false;
@@ -165,7 +167,7 @@ export default class logViewer extends LightningElement {
165167
const searchPopover =
166168
this.template.querySelector('.data-search');
167169
if (searchPopover) {
168-
searchPopover.style.left = `${searchButtonRect.right}px`;
170+
searchPopover.style.right = `${window.innerWidth - 24 - searchButtonRect.right}px`;
169171
}
170172
}
171173
const lineElem = this.template.querySelectorAll('.log-row');
@@ -501,7 +503,7 @@ export default class logViewer extends LightningElement {
501503
processSearchRes(event) {
502504
const lineNumbers = event.detail;
503505
this.LineNumMap = new Map();
504-
console.log(lineNumbers);
506+
//console.log(lineNumbers);
505507
if (Array.isArray(lineNumbers)) {
506508
lineNumbers.forEach((l) => {
507509
if (this.linesPerPage !== 0) {
@@ -548,4 +550,10 @@ export default class logViewer extends LightningElement {
548550
}
549551
this.LineNumMap = new Map();
550552
}
553+
554+
goToLine(event) {
555+
// console.log('linenumber', event.detail);
556+
const lNum = event.detail;
557+
this.goToPage(lNum);
558+
}
551559
}

src/modules/ui/input/input.html

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
<template>
22
<div class={inputClassList}>
3-
<label class="slds-form-element__label slds-no-flex">{label}</label>
3+
<template lwc:if={hasLabel}>
4+
<label class="slds-form-element__label slds-no-flex">{label}</label>
5+
</template>
46
<div class="slds-form-element__control slds-grow">
5-
<input
6-
type="text"
7-
minlength={minimumLength}
8-
placeholder={placeholder}
9-
class="slds-input"
10-
value={textValue}
11-
onchange={handleInputChange}
12-
/>
7+
<template lwc:if={textValue}>
8+
<input
9+
type="text"
10+
minlength={minimumLength}
11+
placeholder={placeholder}
12+
class="slds-input"
13+
value={textValue}
14+
onchange={handleInputChange}
15+
/>
16+
</template>
17+
<template lwc:else>
18+
<input
19+
type="text"
20+
minlength={minimumLength}
21+
placeholder={placeholder}
22+
class="slds-input"
23+
oninput={handleOnInput}
24+
/>
25+
</template>
1326
</div>
1427
<template if:true={hasError}>
1528
<div role="alert" class="slds-form-element__help">

src/modules/ui/input/input.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default class Input extends LightningElement {
55
@api minimumLength;
66
@api placeholder;
77
@api textValue;
8+
@api hasLabel;
89
textValueInternal = '';
910
@api type;
1011
hasError = false;
@@ -28,7 +29,19 @@ export default class Input extends LightningElement {
2829
);
2930
console.log(this.textValueInternal);
3031
}
31-
32+
handleOnInput(event) {
33+
const lineNum = event.target.value;
34+
if (!isNaN(lineNum) && lineNum !== '') {
35+
clearTimeout(this.timeoutId);
36+
this.timeoutId = setTimeout(() => {
37+
this.dispatchEvent(
38+
new CustomEvent('inputchange', {
39+
detail: parseInt(lineNum, 10)
40+
})
41+
);
42+
}, 500);
43+
}
44+
}
3245
checkMinLength() {
3346
if (this.minimumLength && this.textValueInternal) {
3447
if (

src/modules/ui/search/search.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class Search extends LightningElement {
2121
handleSearchInput(event) {
2222
clearTimeout(this.timeoutId);
2323
const input = event.target.value;
24+
console.log('entered: ', input);
2425
this.timeoutId = setTimeout(() => {
2526
this.searchLog(input);
2627
}, 500);
@@ -77,7 +78,7 @@ export default class Search extends LightningElement {
7778
this.onRes = this.totRes = 0;
7879
return;
7980
}
80-
if (searchTerm.length > 2 && searchTerm !== undefined) {
81+
if (searchTerm.length >= 2 && searchTerm !== undefined) {
8182
const results = this.logtobeFiltered.filter((log) =>
8283
log.line.includes(searchTerm)
8384
);

0 commit comments

Comments
 (0)