-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactor the result view and components related (#1435)
- Loading branch information
1 parent
6090a3f
commit 0893fb8
Showing
16 changed files
with
217 additions
and
144 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
File renamed without changes.
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,16 @@ | ||
import { Typography } from '@mui/material'; | ||
import { Error } from '@mui/icons-material'; | ||
|
||
type AppErrorMessageProps = { | ||
message: string; | ||
}; | ||
|
||
export function AppErrorMessage(props: AppErrorMessageProps) { | ||
let { message } = props; | ||
return ( | ||
<div style={{ display: 'flex', alignItems: 'center' }}> | ||
<Error /> | ||
<Typography>{message}</Typography> | ||
</div> | ||
); | ||
} |
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,6 @@ | ||
import { LinearProgress } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
export function AppLoadingBar() { | ||
return <LinearProgress sx={{ margin: 5 }} />; | ||
} |
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,59 +1,39 @@ | ||
import { | ||
Button, | ||
FormControl, | ||
InputLabel, | ||
MenuItem, | ||
Select, | ||
Typography, | ||
} from '@mui/material'; | ||
import React, { useState } from 'react'; | ||
import { useNavigate } from 'react-router'; | ||
import { FormControl, MenuItem, Select, Typography } from '@mui/material'; | ||
import React from 'react'; | ||
import { Project } from '../data/Project'; | ||
import { GitHubCommit } from '../data/GitHubCommit'; | ||
|
||
function HashSelector(project: Project) { | ||
const navigate = useNavigate(); | ||
const [selectedHash, setSelectedHash] = useState(project.commitHashes[0]); | ||
export function HashSelector({ project, hash, setHash }: HashSelectorProps) { | ||
return ( | ||
<div> | ||
<> | ||
<Typography align="center" variant="h6"> | ||
Choose a hash to view the results | ||
</Typography> | ||
<br /> | ||
<FormControl | ||
sx={{ display: 'flex', justifyContent: 'center', minWidth: 200 }} | ||
> | ||
<InputLabel id="hash-select-label">Commit Hash</InputLabel> | ||
<Select | ||
labelId="hash-select-label" | ||
id="hash-select" | ||
value={selectedHash} | ||
onChange={(event) => handleHashChange(event.target.value as string)} | ||
value={hash} | ||
onChange={(event) => { | ||
setHash(event.target.value as string); | ||
}} | ||
> | ||
{project.commitHashes.map((hash: string) => ( | ||
<MenuItem key={hash} value={hash}> | ||
{hash} | ||
{project.commits.map((hash: GitHubCommit) => ( | ||
<MenuItem key={hash.commitHash} value={hash.commitHash}> | ||
{hash.commitHash} | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
<br /> | ||
<br /> | ||
<Button | ||
variant="contained" | ||
onClick={() => navigate(toLink(project, selectedHash))} | ||
> | ||
View Results | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
|
||
function handleHashChange(hash: string) { | ||
setSelectedHash(hash); | ||
} | ||
} | ||
|
||
export default HashSelector; | ||
|
||
function toLink(project: Project, hash: string): string { | ||
return '/resultview/' + project.projectName + '/' + hash; | ||
interface HashSelectorProps { | ||
project: Project; | ||
hash: string; | ||
setHash: (hash: string) => void; | ||
} |
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,6 +1,3 @@ | ||
import { AnalyzerStatus } from './AnalyzerStatus'; | ||
|
||
export type GitHubCommit = { | ||
analyzerStatuses: AnalyzerStatus[]; | ||
commitHash: String; | ||
commitHash: string; | ||
}; |
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
Oops, something went wrong.