-
Notifications
You must be signed in to change notification settings - Fork 9
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
Widget | Log Viewer - preview #414
Open
szymon-owczarzak
wants to merge
314
commits into
master
Choose a base branch
from
enhancement/log-viewer-widget
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
314 commits
Select commit
Hold shift + click to select a range
00c4452
Remove obsolete log generator #417
clmrv 608d790
Code review fixes - deleted unnecesarry comments
mprzypasniak99 77aafe9
Add MongoDB, Log data class
przemekxa 6d49c96
Merge pull request #417 from wttech/feature/376-381-412
TheTerabit d6a616f
Fixes after WTTech review #414
mprzypasniak99 c665788
Added proper exception handling to react to errors #420
mprzypasniak99 b3bd8b4
Merge pull request #419 from wttech/fix/review-414
janeksmielowski 1137fd8
Merge pull request #421 from wttech/bugfix/420
janeksmielowski 31e064f
Add advanced filter modal, setup add filter #389
clmrv 1e6ab44
Saving ssh_key to file #416
mprzypasniak99 3d1bff1
Add edit option to advanced filters #389
clmrv 6a98464
Add filtering by regExp #389
clmrv c43b56e
Add MockLogStorage
przemekxa 61e787e
Change LogParser
przemekxa 9db4fe4
Add localStorage #389
clmrv 76dc87c
Add delete action #389
clmrv 573e443
Add multiselect support #389
clmrv 5734098
Add implicit checked on edit #389
clmrv 1259f82
Work on storage, disable logs
przemekxa 741347b
Connect the database with the frontend
przemekxa 5294bf2
Minor SSH adjustments [#416]
mprzypasniak99 20b5162
Add tooltips #389
clmrv fddb4c4
Delete HTTP connection strategy
przemekxa eba4b65
Disable filter menu on no filters #389
clmrv c8ac985
Fix connections with SSH
przemekxa 610e8ef
Add crontab
przemekxa 01d6b08
Merge branch 'enhancement/log-viewer-widget' into feature/397
przemekxa d59de03
Fix errors after merge
przemekxa 0b01d11
Add Mongo to the preparation script
przemekxa dda189f
Quarantine modal
Borrubasz 00e858f
Fixing bug with delete function
Borrubasz 163dff7
Moved saving ssh key to file to constructor [#416]
mprzypasniak99 9aaa7ab
Change the code after code review
przemekxa 533de11
Added deleting icon to quarantine rules
Borrubasz c223f29
Change id to uuid, rename setFilters #389
clmrv e304a72
Change labels, enhance credentials file input
clmrv c968679
Merge pull request #427 from wttech/enhancement/credentials-ssh
clmrv 04b5fdb
Merge pull request #424 from wttech/feature/397
janeksmielowski 39ec14c
Changes after code review
Borrubasz 66c2db8
Merge branch 'enhancement/log-viewer-widget' into feature/391
Borrubasz c0192c5
Merge pull request #425 from wttech/feature/391
janeksmielowski 2408363
Merge branch 'enhancement/log-viewer-widget' into feature/389
clmrv de33a65
Merge pull request #422 from wttech/feature/389
clmrv 8e66d46
Fix filterByRegExp func #389
clmrv 8d0b6c3
Merge branch 'enhancement/log-viewer-widget' into feature/416
mprzypasniak99 7f3ccdd
Implemented changes from review #414
mprzypasniak99 d694266
Merge pull request #423 from wttech/feature/416
janeksmielowski 42d7e60
Merge pull request #429 from wttech/hotfix/389
janeksmielowski 69bc94b
Merge branch 'enhancement/log-viewer-widget' into review/414
mprzypasniak99 f6a4414
Fixed build issue #414
mprzypasniak99 7c4e574
Add search filter #385
clmrv d793376
Add quarantine rules
przemekxa 5051f19
Add searchbar clear button #385
clmrv 8f29394
Add prop types #385
clmrv c2671a7
Add datespan to localstorage #383
clmrv 06b5e25
Add datespan logic #383
clmrv 43b5750
Improve quarantine
przemekxa badb64d
Update date format #383
clmrv 1da10b2
Add clear logs button logic #392
clmrv 99c4ddf
Add logs limit
przemekxa 262e288
Added logic for filtering by log level
Borrubasz 3287197
Add text highlight #385
clmrv 7662608
Merge pull request #432 from wttech/feature/383
clmrv 04c0167
Fix case sensitivity #385
clmrv 51a90ae
Merge pull request #430 from wttech/review/414
janeksmielowski b849561
Merge pull request #433 from wttech/feature/396
janeksmielowski 2562399
Merge branch 'enhancement/log-viewer-widget' into feature/385
clmrv a39d997
Merge branch 'enhancement/log-viewer-widget' into feature/385
clmrv 0374bd3
Merge pull request #431 from wttech/feature/385
janeksmielowski efd4379
filterByLogLevels moved to helpers
Borrubasz f0a5d26
Merge branch 'enhancement/log-viewer-widget' into feature/387
Borrubasz f58b24e
Merge pull request #434 from wttech/feature/387
Borrubasz 03d6f9f
Add list virtualizer #436
clmrv 9c232d3
Setup following logs #394
clmrv 8b23336
Merge branch 'enhancement/log-viewer-widget' into feature/436
clmrv 5c52267
Initial config updated with LogViewer widget
f1fe2ff
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
0ca29f9
Code cleanup #436
clmrv 9ad7ed0
Move item into function #436
clmrv e277593
Fix jest App.js test
clmrv baefa33
Add filterByRexExp unit tests #440
clmrv 4c65446
Merge pull request #446 from wttech/feature/436
clmrv a229e0f
Add quarantine info message, change quarantine matching system
przemekxa 323d9cf
Merge branch 'enhancement/log-viewer-widget' into feature/444
przemekxa e5a4cc5
Clear logs based on the date of the last one
przemekxa 402c151
Setup LogsViewer technical documentation
clmrv ff32549
Add log list to docs
clmrv 9c5409d
fix local storage sentence
clmrv 75c2f6b
Moved quarantine button to advanced modal #437
mprzypasniak99 49e0d59
Added parser field to LogsViewer configuration modal #438
mprzypasniak99 074a915
Adjusted backend to new config field #438
mprzypasniak99 d71a007
Merge branch 'enhancement/log-viewer-widget' into feature/437
mprzypasniak99 d754954
Add create widget test #440
clmrv 34e7039
Add create widget validation #440
clmrv 24cf7e2
Add add filter test #440
clmrv d7558ce
Fix the bugs in the code
przemekxa 56c18c9
Add filters multiselect test #440
clmrv 411578f
Add editing filter test #440
clmrv f991653
Add removal test, complex filtering test #440
clmrv 9e9630f
Code formating #440
clmrv 632d22d
Fix tests #440
clmrv 013a559
Merge pull request #452 from wttech/feature/443
TheTerabit 9fc546d
Merge pull request #455 from wttech/feature/437
TheTerabit 64a5ea8
Merge pull request #454 from wttech/feature/438
TheTerabit a35ec29
Merge pull request #453 from wttech/feature/444
TheTerabit 8f7040f
Rework unit tests #440
clmrv 670a54d
Update test names #440
clmrv c4142fb
Change log fetching
przemekxa d91d200
Refactor log levels #441
clmrv 4ff1c33
Add logLevel unit tests #441
clmrv 475b526
Update filtering sequence #441
clmrv 1b4d4cf
Merge branch 'enhancement/log-viewer-widget' into feature/450
przemekxa 8baebfe
Fix bugs after merge
przemekxa 3e1c7cd
Add filterByDateSpan unit tests #441
clmrv 1d9439a
Add info about dates storage
clmrv cdc9462
Add getDateSpan unit tests #441
clmrv 6b47f55
Update useLocalStorage naming #441
clmrv 6c74807
Fix fetching the logs
przemekxa edc646a
Merge pull request #456 from wttech/feature/440
janeksmielowski ff42ac8
Merge pull request #457 from wttech/feature/450
janeksmielowski 1c59bf2
Fix bugs and improve the code
przemekxa de92f14
Merge branch 'enhancement/log-viewer-widget' into feature/414-backend
przemekxa e7c9550
Add an empty quarantine rule
przemekxa ee3696e
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv d64be4b
Update tests (Log parser type)
clmrv 0a9a56a
Add show only error logs test #441
clmrv acb722d
Add log level tests #441
clmrv e4eff4a
Add selectLogLevel func #441
clmrv de96320
Add date span tests #441
clmrv 9e818eb
Add similar logs buttons
przemekxa fafe7d3
Add ToggleIconButton, update toolbar #447
clmrv a61db69
Update search input rwd #447
clmrv b1d1d86
Fix toolbar width #447
clmrv 04384ae
Move scrollbar of toolbar #447
clmrv d241cf2
Update toolbar width #447
clmrv 5467e13
Remove some nullable fields
przemekxa 1c1134c
Change the look of the buttons
przemekxa 0be52c7
Fixes for nullable values #445
mprzypasniak99 4c44894
Merge remote-tracking branch 'origin/feature/414-backend' into featur…
mprzypasniak99 45d9af2
Remove time consts, update test name #441
clmrv 1e75830
Refactor filterByDateSpan test code #441
clmrv 57818cf
Update logLevels tests #441
clmrv 1c02c91
Add similar logs context
przemekxa 3895e4d
Revert logLevels change #441
clmrv 3caa4d2
Merge pull request #460 from wttech/feature/441
clmrv 8d9f0fb
Merge branch 'enhancement/log-viewer-widget' into feature/447
clmrv ab86d95
Update child input css selector #447
clmrv 099ac2e
Merge pull request #462 from wttech/feature/447
clmrv f293189
Quarantine tests added
Borrubasz b38aff0
Put all LogsViewer tests into one file and correct tests names
Borrubasz 8fb5fc9
Update advanced filters button #447
clmrv 2e1bca7
Tests fix
Borrubasz 5e156f4
Seaarchbar tests added
Borrubasz 3278d1f
Fixes after code review
Borrubasz c7b1a24
Fix in widgetDynamicTab
Borrubasz adbd994
Added changes to generation of cogboard-compose.yml #428
mprzypasniak99 b8e76d6
Fix bugs and improve the code
przemekxa 86e2bf8
Add an empty quarantine rule
przemekxa 60201b3
Fixes for nullable values #445
mprzypasniak99 01c6230
Remove some nullable fields
przemekxa 3217c20
Merge branch 'feature/414-backend' of github.com:wttech/cogboard into…
mprzypasniak99 cf7a87e
Merge branch 'enhancement/log-viewer-widget' into feature/388
przemekxa 2733af6
Changed return value in SSHClient #445
mprzypasniak99 78e00f3
Merge pull request #461 from wttech/feature/388
przemekxa 3a05b48
Merge pull request #463 from wttech/feature/414-backend
mprzypasniak99 7d86e53
Merge pull request #459 from wttech/feature/439
Borrubasz 294e9bb
Merge pull request #458 from wttech/feature/442
Borrubasz 0904b48
Add export to file button and tests bugfixes
Borrubasz cc774ef
Add initial quarantine end date implementation
przemekxa d2c8b11
Rename MockLogParser to DefaultLogParser #467
clmrv 2211d23
Change the enabling/disabling of quarantine rules
przemekxa a913d43
Modify the quarantine rules tests
przemekxa f986c74
Changed compose files
mprzypasniak99 9626633
Deleted docker config script creation
mprzypasniak99 04ce2ee
Enlarge dialog widths #467
clmrv 7fcf21e
Update placement of select menu items #467
clmrv 133f5cd
Fix layout twitching (filters selection) #467
clmrv d09476d
Rename clear logs, update icon #467
clmrv 83f6367
Remove toolbar group #467
clmrv d949c1f
Delete comment after review
Borrubasz 576035d
Merge pull request #465 from wttech/feature/399
Borrubasz 5339aeb
Add toolbar layout stretch #467
clmrv 584bd48
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv 5588033
Update button sizes in log desc #467
clmrv 0870394
Remove static toolbar height #467
clmrv e95f466
Merge pull request #470 from wttech/feature/467
clmrv f3bac48
Add log parser field to initData
clmrv 0343b4d
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa 2d2645b
Add button redirecting to documentation from quarantine form
Borrubasz ac5786b
Merge pull request #472 from wttech/feature/466
Borrubasz 7cbfb35
Merge branch 'enhancement/log-viewer-widget' into feature/428
mprzypasniak99 93dc7ae
Deleted remaining unnecessary changes
mprzypasniak99 a112f25
Set up Log Viewer credentials with SSH key and changed CRLF to LF #469
mprzypasniak99 d1b0dc0
Added documentation of LogViewerWidgetClass #448
mprzypasniak99 ad077cc
Added default values for parameters #428
mprzypasniak99 f4f7205
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa d442bc2
Add date and time format
przemekxa c7c0c3d
Simplify the toggling function
przemekxa bc66301
Add copy button
clmrv 991133c
Fix search bar clear icon
clmrv c13be5b
Fix ToggleIconButton attribute warning
clmrv 8c31e3d
Make log accordion controlled
clmrv 8404c72
Merge pull request #473 from wttech/feature/428
janeksmielowski e3a59a0
Merge pull request #475 from wttech/feature/copy-button
janeksmielowski 0d91158
Merge pull request #474 from wttech/feature/469
janeksmielowski 9c6b76b
Update copy button placement
clmrv 7c229d2
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv 8c11d91
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa 99f24b3
Add comments, rename variable
przemekxa 9c30f31
Add milliseconds variable
przemekxa 34d65b5
Merge pull request #471 from wttech/feature/468
janeksmielowski 3fb3a56
Update container names, add logs
przemekxa 976b61f
Fixes, following logs uses virtuoso
clmrv da5c326
Add list of expanded logs to redux
clmrv 64cb74d
Add chmod script, add a copy using slice
przemekxa 21b33e8
Rework following logs
clmrv c7a7800
Update following logs
clmrv ed0c018
Fix following when list is not full
clmrv 1f432c9
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv 4d845e5
Remove logs from toolbar
clmrv 4e5b3af
Merge pull request #478 from wttech/feature/following-logs
clmrv 35942f8
Merge branch 'enhancement/log-viewer-widget' into feature/chmod
przemekxa ca6b867
Change let to const
przemekxa 77b36f8
Fix highlight test
clmrv 661672a
Revoke unmountOnExit
clmrv 569dd8a
Merge branch 'enhancement/log-viewer-widget' into feature/chmod
przemekxa 96d9768
Merge pull request #479 from wttech/feature/chmod
janeksmielowski 7cbf63f
Change some details in the UI
przemekxa f08bc5d
Merge branch 'enhancement/log-viewer-widget' into feature/414-2
przemekxa 9930955
Merge branch 'master' into enhancement/log-viewer-widget
c972c33
Moving gen.sh script into Dockerfile
42e4433
Merge pull request #481 from wttech/feature/476
przemekxa 45fbe46
Merge branch 'enhancement/log-viewer-widget' into feature/414-2
przemekxa c734ca9
Documented LogStorage class #448
mprzypasniak99 ad47927
Add info about log list scroll
clmrv 21454ed
Add info about following logs
clmrv 5a8c55a
Add copying info
clmrv c2da035
Documented LogParsing and Connection strategies with factories #448
mprzypasniak99 f02ac26
Add mongo-data volume
przemekxa a0341db
Merge pull request #482 from wttech/feature/414-2
janeksmielowski 1609ce0
Change container name
przemekxa 20d8a1f
Add info about storedLogs
clmrv b7a8990
Documented rest of the application back-end #448
mprzypasniak99 ea95c88
Merge branch 'docs/logs-viewer' into feature/448
clmrv a2a534f
Change copy method from navigator to execCommand
clmrv 4e9f7c0
Update info on copy button
clmrv 27ceeda
Merge pull request #485 from wttech/feature/logviewer-copy-button
janeksmielowski 9e2f917
Merge branch 'enhancement/log-viewer-widget' into feature/448
mprzypasniak99 6b94a8d
Merge branch 'feature/448' of github.com:wttech/cogboard into feature…
mprzypasniak99 d747e55
Merge pull request #483 from wttech/feature/448
mprzypasniak99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"logLines": [ | ||
"02:49:12 127.0.0.1 GET / 200", | ||
"02:49:35 127.0.0.1 GET /index.html 200", | ||
"03:01:06 127.0.0.1 GET /images/sponsered.gif 304", | ||
"03:52:36 127.0.0.1 GET /search.php 200", | ||
"04:17:03 127.0.0.1 GET /admin/style.css 200", | ||
"05:04:54 127.0.0.1 GET /favicon.ico 404", | ||
"05:38:07 127.0.0.1 GET /js/ads.js 200" | ||
] | ||
} |
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 |
---|---|---|
@@ -1,45 +1,47 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
|
||
"io.knotx:knotx".let { v -> | ||
implementation(platform("$v-dependencies:${project.property("knotx.version")}")) | ||
implementation("$v-server-http-api:${project.property("knotx.version")}") | ||
} | ||
"io.vertx:vertx".let { v -> | ||
implementation("$v-web") | ||
implementation("$v-auth-jwt") | ||
implementation("$v-web-client") | ||
implementation("$v-rx-java2") | ||
} | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.10.0") | ||
implementation(kotlin("stdlib-jdk8")) | ||
|
||
testImplementation("org.assertj:assertj-core:3.12.2") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.3.1") | ||
testImplementation("org.mockito:mockito-junit-jupiter:3.1.0") | ||
testImplementation(gradleTestKit()) | ||
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.2") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
|
||
"io.knotx:knotx".let { v -> | ||
implementation(platform("$v-dependencies:${project.property("knotx.version")}")) | ||
implementation("$v-server-http-api:${project.property("knotx.version")}") | ||
} | ||
"io.vertx:vertx".let { v -> | ||
implementation("$v-web") | ||
implementation("$v-auth-jwt") | ||
implementation("$v-web-client") | ||
implementation("$v-rx-java2") | ||
} | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.10.0") | ||
implementation(kotlin("stdlib-jdk8")) | ||
implementation("com.jcraft:jsch:0.1.55") | ||
implementation("org.mongodb:mongo-java-driver:3.12.10") | ||
|
||
testImplementation("org.assertj:assertj-core:3.12.2") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.3.1") | ||
testImplementation("org.mockito:mockito-junit-jupiter:3.1.0") | ||
testImplementation(gradleTestKit()) | ||
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.2") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} |
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
63 changes: 63 additions & 0 deletions
63
cogboard-app/src/main/kotlin/com/cognifide/cogboard/logStorage/LogController.kt
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,63 @@ | ||
package com.cognifide.cogboard.logStorage | ||
|
||
import com.cognifide.cogboard.CogboardConstants.Props | ||
import com.cognifide.cogboard.logStorage.model.Log | ||
import com.cognifide.cogboard.logStorage.model.asLog | ||
import com.cognifide.cogboard.storage.VolumeStorageFactory.boards | ||
import com.cognifide.cogboard.widget.type.logviewer.LogViewerWidget | ||
import com.mongodb.client.model.Sorts | ||
import io.knotx.server.api.handler.RoutingHandlerFactory | ||
import io.vertx.core.Handler | ||
import io.vertx.core.json.JsonArray | ||
import io.vertx.core.json.JsonObject | ||
import io.vertx.core.logging.Logger | ||
import io.vertx.core.logging.LoggerFactory | ||
import io.vertx.reactivex.core.Vertx | ||
import io.vertx.reactivex.ext.web.RoutingContext | ||
import java.time.Instant | ||
|
||
class LogController : RoutingHandlerFactory { | ||
|
||
override fun getName(): String = "logs-handler" | ||
|
||
override fun create(vertx: Vertx?, config: JsonObject?): Handler<RoutingContext> = Handler { context -> | ||
context?.request()?.params()?.get("id")?.let { id -> | ||
val logs = JsonArray(getLogs(id).map { it.toJson() }) | ||
context.response().end(logs.encode()) | ||
} | ||
} | ||
|
||
private fun getLogs(id: String): List<Log> { | ||
val logLines = boards() | ||
.loadConfig() | ||
.getJsonObject(Props.WIDGETS) | ||
.getJsonObject(Props.WIDGETS_BY_ID) | ||
.getJsonObject(id) | ||
.getInteger(Props.LOG_LINES) | ||
?: LogViewerWidget.DEFAULT_LOG_LINES.toInt() | ||
|
||
return if (LOGGER.isDebugEnabled) { | ||
val start = Instant.now() | ||
val logs = fetchLogs(id, logLines) | ||
val took = Instant.now().minusMillis(start.toEpochMilli()).toEpochMilli() | ||
LOGGER.debug("DB query for $id took $took[ms] for getting $logLines (processed logs: ${logs.size})") | ||
logs | ||
} else { | ||
fetchLogs(id, logLines) | ||
} | ||
} | ||
|
||
private fun fetchLogs(id: String, logLines: Int): List<Log> { | ||
return LogStorage.database | ||
.getCollection(id) | ||
.find() | ||
.sort(Sorts.descending(Log.SEQ)) | ||
.limit(logLines) | ||
.map { it.asLog() } | ||
.sortedBy { it.seq } | ||
} | ||
|
||
companion object { | ||
val LOGGER: Logger = LoggerFactory.getLogger(LogController::class.java) | ||
} | ||
} |
Oops, something went wrong.
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.
why do we need this entry?
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.
When we're using ssh keys for authorization, the JSch library, which manages the connection, requires us to pass the path to the file with key. Since we're receiving it from front-end as a field in json object, we have to save it to file before using it. The key used by a widget is saved to a file with widget id as its name. To prevent accidental upload of such data to repository, this entry was added