@@ -24,25 +24,24 @@ import Card from '../../components/Card/Card';
2424import CardIcon from '../../components/Card/CardIcon' ;
2525import CardBody from '../../components/Card/CardBody' ;
2626import CardHeader , { CardHeaderColor } from '../../components/Card/CardHeader' ;
27- import CardFooter from '../../components/Card/CardFooter' ;
2827import Button from '../../components/CustomButtons/Button' ;
28+ import CustomTabs from '../../components/CustomTabs/CustomTabs' ;
29+ import CommitDataTable from './components/CommitDataTable' ;
2930import Diff from './components/Diff' ;
31+ import StepsTimeline from './components/StepsTimeline' ;
3032import Attestation from './components/Attestation' ;
3133import AttestationInfo from './components/AttestationInfo' ;
3234import RejectionInfo from './components/RejectionInfo' ;
3335import Reject from './components/Reject' ;
34- import Table from '@material-ui/core/Table' ;
35- import TableBody from '@material-ui/core/TableBody' ;
36- import TableHead from '@material-ui/core/TableHead' ;
37- import TableRow from '@material-ui/core/TableRow' ;
38- import TableCell from '@material-ui/core/TableCell' ;
3936import { getPush , authorisePush , rejectPush , cancelPush } from '../../services/git-push' ;
4037import type { ServiceResult } from '../../services/errors' ;
41- import { CheckCircle , Visibility , Cancel , Block } from '@material-ui/icons' ;
38+ import { CheckCircle , Visibility , Cancel , Block , List as ListIcon } from '@material-ui/icons' ;
39+ import CodeIcon from '@material-ui/icons/Code' ;
40+ import TimelineIcon from '@material-ui/icons/Timeline' ;
4241import Snackbar from '@material-ui/core/Snackbar' ;
4342import { PushActionView } from '../../types' ;
4443import { trimPrefixRefsHeads , trimTrailingDotGit } from '../../../db/helper' ;
45- import { generateEmailLink , getGitProvider } from '../../utils' ;
44+ import { getGitProvider } from '../../utils' ;
4645
4746const Dashboard : React . FC = ( ) => {
4847 const { id } = useParams < { id : string } > ( ) ;
@@ -115,6 +114,8 @@ const Dashboard: React.FC = () => {
115114 if ( isError ) throw new Error ( message || 'Something went wrong ...' ) ;
116115 if ( ! push ) return < div > No push data found</ div > ;
117116
117+ const errorCount = push . steps ?. filter ( ( step ) => step . error ) . length ?? 0 ;
118+
118119 let headerData : { title : string ; color : CardHeaderColor } = {
119120 title : 'Pending' ,
120121 color : 'warning' ,
@@ -249,44 +250,29 @@ const Dashboard: React.FC = () => {
249250 </ GridContainer >
250251 </ CardBody >
251252 </ Card >
252- < Card >
253- < CardHeader color = { headerData . color } stats icon >
254- < h3 > { headerData . title } </ h3 >
255- </ CardHeader >
256- < CardBody >
257- < Table >
258- < TableHead >
259- < TableRow >
260- < TableCell > Timestamp</ TableCell >
261- < TableCell > Committer</ TableCell >
262- < TableCell > Author</ TableCell >
263- < TableCell > Message</ TableCell >
264- </ TableRow >
265- </ TableHead >
266- < TableBody >
267- { push . commitData ?. map ( ( c ) => (
268- < TableRow key = { c . commitTimestamp } >
269- < TableCell >
270- { moment . unix ( Number ( c . commitTimestamp || 0 ) ) . toString ( ) }
271- </ TableCell >
272- < TableCell > { generateEmailLink ( c . committer , c . committerEmail ) } </ TableCell >
273- < TableCell > { generateEmailLink ( c . author , c . authorEmail ) } </ TableCell >
274- < TableCell > { c . message } </ TableCell >
275- </ TableRow >
276- ) ) }
277- </ TableBody >
278- </ Table >
279- </ CardBody >
280- </ Card >
281253 </ GridItem >
282254 < GridItem xs = { 12 } sm = { 12 } md = { 12 } >
283- < Card >
284- < CardHeader />
285- < CardBody >
286- < Diff diff = { push . diff . content } />
287- </ CardBody >
288- < CardFooter />
289- </ Card >
255+ < CustomTabs
256+ headerColor = 'primary'
257+ tabs = { [
258+ {
259+ tabName : 'Commits' ,
260+ tabIcon : ListIcon ,
261+ tabContent : < CommitDataTable commitData = { push . commitData || [ ] } /> ,
262+ } ,
263+ {
264+ tabName : 'Changes' ,
265+ tabIcon : CodeIcon ,
266+ tabContent : < Diff diff = { push . diff ?. content || '' } /> ,
267+ } ,
268+ {
269+ tabName : 'Steps' ,
270+ tabIcon : TimelineIcon ,
271+ tabContent : < StepsTimeline steps = { push . steps ?? [ ] } /> ,
272+ badge : errorCount > 0 ? errorCount : undefined ,
273+ } ,
274+ ] }
275+ />
290276 </ GridItem >
291277 </ GridContainer >
292278 </ div >
0 commit comments