-
Notifications
You must be signed in to change notification settings - Fork 39
Dashboard frontend for Log Detective API in packit #526
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 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 hidden or 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 hidden or 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
128 changes: 128 additions & 0 deletions
128
frontend/src/components/logdetective/LogDetectiveGroup.tsx
This file contains hidden or 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,128 @@ | ||
| // Copyright Contributors to the Packit project. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { | ||
| Card, | ||
| CardBody, | ||
| Content, | ||
| DescriptionList, | ||
| DescriptionListDescription, | ||
| DescriptionListGroup, | ||
| DescriptionListTerm, | ||
| List, | ||
| ListItem, | ||
| PageSection, | ||
| Title, | ||
| } from "@patternfly/react-core"; | ||
|
|
||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { Link } from "@tanstack/react-router"; | ||
| import { logDetectiveGroupQueryOptions } from "../../queries/logdetective/logDetectiveGroupQuery"; | ||
| import { Route as LogDetectiveGroupRoute } from "../../routes/jobs_/log-detective.group.$id"; | ||
| import { ErrorConnection } from "../errors/ErrorConnection"; | ||
| import { Preloader } from "../shared/Preloader"; | ||
| import { Timestamp } from "../shared/Timestamp"; | ||
| import { TriggerLink, TriggerSuffix } from "../trigger/TriggerLink"; | ||
|
|
||
| export const LogDetectiveGroup = () => { | ||
| const { id } = LogDetectiveGroupRoute.useParams(); | ||
|
|
||
| const { data, isError, isLoading } = useQuery( | ||
| logDetectiveGroupQueryOptions({ id }), | ||
| ); | ||
|
|
||
| // If backend API is down | ||
| if (isError) { | ||
| return <ErrorConnection />; | ||
| } | ||
|
|
||
| if (data && "error" in data) { | ||
| return ( | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| <CardBody> | ||
| <Title headingLevel="h1" size="lg"> | ||
| Not Found. | ||
| </Title> | ||
| </CardBody> | ||
| </Card> | ||
| </PageSection> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Content> | ||
| <Content component="h1">Log Detective Group</Content> | ||
| <strong> | ||
| {data ? ( | ||
| <TriggerLink trigger={data}> | ||
| <TriggerSuffix trigger={data} /> | ||
| </TriggerLink> | ||
| ) : ( | ||
| <></> | ||
| )} | ||
| </strong> | ||
| </Content> | ||
| </PageSection> | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| {!data ? ( | ||
| isLoading || data === undefined ? ( | ||
| <Preloader /> | ||
| ) : ( | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| <CardBody> | ||
| <Title headingLevel="h1" size="lg"> | ||
| Not Found. | ||
| </Title> | ||
| </CardBody> | ||
| </Card> | ||
| </PageSection> | ||
| ) | ||
| ) : ( | ||
| <CardBody> | ||
| <DescriptionList | ||
| columnModifier={{ | ||
| default: "1Col", | ||
| sm: "2Col", | ||
| }} | ||
| > | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Submitted Time</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <Timestamp stamp={data.submitted_time} verbose={true} /> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm> | ||
| Log Detective Targets | ||
| </DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <List isPlain> | ||
| {data.log_detective_target_ids.map((targetId) => ( | ||
| <ListItem key={targetId}> | ||
| <Link to={`/jobs/log-detective/${targetId}`}> | ||
| #{targetId} | ||
| </Link> | ||
| </ListItem> | ||
| ))} | ||
| </List> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Run IDs</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| {data.run_ids.join(", ")} | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| </DescriptionList> | ||
| </CardBody> | ||
| )} | ||
| </Card> | ||
| </PageSection> | ||
| </> | ||
| ); | ||
| }; |
132 changes: 132 additions & 0 deletions
132
frontend/src/components/logdetective/LogDetectiveResult.tsx
This file contains hidden or 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,132 @@ | ||
| // Copyright Contributors to the Packit project. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { | ||
| Card, | ||
| CardBody, | ||
| CodeBlock, | ||
| CodeBlockCode, | ||
| Content, | ||
| DescriptionList, | ||
| DescriptionListDescription, | ||
| DescriptionListGroup, | ||
| DescriptionListTerm, | ||
| PageSection, | ||
| Title, | ||
| } from "@patternfly/react-core"; | ||
|
|
||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { logDetectiveResultQueryOptions } from "../../queries/logdetective/logDetectiveResultQuery"; | ||
| import { Route as LogDetectiveRoute } from "../../routes/jobs_/log-detective.$id"; | ||
| import { ErrorConnection } from "../errors/ErrorConnection"; | ||
| import { Preloader } from "../shared/Preloader"; | ||
| import { Timestamp } from "../shared/Timestamp"; | ||
| import { StatusLabel } from "../statusLabels/StatusLabel"; | ||
|
|
||
| export const LogDetectiveResult = () => { | ||
| const { id } = LogDetectiveRoute.useParams(); | ||
|
|
||
| const { data, isError, isLoading } = useQuery( | ||
| logDetectiveResultQueryOptions({ id }), | ||
| ); | ||
|
|
||
| // If backend API is down | ||
| if (isError) { | ||
| return <ErrorConnection />; | ||
| } | ||
|
|
||
| if (data && "error" in data) { | ||
| return ( | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| <CardBody> | ||
| <Title headingLevel="h1" size="lg"> | ||
| Not Found. | ||
| </Title> | ||
| </CardBody> | ||
| </Card> | ||
| </PageSection> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Content> | ||
| <Content component="h1">Log Detective Results</Content> | ||
| </Content> | ||
| </PageSection> | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| {!data ? ( | ||
| isLoading || data === undefined ? ( | ||
| <Preloader /> | ||
| ) : ( | ||
| <PageSection hasBodyWrapper={false}> | ||
| <Card> | ||
| <CardBody> | ||
| <Title headingLevel="h1" size="lg"> | ||
| Not Found. | ||
| </Title> | ||
| </CardBody> | ||
| </Card> | ||
| </PageSection> | ||
| ) | ||
| ) : ( | ||
| <> | ||
| <CardBody> | ||
| <DescriptionList | ||
| columnModifier={{ | ||
| default: "1Col", | ||
| sm: "2Col", | ||
| }} | ||
| > | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Packit ID</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| {data.packit_id} | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Analysis ID</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| {data.analysis_id} | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Status</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <StatusLabel status={data.status} /> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Submitted Time</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <Timestamp stamp={data.submitted_time} verbose={true} /> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| </DescriptionList> | ||
| </CardBody> | ||
| {data.log_detective_response?.explanation ? ( | ||
| <CardBody> | ||
| <DescriptionList> | ||
| <DescriptionListGroup> | ||
| <DescriptionListTerm>Explanation</DescriptionListTerm> | ||
| <DescriptionListDescription> | ||
| <CodeBlock> | ||
| <CodeBlockCode> | ||
| {data.log_detective_response.explanation.text} | ||
jpodivin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </CodeBlockCode> | ||
| </CodeBlock> | ||
| </DescriptionListDescription> | ||
| </DescriptionListGroup> | ||
| </DescriptionList> | ||
| </CardBody> | ||
| ) : null} | ||
| </> | ||
| )} | ||
| </Card> | ||
| </PageSection> | ||
| </> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
it could be beneficial to be able to go back to the koji/copr build view from here, but we can leave it as follow-up