-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
feat(settings): basic log api and ui #337
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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,14 +1,72 @@ | ||
import React from 'react'; | ||
import useSWR from 'swr'; | ||
import Error from '../../../pages/_error'; | ||
import LoadingSpinner from '../../Common/LoadingSpinner'; | ||
import { | ||
FormattedDate, | ||
FormattedTime, | ||
useIntl, | ||
defineMessages, | ||
} from 'react-intl'; | ||
|
||
// We will localize this file when the complete version is released. | ||
const messages = defineMessages({ | ||
logs: 'Logs', | ||
logsDescription: | ||
'You can access your logs directly in stdout (container logs) or looking in /app/config/logs/overseerr.logs', | ||
}); | ||
|
||
const SettingsLogs: React.FC = () => { | ||
const intl = useIntl(); | ||
const { data, error } = useSWR('/api/v1/settings/logs'); | ||
|
||
if (error) { | ||
return <Error statusCode={500} />; | ||
} | ||
|
||
if (!data && !error) { | ||
return <LoadingSpinner />; | ||
} | ||
|
||
if (!data) { | ||
return <LoadingSpinner />; | ||
} | ||
|
||
return ( | ||
<> | ||
<div className="leading-loose text-gray-300 text-sm"> | ||
Logs page is still being built. For now, you can access your logs | ||
directly in <code>stdout</code> (container logs) or looking in{' '} | ||
<code>/app/config/logs/overseerr.logs</code> | ||
<div> | ||
<h3 className="text-lg leading-6 font-medium text-gray-200"> | ||
{intl.formatMessage(messages.logs)} | ||
</h3> | ||
<p className="text-sm leading-5 text-gray-500"> | ||
{intl.formatMessage(messages.logsDescription)} | ||
</p> | ||
|
||
<div className="mt-4 text-sm"> | ||
{data?.map((row, index) => ( | ||
<div key={`log-list-${index}`} className="space-x-2 text-gray-300"> | ||
<span className="inline"> | ||
<FormattedDate | ||
value={row.timestamp} | ||
year="numeric" | ||
month="short" | ||
day="2-digit" | ||
/> | ||
| ||
<FormattedTime | ||
value={row.timestamp} | ||
hour="numeric" | ||
minute="numeric" | ||
second="numeric" | ||
hour12={false} | ||
/> | ||
</span> | ||
<span className="inline"> | ||
[{row.level}][{row.label}]: | ||
</span> | ||
<span className="inline">{row.message}</span> | ||
</div> | ||
))} | ||
</div> | ||
Comment on lines
+44
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can maybe re-use the table component here to make this look nice? Check out how i use it in the RequestList component. |
||
</div> | ||
</> | ||
); | ||
|
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.
We will want to have the same
<code>
tags in here like we did in the temporary message. If you only put the tags in here by themselves though, they will be just rendered out in the string.You can see how this is done in the
RequestList
component. I apply tags in there.