diff --git a/frontend/src/pages/logviewer/containers/dockerLog.tsx b/frontend/src/pages/logviewer/containers/dockerLog.tsx index 9a087df..1c2c87b 100644 --- a/frontend/src/pages/logviewer/containers/dockerLog.tsx +++ b/frontend/src/pages/logviewer/containers/dockerLog.tsx @@ -1,11 +1,13 @@ import React, { useEffect } from 'react'; import { Label } from 'semantic-ui-react'; import { useGetDockerLogMutation } from '../../../graphql/generated/dist'; +//@ts-ignore +import ScrollToBottom from 'react-scroll-to-bottom'; const DockerLog = () => { //get server logs const [fetchLog, { data, loading, error }] = useGetDockerLogMutation({ - variables: { properties: { minutes: 240, limit: 35 } }, + variables: { properties: { minutes: 240 } }, fetchPolicy: 'network-only' }); @@ -17,21 +19,23 @@ const DockerLog = () => { if (error) return
Error
; return ( -
- {data?.getDockerLog.file?.map((log: any, idx: number) => { - // check if first word is error or failed - const errorWords = ['failed', 'error']; - const isError = new RegExp(errorWords.join('|')).test(log?.message.toLowerCase()); - return ( -
- - {`${log.message}`} -
- ); - })} -
+ +
+ {data?.getDockerLog.file?.map((log: any, idx: number) => { + // check if first word is error or failed + const errorWords = ['failed', 'error']; + const isError = new RegExp(errorWords.join('|')).test(log?.message.toLowerCase()); + return ( +
+ + {`${log.message}`} +
+ ); + })} +
+
); }; diff --git a/frontend/src/pages/logviewer/containers/systemLog.tsx b/frontend/src/pages/logviewer/containers/systemLog.tsx index a1c1cbf..7c3a9e1 100644 --- a/frontend/src/pages/logviewer/containers/systemLog.tsx +++ b/frontend/src/pages/logviewer/containers/systemLog.tsx @@ -1,6 +1,8 @@ import React from 'react'; import { Label } from 'semantic-ui-react'; import { useGetServerLogQuery } from '../../../graphql/generated/dist'; +//@ts-ignore +import ScrollToBottom from 'react-scroll-to-bottom'; const SystemLog = () => { //get server logs @@ -9,7 +11,7 @@ const SystemLog = () => { loading, error } = useGetServerLogQuery({ - variables: { properties: { minutes: 240, limit: 35 } }, + variables: { properties: { minutes: 240 } }, fetchPolicy: 'network-only' }); @@ -17,22 +19,24 @@ const SystemLog = () => { if (error) return
Error
; return ( -
- {getServerLog.file?.map((log: any, idx: number) => { - // check if first word is error or failed - const errorWords = ['failed', 'error']; - const isError = new RegExp(errorWords.join('|')).test(log?.message.toLowerCase()); + +
+ {getServerLog.file?.map((log: any, idx: number) => { + // check if first word is error or failed + const errorWords = ['failed', 'error']; + const isError = new RegExp(errorWords.join('|')).test(log?.message.toLowerCase()); - return ( -
- - {`${log.message}`} -
- ); - })} -
+ return ( +
+ + {`${log.message}`} +
+ ); + })} +
+ ); }; diff --git a/frontend/src/scss/core/_logviewer.scss b/frontend/src/scss/core/_logviewer.scss new file mode 100644 index 0000000..87f7e29 --- /dev/null +++ b/frontend/src/scss/core/_logviewer.scss @@ -0,0 +1,5 @@ +:is(.logContainer) { + max-height: calc(100vh - 130px); + // overflow-y: scroll; + position: relative; +} diff --git a/frontend/src/scss/core/core.scss b/frontend/src/scss/core/core.scss index 3c04fb0..9d5aff3 100644 --- a/frontend/src/scss/core/core.scss +++ b/frontend/src/scss/core/core.scss @@ -23,3 +23,4 @@ @import 'switch'; @import 'map'; @import 'chart'; +@import 'logviewer';