New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log search #1114
Merged
Merged
Log search #1114
Changes from 16 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
edf59c9
Moving logs to virtual list
aleksfront 7234d2e
Introducing log search
aleksfront 118ed20
Setting ref for VirtualList to access its methods
aleksfront 5c084b8
Introducing search store
aleksfront f8548d6
Centering overlay when scroll to it
aleksfront 93ae4b6
Using SearchInput in PodLogSearch
aleksfront 7ac13f5
Using Prev/Next icons for search
aleksfront 14e88a5
No trigger logs load when scrolled by method
aleksfront de33f52
SearchInput refactoring
aleksfront cfb6c3c
Adding find counters
aleksfront 45b6faf
Clean search query on dock tab change
aleksfront a6eb283
Refresh search when logs get changed
aleksfront e3a3fb4
Case-insensitive search
aleksfront 01e485d
Improve logs scrolling experience
aleksfront 6bb874d
Catching empty logs in various places
aleksfront 4b0b635
Fixing downloading logs
aleksfront d5ed79d
Clean up some duplicated styles
aleksfront c099711
Removing jump-to-bottom animation
aleksfront c962ea6
Fixing since label
aleksfront 99b6bab
Reducing container selector size
aleksfront fcf9422
Scroll down to bottom after each reload
aleksfront de536b8
Fix search within timestamps if they not provided
aleksfront d736f24
Use log row hover color from theme
aleksfront 2e2eec7
Add search bindings for 'Esc' & 'Enter' hits
aleksfront b0c0794
Merge branch 'master' into logs-search
aleksfront 61a2936
Merge branch 'master' into logs-search
aleksfront bc8a688
Focus input fields on CmdOrCtrl+F
aleksfront 16cde00
Move search.store.ts in to /common folder
aleksfront d262c76
search.store.ts -> search-store.ts
aleksfront 4ec29ce
Adding test for search store
aleksfront a054ae2
Adding integration tests for logs
aleksfront 139c114
Fixing scroll jumping bug
aleksfront 83c760d
Removing download icon check for testing purpose
aleksfront ea96a7f
Merge branch 'master' into logs-search
aleksfront 858acc1
Removing clicking on nginx-create-pod-test
aleksfront 94ed372
Moving log tests before cluster operations
aleksfront da12885
Build extensions before integration tests
nevalla cc3af77
Build also npm before integration tests
nevalla 6283daa
Move npm build and extension build into own build step
nevalla 4e1b901
Merge branch 'master' into logs-search
aleksfront cc8902c
Removing separator sketches
aleksfront c3c2e52
Horizontal scrolling to founded keyword
aleksfront 4caddf5
Merge branch 'master' into logs-search
aleksfront 871173e
Delaying horizontal scrolling
aleksfront b67d367
Merge branch 'master' into logs-search
aleksfront eb4435e
Merge branch 'master' into logs-search
aleksfront File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { SearchStore } from "../search-store" | ||
|
||
let searchStore: SearchStore = null; | ||
|
||
const logs = [ | ||
"1:M 30 Oct 2020 16:17:41.553 # Connection with replica 172.17.0.12:6379 lost", | ||
"1:M 30 Oct 2020 16:17:41.623 * Replica 172.17.0.12:6379 asks for synchronization", | ||
"1:M 30 Oct 2020 16:17:41.623 * Starting Partial resynchronization request from 172.17.0.12:6379 accepted. Sending 0 bytes of backlog starting from offset 14407." | ||
] | ||
|
||
describe("search store tests", () => { | ||
beforeEach(async () => { | ||
searchStore = new SearchStore(); | ||
}) | ||
|
||
it("does nothing with empty search query", () => { | ||
searchStore.onSearch([], ""); | ||
expect(searchStore.occurrences).toEqual([]); | ||
}) | ||
|
||
it("doesn't brake if no text provided", () => { | ||
searchStore.onSearch(null, "replica"); | ||
expect(searchStore.occurrences).toEqual([]); | ||
|
||
searchStore.onSearch([], "replica"); | ||
expect(searchStore.occurrences).toEqual([]); | ||
}) | ||
|
||
it("find 3 occurences across 3 lines", () => { | ||
searchStore.onSearch(logs, "172"); | ||
expect(searchStore.occurrences).toEqual([0, 1, 2]); | ||
}) | ||
|
||
it("find occurences within 1 line (case-insensitive)", () => { | ||
searchStore.onSearch(logs, "Starting"); | ||
expect(searchStore.occurrences).toEqual([2, 2]); | ||
}) | ||
|
||
it("sets overlay index equal to first occurence", () => { | ||
searchStore.onSearch(logs, "Replica"); | ||
expect(searchStore.activeOverlayIndex).toBe(0); | ||
}) | ||
|
||
it("set overlay index to next occurence", () => { | ||
searchStore.onSearch(logs, "172"); | ||
searchStore.setNextOverlayActive(); | ||
expect(searchStore.activeOverlayIndex).toBe(1); | ||
}) | ||
|
||
it("sets overlay to last occurence", () => { | ||
searchStore.onSearch(logs, "172"); | ||
searchStore.setPrevOverlayActive(); | ||
expect(searchStore.activeOverlayIndex).toBe(2); | ||
}) | ||
|
||
it("gets line index where overlay is located", () => { | ||
searchStore.onSearch(logs, "synchronization"); | ||
expect(searchStore.activeOverlayLine).toBe(1); | ||
}) | ||
|
||
it("escapes string for using in regex", () => { | ||
const regex = searchStore.escapeRegex("some.interesting-query\\#?()[]"); | ||
expect(regex).toBe("some\\.interesting\\-query\\\\\\#\\?\\(\\)\\[\\]"); | ||
}) | ||
|
||
it("gets active find number", () => { | ||
searchStore.onSearch(logs, "172"); | ||
searchStore.setNextOverlayActive(); | ||
expect(searchStore.activeFind).toBe(2); | ||
}) | ||
|
||
it("gets total finds number", () => { | ||
searchStore.onSearch(logs, "Starting"); | ||
expect(searchStore.totalFinds).toBe(2); | ||
}) | ||
}) |
2 changes: 1 addition & 1 deletion
2
src/renderer/components/dock/search.store.ts → src/common/search-store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course.