Skip to content
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
wants to merge 314 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 Nov 12, 2021
608d790
Code review fixes - deleted unnecesarry comments
mprzypasniak99 Nov 12, 2021
77aafe9
Add MongoDB, Log data class
przemekxa Nov 14, 2021
6d49c96
Merge pull request #417 from wttech/feature/376-381-412
TheTerabit Nov 14, 2021
d6a616f
Fixes after WTTech review #414
mprzypasniak99 Nov 14, 2021
c665788
Added proper exception handling to react to errors #420
mprzypasniak99 Nov 14, 2021
b3bd8b4
Merge pull request #419 from wttech/fix/review-414
janeksmielowski Nov 14, 2021
1137fd8
Merge pull request #421 from wttech/bugfix/420
janeksmielowski Nov 14, 2021
31e064f
Add advanced filter modal, setup add filter #389
clmrv Nov 14, 2021
1e6ab44
Saving ssh_key to file #416
mprzypasniak99 Nov 14, 2021
3d1bff1
Add edit option to advanced filters #389
clmrv Nov 14, 2021
6a98464
Add filtering by regExp #389
clmrv Nov 14, 2021
c43b56e
Add MockLogStorage
przemekxa Nov 17, 2021
61e787e
Change LogParser
przemekxa Nov 18, 2021
9db4fe4
Add localStorage #389
clmrv Nov 19, 2021
76dc87c
Add delete action #389
clmrv Nov 19, 2021
573e443
Add multiselect support #389
clmrv Nov 19, 2021
5734098
Add implicit checked on edit #389
clmrv Nov 19, 2021
1259f82
Work on storage, disable logs
przemekxa Nov 20, 2021
741347b
Connect the database with the frontend
przemekxa Nov 20, 2021
5294bf2
Minor SSH adjustments [#416]
mprzypasniak99 Nov 20, 2021
20b5162
Add tooltips #389
clmrv Nov 20, 2021
fddb4c4
Delete HTTP connection strategy
przemekxa Nov 20, 2021
eba4b65
Disable filter menu on no filters #389
clmrv Nov 20, 2021
c8ac985
Fix connections with SSH
przemekxa Nov 20, 2021
610e8ef
Add crontab
przemekxa Nov 21, 2021
01d6b08
Merge branch 'enhancement/log-viewer-widget' into feature/397
przemekxa Nov 21, 2021
d59de03
Fix errors after merge
przemekxa Nov 21, 2021
0b01d11
Add Mongo to the preparation script
przemekxa Nov 21, 2021
dda189f
Quarantine modal
Borrubasz Nov 22, 2021
00e858f
Fixing bug with delete function
Borrubasz Nov 22, 2021
163dff7
Moved saving ssh key to file to constructor [#416]
mprzypasniak99 Nov 22, 2021
9aaa7ab
Change the code after code review
przemekxa Nov 23, 2021
533de11
Added deleting icon to quarantine rules
Borrubasz Nov 24, 2021
c223f29
Change id to uuid, rename setFilters #389
clmrv Nov 24, 2021
e304a72
Change labels, enhance credentials file input
clmrv Nov 24, 2021
c968679
Merge pull request #427 from wttech/enhancement/credentials-ssh
clmrv Nov 24, 2021
04b5fdb
Merge pull request #424 from wttech/feature/397
janeksmielowski Nov 24, 2021
39ec14c
Changes after code review
Borrubasz Nov 25, 2021
66c2db8
Merge branch 'enhancement/log-viewer-widget' into feature/391
Borrubasz Nov 25, 2021
c0192c5
Merge pull request #425 from wttech/feature/391
janeksmielowski Nov 25, 2021
2408363
Merge branch 'enhancement/log-viewer-widget' into feature/389
clmrv Nov 26, 2021
de33a65
Merge pull request #422 from wttech/feature/389
clmrv Nov 26, 2021
8e66d46
Fix filterByRegExp func #389
clmrv Nov 26, 2021
8d0b6c3
Merge branch 'enhancement/log-viewer-widget' into feature/416
mprzypasniak99 Nov 26, 2021
7f3ccdd
Implemented changes from review #414
mprzypasniak99 Nov 26, 2021
d694266
Merge pull request #423 from wttech/feature/416
janeksmielowski Nov 27, 2021
42d7e60
Merge pull request #429 from wttech/hotfix/389
janeksmielowski Nov 27, 2021
69bc94b
Merge branch 'enhancement/log-viewer-widget' into review/414
mprzypasniak99 Nov 27, 2021
f6a4414
Fixed build issue #414
mprzypasniak99 Nov 29, 2021
7c4e574
Add search filter #385
clmrv Nov 29, 2021
d793376
Add quarantine rules
przemekxa Nov 30, 2021
5051f19
Add searchbar clear button #385
clmrv Dec 1, 2021
8f29394
Add prop types #385
clmrv Dec 1, 2021
c2671a7
Add datespan to localstorage #383
clmrv Dec 1, 2021
06b5e25
Add datespan logic #383
clmrv Dec 1, 2021
43b5750
Improve quarantine
przemekxa Dec 2, 2021
badb64d
Update date format #383
clmrv Dec 3, 2021
1da10b2
Add clear logs button logic #392
clmrv Dec 3, 2021
99c4ddf
Add logs limit
przemekxa Dec 5, 2021
262e288
Added logic for filtering by log level
Borrubasz Dec 6, 2021
3287197
Add text highlight #385
clmrv Dec 7, 2021
7662608
Merge pull request #432 from wttech/feature/383
clmrv Dec 7, 2021
04c0167
Fix case sensitivity #385
clmrv Dec 7, 2021
51a90ae
Merge pull request #430 from wttech/review/414
janeksmielowski Dec 7, 2021
b849561
Merge pull request #433 from wttech/feature/396
janeksmielowski Dec 7, 2021
2562399
Merge branch 'enhancement/log-viewer-widget' into feature/385
clmrv Dec 7, 2021
a39d997
Merge branch 'enhancement/log-viewer-widget' into feature/385
clmrv Dec 7, 2021
0374bd3
Merge pull request #431 from wttech/feature/385
janeksmielowski Dec 8, 2021
efd4379
filterByLogLevels moved to helpers
Borrubasz Dec 8, 2021
f0a5d26
Merge branch 'enhancement/log-viewer-widget' into feature/387
Borrubasz Dec 8, 2021
f58b24e
Merge pull request #434 from wttech/feature/387
Borrubasz Dec 8, 2021
03d6f9f
Add list virtualizer #436
clmrv Dec 8, 2021
9c232d3
Setup following logs #394
clmrv Dec 8, 2021
8b23336
Merge branch 'enhancement/log-viewer-widget' into feature/436
clmrv Dec 8, 2021
5c52267
Initial config updated with LogViewer widget
Dec 9, 2021
f1fe2ff
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
Dec 9, 2021
0ca29f9
Code cleanup #436
clmrv Dec 11, 2021
9ad7ed0
Move item into function #436
clmrv Dec 11, 2021
e277593
Fix jest App.js test
clmrv Dec 11, 2021
baefa33
Add filterByRexExp unit tests #440
clmrv Dec 11, 2021
4c65446
Merge pull request #446 from wttech/feature/436
clmrv Dec 12, 2021
a229e0f
Add quarantine info message, change quarantine matching system
przemekxa Dec 12, 2021
323d9cf
Merge branch 'enhancement/log-viewer-widget' into feature/444
przemekxa Dec 12, 2021
e5a4cc5
Clear logs based on the date of the last one
przemekxa Dec 12, 2021
402c151
Setup LogsViewer technical documentation
clmrv Dec 15, 2021
ff32549
Add log list to docs
clmrv Dec 15, 2021
9c5409d
fix local storage sentence
clmrv Dec 17, 2021
75c2f6b
Moved quarantine button to advanced modal #437
mprzypasniak99 Dec 18, 2021
49e0d59
Added parser field to LogsViewer configuration modal #438
mprzypasniak99 Dec 18, 2021
074a915
Adjusted backend to new config field #438
mprzypasniak99 Dec 18, 2021
d71a007
Merge branch 'enhancement/log-viewer-widget' into feature/437
mprzypasniak99 Dec 18, 2021
d754954
Add create widget test #440
clmrv Dec 19, 2021
34e7039
Add create widget validation #440
clmrv Dec 19, 2021
24cf7e2
Add add filter test #440
clmrv Dec 19, 2021
d7558ce
Fix the bugs in the code
przemekxa Dec 19, 2021
56c18c9
Add filters multiselect test #440
clmrv Dec 19, 2021
411578f
Add editing filter test #440
clmrv Dec 19, 2021
f991653
Add removal test, complex filtering test #440
clmrv Dec 20, 2021
9e9630f
Code formating #440
clmrv Dec 20, 2021
632d22d
Fix tests #440
clmrv Dec 20, 2021
013a559
Merge pull request #452 from wttech/feature/443
TheTerabit Dec 20, 2021
9fc546d
Merge pull request #455 from wttech/feature/437
TheTerabit Dec 20, 2021
64a5ea8
Merge pull request #454 from wttech/feature/438
TheTerabit Dec 20, 2021
a35ec29
Merge pull request #453 from wttech/feature/444
TheTerabit Dec 20, 2021
8f7040f
Rework unit tests #440
clmrv Dec 22, 2021
670a54d
Update test names #440
clmrv Dec 22, 2021
c4142fb
Change log fetching
przemekxa Dec 22, 2021
d91d200
Refactor log levels #441
clmrv Dec 22, 2021
4ff1c33
Add logLevel unit tests #441
clmrv Dec 22, 2021
475b526
Update filtering sequence #441
clmrv Dec 22, 2021
1b4d4cf
Merge branch 'enhancement/log-viewer-widget' into feature/450
przemekxa Dec 23, 2021
8baebfe
Fix bugs after merge
przemekxa Dec 23, 2021
3e1c7cd
Add filterByDateSpan unit tests #441
clmrv Dec 23, 2021
1d9439a
Add info about dates storage
clmrv Dec 23, 2021
cdc9462
Add getDateSpan unit tests #441
clmrv Dec 23, 2021
6b47f55
Update useLocalStorage naming #441
clmrv Dec 23, 2021
6c74807
Fix fetching the logs
przemekxa Dec 27, 2021
edc646a
Merge pull request #456 from wttech/feature/440
janeksmielowski Dec 28, 2021
ff42ac8
Merge pull request #457 from wttech/feature/450
janeksmielowski Dec 28, 2021
1c59bf2
Fix bugs and improve the code
przemekxa Dec 28, 2021
de92f14
Merge branch 'enhancement/log-viewer-widget' into feature/414-backend
przemekxa Dec 28, 2021
e7c9550
Add an empty quarantine rule
przemekxa Dec 29, 2021
ee3696e
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv Dec 29, 2021
d64be4b
Update tests (Log parser type)
clmrv Dec 29, 2021
0a9a56a
Add show only error logs test #441
clmrv Dec 29, 2021
acb722d
Add log level tests #441
clmrv Dec 30, 2021
e4eff4a
Add selectLogLevel func #441
clmrv Dec 30, 2021
de96320
Add date span tests #441
clmrv Dec 30, 2021
9e818eb
Add similar logs buttons
przemekxa Dec 30, 2021
fafe7d3
Add ToggleIconButton, update toolbar #447
clmrv Dec 31, 2021
a61db69
Update search input rwd #447
clmrv Dec 31, 2021
b1d1d86
Fix toolbar width #447
clmrv Dec 31, 2021
04384ae
Move scrollbar of toolbar #447
clmrv Jan 2, 2022
d241cf2
Update toolbar width #447
clmrv Jan 2, 2022
5467e13
Remove some nullable fields
przemekxa Jan 2, 2022
1c1134c
Change the look of the buttons
przemekxa Jan 3, 2022
0be52c7
Fixes for nullable values #445
mprzypasniak99 Jan 3, 2022
4c44894
Merge remote-tracking branch 'origin/feature/414-backend' into featur…
mprzypasniak99 Jan 3, 2022
45d9af2
Remove time consts, update test name #441
clmrv Jan 4, 2022
1e75830
Refactor filterByDateSpan test code #441
clmrv Jan 4, 2022
57818cf
Update logLevels tests #441
clmrv Jan 4, 2022
1c02c91
Add similar logs context
przemekxa Jan 4, 2022
3895e4d
Revert logLevels change #441
clmrv Jan 4, 2022
3caa4d2
Merge pull request #460 from wttech/feature/441
clmrv Jan 4, 2022
8d9f0fb
Merge branch 'enhancement/log-viewer-widget' into feature/447
clmrv Jan 4, 2022
ab86d95
Update child input css selector #447
clmrv Jan 4, 2022
099ac2e
Merge pull request #462 from wttech/feature/447
clmrv Jan 4, 2022
f293189
Quarantine tests added
Borrubasz Dec 23, 2021
b38aff0
Put all LogsViewer tests into one file and correct tests names
Borrubasz Jan 4, 2022
8fb5fc9
Update advanced filters button #447
clmrv Jan 4, 2022
2e1bca7
Tests fix
Borrubasz Jan 4, 2022
5e156f4
Seaarchbar tests added
Borrubasz Dec 27, 2021
3278d1f
Fixes after code review
Borrubasz Jan 4, 2022
c7b1a24
Fix in widgetDynamicTab
Borrubasz Jan 4, 2022
adbd994
Added changes to generation of cogboard-compose.yml #428
mprzypasniak99 Jan 4, 2022
b8e76d6
Fix bugs and improve the code
przemekxa Dec 28, 2021
86e2bf8
Add an empty quarantine rule
przemekxa Dec 29, 2021
60201b3
Fixes for nullable values #445
mprzypasniak99 Jan 3, 2022
01c6230
Remove some nullable fields
przemekxa Jan 2, 2022
3217c20
Merge branch 'feature/414-backend' of github.com:wttech/cogboard into…
mprzypasniak99 Jan 4, 2022
cf7a87e
Merge branch 'enhancement/log-viewer-widget' into feature/388
przemekxa Jan 4, 2022
2733af6
Changed return value in SSHClient #445
mprzypasniak99 Jan 4, 2022
78e00f3
Merge pull request #461 from wttech/feature/388
przemekxa Jan 5, 2022
3a05b48
Merge pull request #463 from wttech/feature/414-backend
mprzypasniak99 Jan 5, 2022
7d86e53
Merge pull request #459 from wttech/feature/439
Borrubasz Jan 5, 2022
294e9bb
Merge pull request #458 from wttech/feature/442
Borrubasz Jan 5, 2022
0904b48
Add export to file button and tests bugfixes
Borrubasz Jan 5, 2022
cc774ef
Add initial quarantine end date implementation
przemekxa Jan 5, 2022
d2c8b11
Rename MockLogParser to DefaultLogParser #467
clmrv Jan 6, 2022
2211d23
Change the enabling/disabling of quarantine rules
przemekxa Jan 6, 2022
a913d43
Modify the quarantine rules tests
przemekxa Jan 6, 2022
f986c74
Changed compose files
mprzypasniak99 Jan 7, 2022
9626633
Deleted docker config script creation
mprzypasniak99 Jan 8, 2022
04ce2ee
Enlarge dialog widths #467
clmrv Jan 9, 2022
7fcf21e
Update placement of select menu items #467
clmrv Jan 9, 2022
133f5cd
Fix layout twitching (filters selection) #467
clmrv Jan 9, 2022
d09476d
Rename clear logs, update icon #467
clmrv Jan 9, 2022
83f6367
Remove toolbar group #467
clmrv Jan 9, 2022
d949c1f
Delete comment after review
Borrubasz Jan 9, 2022
576035d
Merge pull request #465 from wttech/feature/399
Borrubasz Jan 9, 2022
5339aeb
Add toolbar layout stretch #467
clmrv Jan 9, 2022
584bd48
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv Jan 9, 2022
5588033
Update button sizes in log desc #467
clmrv Jan 9, 2022
0870394
Remove static toolbar height #467
clmrv Jan 9, 2022
e95f466
Merge pull request #470 from wttech/feature/467
clmrv Jan 9, 2022
f3bac48
Add log parser field to initData
clmrv Jan 9, 2022
0343b4d
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa Jan 9, 2022
2d2645b
Add button redirecting to documentation from quarantine form
Borrubasz Jan 9, 2022
ac5786b
Merge pull request #472 from wttech/feature/466
Borrubasz Jan 9, 2022
7cbfb35
Merge branch 'enhancement/log-viewer-widget' into feature/428
mprzypasniak99 Jan 9, 2022
93dc7ae
Deleted remaining unnecessary changes
mprzypasniak99 Jan 9, 2022
a112f25
Set up Log Viewer credentials with SSH key and changed CRLF to LF #469
mprzypasniak99 Jan 10, 2022
d1b0dc0
Added documentation of LogViewerWidgetClass #448
mprzypasniak99 Jan 10, 2022
ad077cc
Added default values for parameters #428
mprzypasniak99 Jan 10, 2022
f4f7205
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa Jan 10, 2022
d442bc2
Add date and time format
przemekxa Jan 10, 2022
c7c0c3d
Simplify the toggling function
przemekxa Jan 10, 2022
bc66301
Add copy button
clmrv Jan 10, 2022
991133c
Fix search bar clear icon
clmrv Jan 10, 2022
c13be5b
Fix ToggleIconButton attribute warning
clmrv Jan 10, 2022
8c31e3d
Make log accordion controlled
clmrv Jan 10, 2022
8404c72
Merge pull request #473 from wttech/feature/428
janeksmielowski Jan 11, 2022
e3a59a0
Merge pull request #475 from wttech/feature/copy-button
janeksmielowski Jan 11, 2022
0d91158
Merge pull request #474 from wttech/feature/469
janeksmielowski Jan 11, 2022
9c6b76b
Update copy button placement
clmrv Jan 11, 2022
7c229d2
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv Jan 11, 2022
8c11d91
Merge branch 'enhancement/log-viewer-widget' into feature/468
przemekxa Jan 11, 2022
99f24b3
Add comments, rename variable
przemekxa Jan 11, 2022
9c30f31
Add milliseconds variable
przemekxa Jan 12, 2022
34d65b5
Merge pull request #471 from wttech/feature/468
janeksmielowski Jan 12, 2022
3fb3a56
Update container names, add logs
przemekxa Jan 12, 2022
976b61f
Fixes, following logs uses virtuoso
clmrv Jan 13, 2022
da5c326
Add list of expanded logs to redux
clmrv Jan 13, 2022
64cb74d
Add chmod script, add a copy using slice
przemekxa Jan 13, 2022
21b33e8
Rework following logs
clmrv Jan 14, 2022
c7a7800
Update following logs
clmrv Jan 14, 2022
ed0c018
Fix following when list is not full
clmrv Jan 14, 2022
1f432c9
Merge remote-tracking branch 'origin/enhancement/log-viewer-widget' i…
clmrv Jan 14, 2022
4d845e5
Remove logs from toolbar
clmrv Jan 14, 2022
4e5b3af
Merge pull request #478 from wttech/feature/following-logs
clmrv Jan 15, 2022
35942f8
Merge branch 'enhancement/log-viewer-widget' into feature/chmod
przemekxa Jan 15, 2022
ca6b867
Change let to const
przemekxa Jan 15, 2022
77b36f8
Fix highlight test
clmrv Jan 15, 2022
661672a
Revoke unmountOnExit
clmrv Jan 15, 2022
569dd8a
Merge branch 'enhancement/log-viewer-widget' into feature/chmod
przemekxa Jan 15, 2022
96d9768
Merge pull request #479 from wttech/feature/chmod
janeksmielowski Jan 16, 2022
7cbf63f
Change some details in the UI
przemekxa Jan 16, 2022
f08bc5d
Merge branch 'enhancement/log-viewer-widget' into feature/414-2
przemekxa Jan 16, 2022
9930955
Merge branch 'master' into enhancement/log-viewer-widget
Jan 17, 2022
c972c33
Moving gen.sh script into Dockerfile
Jan 17, 2022
42e4433
Merge pull request #481 from wttech/feature/476
przemekxa Jan 17, 2022
45fbe46
Merge branch 'enhancement/log-viewer-widget' into feature/414-2
przemekxa Jan 17, 2022
c734ca9
Documented LogStorage class #448
mprzypasniak99 Jan 17, 2022
ad47927
Add info about log list scroll
clmrv Jan 17, 2022
21454ed
Add info about following logs
clmrv Jan 17, 2022
5a8c55a
Add copying info
clmrv Jan 17, 2022
c2da035
Documented LogParsing and Connection strategies with factories #448
mprzypasniak99 Jan 18, 2022
f02ac26
Add mongo-data volume
przemekxa Jan 18, 2022
a0341db
Merge pull request #482 from wttech/feature/414-2
janeksmielowski Jan 18, 2022
1609ce0
Change container name
przemekxa Jan 18, 2022
20d8a1f
Add info about storedLogs
clmrv Jan 20, 2022
b7a8990
Documented rest of the application back-end #448
mprzypasniak99 Jan 20, 2022
ea95c88
Merge branch 'docs/logs-viewer' into feature/448
clmrv Jan 20, 2022
a2a534f
Change copy method from navigator to execCommand
clmrv Jan 22, 2022
4e9f7c0
Update info on copy button
clmrv Jan 22, 2022
27ceeda
Merge pull request #485 from wttech/feature/logviewer-copy-button
janeksmielowski Jan 24, 2022
9e2f917
Merge branch 'enhancement/log-viewer-widget' into feature/448
mprzypasniak99 Jan 25, 2022
6b94a8d
Merge branch 'feature/448' of github.com:wttech/cogboard into feature…
mprzypasniak99 Jan 25, 2022
d747e55
Merge pull request #483 from wttech/feature/448
mprzypasniak99 Jan 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ Thumbs.db
# Project specific
/mnt/*.json
/mnt/*.backup
/mnt/widget*
Copy link
Contributor Author

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?

Copy link
Collaborator

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

/mnt/content/*.json
/mnt/.version
/cogboard-compose.yml
/mnt/mongo/*
!/mnt/mongo/.gitkeep

# Intellij #
######################
Expand Down
11 changes: 11 additions & 0 deletions api-mocks/__files/logViewer/logs.json
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"
]
}
18 changes: 18 additions & 0 deletions api-mocks/mappings/endpoints-mapping.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
{
"mappings": [
{
"request": {
"method": "GET",
"url": "/log-viewer",
"queryParameters": {
"lines": {
"matches": "^[0-9]+$"
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "logViewer/logs.json"
}
},
{
"request": {
"method": "GET",
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ allprojects {

tasks {
named("build") {
dependsOn(":cogboard-app:test", ":cogboard-webapp:buildImage")
dependsOn(":cogboard-app:test", ":cogboard-webapp:buildImage", ":ssh:buildImage")
}
register("cypressInit", Exec::class) {
setWorkingDir("./functional/cypress-tests")
Expand Down
90 changes: 46 additions & 44 deletions cogboard-app/build.gradle.kts
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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ class CogboardConstants {
const val SCHEDULE_PERIOD = "schedulePeriod"
const val SCHEDULE_PERIOD_DEFAULT = 120L // 120 seconds
const val SCHEDULE_DELAY_DEFAULT = 10L // 10 seconds
const val SSH_TIMEOUT = 5000 // 5000ms -> 5s
const val SSH_HOST = "sshAddress"
const val SSH_PORT = "sshPort"
const val SSH_KEY = "sshKey"
const val SSH_KEY_PASSPHRASE = "sshKeyPassphrase"
const val URL = "url"

const val LOG_REQUEST_TYPE = "logRequestType"
const val LOG_LINES = "logLinesField"
const val LOG_FILE_SIZE = "logFileSizeField"
const val LOG_EXPIRATION_DAYS = "logRecordExpirationField"
const val LOG_PARSER = "logParserField"
const val REQUEST_ID = "requestId"
const val PUBLIC_URL = "publicUrl"
const val USER = "user"
Expand Down Expand Up @@ -78,6 +89,13 @@ class CogboardConstants {
}
}

class ConnectionType {
companion object {
const val SSH = "SSH"
const val HTTP = "HTTP"
}
}

class RequestMethod {
companion object {
const val GET = "get"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class EndpointLoader(
this.put(Props.USER, credentials.getString(Props.USER) ?: "")
this.put(Props.PASSWORD, credentials.getString(Props.PASSWORD) ?: "")
this.put(Props.TOKEN, credentials.getString(Props.TOKEN) ?: "")
this.put(Props.SSH_KEY, credentials.getString(Props.SSH_KEY) ?: "")
this.put(Props.SSH_KEY_PASSPHRASE, credentials.getString(Props.SSH_KEY_PASSPHRASE) ?: "")
}
}
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class CredentialsController : AbstractVerticle() {

private fun JsonObject.filterSensitiveData(): JsonObject {
this.remove(Props.PASSWORD)
this.remove(Props.SSH_KEY)
this.remove(Props.SSH_KEY_PASSPHRASE)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ data class Credential(
val label: String,
val user: String,
val password: String?,
val token: String?
val token: String?,
val sshKey: String?,
val sshKeyPassphrase: String?
)
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)
}
}
Loading