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

Fix/review 414 #418

Closed
wants to merge 46 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
291be47
Created LogViewerWidget
mprzypasniak99 Sep 25, 2021
af06dd9
Added LogViewer to WidgetIndex
mprzypasniak99 Sep 25, 2021
cd3a269
Added WireMock for LogViewer
mprzypasniak99 Sep 25, 2021
ba65c41
Remove ALL log level, use INFO as default
przemekxa Oct 16, 2021
954f9af
Added placeholder method for processing logs before sending to front-end
mprzypasniak99 Oct 17, 2021
e28ceab
Merge branch 'enhancement/log-viewer-widget' into feature/381
mprzypasniak99 Oct 17, 2021
783fb34
Changed to using strategies [#381]
mprzypasniak99 Oct 22, 2021
e6f39b0
Merge remote-tracking branch 'origin/feature/381' into feature/381
mprzypasniak99 Oct 22, 2021
75fff1f
Strategy adjustments [#381]
mprzypasniak99 Oct 22, 2021
de0aea0
Added tests and Strategies implementations [#381]
mprzypasniak99 Oct 22, 2021
1dbb996
Deleted SSHWidget - replaced by strategies [#381]
mprzypasniak99 Oct 22, 2021
23a2b6b
Changes after code review - problem with tests to solve
Borrubasz Oct 23, 2021
3239153
Add ssh to endpoints dialog fields #412
clmrv Oct 23, 2021
26a173e
Tests fixed
mprzypasniak99 Oct 23, 2021
737c288
Add SSH Key field to Credentials
przemekxa Oct 24, 2021
7d2f0b2
Modify credential test
przemekxa Oct 24, 2021
5729dae
Change SSH Key regex
przemekxa Oct 24, 2021
b5a967e
Add OpenSSH docker image
przemekxa Oct 27, 2021
8acac96
Deleted SSH tests to move them to different branch
mprzypasniak99 Oct 27, 2021
989ee33
Merge remote-tracking branch 'origin/feature/381' into feature/381
mprzypasniak99 Oct 27, 2021
9b2ffcf
Code review changes [#381]
mprzypasniak99 Oct 27, 2021
604f8ca
Merge branch 'feature/412' into feature/376-381-412
clmrv Oct 31, 2021
743c4be
Merge remote-tracking branch 'origin/feature/381' into feature/376-38…
clmrv Oct 31, 2021
82945f2
Add ssh to credentials tests, Turn off LogViewer backend
clmrv Nov 2, 2021
7178432
Change text fo file
przemekxa Nov 2, 2021
c7f3fd5
Merge branch 'feature/412' into feature/376-381-412
przemekxa Nov 2, 2021
622953c
Add SSH Key passphrase
przemekxa Nov 2, 2021
48008a9
Merge branch 'feature/412' into feature/376-381-412
przemekxa Nov 2, 2021
c467182
Move template logs to backend
clmrv Nov 2, 2021
7a341e7
Adjustments for communication with front-end
mprzypasniak99 Nov 2, 2021
d96cf4a
Merge remote-tracking branch 'origin/feature/381' into feature/376-38…
clmrv Nov 3, 2021
a1c7982
Merge fixes
clmrv Nov 3, 2021
7eae0b5
Attempt to load logs from server
clmrv Nov 3, 2021
52170d2
Successfully sending parsed data to front-end
mprzypasniak99 Nov 7, 2021
6e4e608
Data sent to front-end but not shown
mprzypasniak99 Nov 7, 2021
9650fc8
Fix log structure typo
clmrv Nov 7, 2021
0d8f46f
Fixed sending blank log
mprzypasniak99 Nov 7, 2021
86da1ef
Add logLevels config file
clmrv Nov 8, 2021
fd39ed4
Temporarily remove SSH Key tests
przemekxa Nov 8, 2021
1bb0f1a
Remove obsolete event constant #417
clmrv Nov 12, 2021
00c4452
Remove obsolete log generator #417
clmrv Nov 12, 2021
608d790
Code review fixes - deleted unnecesarry comments
mprzypasniak99 Nov 12, 2021
833796e
WTTech code review fixes
mprzypasniak99 Nov 13, 2021
6d49c96
Merge pull request #417 from wttech/feature/376-381-412
TheTerabit Nov 14, 2021
6d86258
WTTech code review fixes
mprzypasniak99 Nov 13, 2021
4685fd7
Merge branch 'fix/review-414' of github.com:wttech/cogboard into fix/…
mprzypasniak99 Nov 14, 2021
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
Prev Previous commit
Next Next commit
Move template logs to backend
  • Loading branch information
clmrv committed Nov 2, 2021
commit c46718272fc4b75ecd13af75fbceed76540a60df
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import com.cognifide.cogboard.widget.BaseWidget
import io.vertx.core.Vertx
import io.vertx.core.eventbus.MessageConsumer
import io.vertx.core.json.JsonObject
import io.vertx.core.json.JsonArray

class LogViewerWidget(
vertx: Vertx,
@@ -39,12 +40,51 @@ class LogViewerWidget(
// return super.stop()
// }

private val logs = createTemplateLogs(20)
override fun updateState() {
// if (address.isNotBlank()) {
// connectionStrategy.sendRequest(address, config)
// } else {
// sendConfigurationError("Endpoint URL is blank")
// }

send(JsonObject().put("logs", logs))
}

private fun createTemplateLogs(n: Int): JsonArray {
val types = arrayOf("info", "error", "debug", "success", "warn")
val logs = JsonArray()

for (i in 1..n) {
logs.add(createTemplateLog(types[i % types.size]))
}
return logs
}

private fun createTemplateLog(type: String): JsonObject {
return JsonObject("""
{
"type": "$type",
"date": "2021-04-22 14:08:37",
"additionalData": {
"ID": "123456",
"Type": "sys",
"IP address": "127.0.0.1",
"Port": "27017"
},
"variableData": {
"template": ["Provider", "Message"],
"header": [
"mongodb.log",
"Expected corresponding JSX closing tag for <GridSchemaa>."
],
"description": [
"provider desc",
"SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6)"
]
}
}
""")
}

// private fun handleResponse(response: Message<*>) {
Original file line number Diff line number Diff line change
@@ -12,28 +12,8 @@ import {
import getGridTemplate from './helpers';

const testLogTemplate = ['Provider', 'Message'];
const testData = {
date: '2021-04-22 14:08:37',
additionalData: {
ID: '123456',
Type: 'sys',
'IP address': '127.0.0.1',
Port: '27017'
},
variableData: {
template: testLogTemplate,
header: [
'mongodb.log',
'Expected corresponding JSX closing tag for <GridSchemaa>.'
],
description: [
'provider desc',
'SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6) SyntaxError: /Users/celmer/Documents/js/cogboard/cogboard-webapp/src/components/widgets/types/LogViewerWidget/LogList/index.js: Expected corresponding JSX closing tag for <GridSchemaa>. (21:6)'
]
}
};

export default function LogList() {
export default function LogList({ children }) {
const theme = useTheme();
const VariableLogListHeader = () => (
<VariableGridSchema template={getGridTemplate(testLogTemplate)}>
@@ -54,61 +34,14 @@ export default function LogList() {
</Header>

<LogsWrapper>
{/* static presentation */}
<LogEntry
type="info"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="warn"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="error"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="success"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry type="error" date={testData.date} />
<LogEntry
type="info"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="warn"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="error"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
<LogEntry
type="success"
date={testData.date}
additionalData={testData.additionalData}
variableData={testData.variableData}
/>
{children.map(log => (
<LogEntry
type={log.type}
date={log.date}
additionalData={log.additionalData}
variableData={log.variableData}
/>
))}
</LogsWrapper>
</Container>
);
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import React from 'react';
import React, { useEffect } from 'react';
import { shallowEqual, useSelector } from 'react-redux';
import { number, string } from 'prop-types';
import Toolbar from './Toolbar';
import LogList from './LogList';
import { Container } from './styled';

const LogViewerWidget = () => (
<Container>
<Toolbar />
<LogList />
</Container>
);
const LogViewerWidget = ({ id }) => {
const widgetData = useSelector(
({ widgets }) => widgets.widgetsById[id],
shallowEqual
);
useEffect(() => console.log(widgetData), [widgetData]);
return (
<Container>
<Toolbar />
<LogList>{widgetData.content.logs}</LogList>
</Container>
);
};

LogViewerWidget.propTypes = {
endpoint: string,