-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logs Panel: Display error message when logs fail to load (#1079)
* feat(LogsPanelScene): display error message when logs fail to load * Update src/Components/ServiceScene/LogsPanelError.tsx Co-authored-by: Sven Grossmann <[email protected]> * feat(LogsPanelScene): collapse log volume on error * fix(LogsPanelScene): respect collapsed status of logs volume --------- Co-authored-by: Sven Grossmann <[email protected]>
- Loading branch information
Showing
4 changed files
with
70 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { GrotError } from 'Components/GrotError'; | ||
import { Button } from '@grafana/ui'; | ||
|
||
interface Props { | ||
clearFilters(): void; | ||
error: string; | ||
} | ||
|
||
export const LogsPanelError = ({ clearFilters, error }: Props) => { | ||
return ( | ||
<GrotError> | ||
<div> | ||
<p> | ||
<strong>No logs found.</strong> | ||
</p> | ||
<p>{getMessageFromError(error)}</p> | ||
<Button variant="secondary" onClick={clearFilters}> | ||
Clear filters | ||
</Button> | ||
</div> | ||
</GrotError> | ||
); | ||
}; | ||
|
||
function getMessageFromError(error: string) { | ||
if (error.includes('parse error')) { | ||
return 'Logs could not be retrieved due to invalid filter parameters. Please review your filters and try again.'; | ||
} | ||
|
||
return 'Logs could not be retrieved. Please review your filters or try a different time range.'; | ||
} |
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