webui: display status change in the timeline

This commit is contained in:
Michael Muré 2018-08-15 22:20:50 +02:00
parent 17aa40505b
commit 11b792608f
No known key found for this signature in database
GPG Key ID: A4457C029293126F
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,37 @@
import { withStyles } from '@material-ui/core/styles'
import gql from 'graphql-tag'
import React from 'react'
import Author from '../Author'
import Date from '../Date'
const styles = theme => ({
main: {
...theme.typography.body2
},
})
const SetStatus = ({op, classes}) => {
return (
<div className={classes.main}>
<Author author={op.author} bold />
<span> {op.status.toLowerCase()} this</span>
<Date date={op.date} />
</div>
)
}
SetStatus.fragment = gql`
fragment SetStatus on Operation {
... on SetStatusOperation {
date
author {
name
email
}
status
}
}
`
export default withStyles(styles)(SetStatus)

View File

@ -2,6 +2,7 @@ import { withStyles } from '@material-ui/core/styles'
import React from 'react'
import LabelChange from './LabelChange'
import Message from './Message'
import SetStatus from './SetStatus'
import SetTitle from './SetTitle'
const styles = theme => ({
@ -35,6 +36,8 @@ class Timeline extends React.Component {
return <LabelChange key={index} op={op}/>
case 'SetTitleOperation':
return <SetTitle key={index} op={op}/>
case 'SetStatusOperation':
return <SetStatus key={index} op={op}/>
default:
console.log('unsupported operation type ' + op.__typename)

View File

@ -3,6 +3,7 @@ import gql from 'graphql-tag'
import React from 'react'
import { Query } from 'react-apollo'
import LabelChange from './LabelChange'
import SetStatus from './SetStatus'
import SetTitle from './SetTitle'
import Timeline from './Timeline'
import Message from './Message'
@ -17,6 +18,7 @@ const QUERY = gql`
...Comment
...LabelChange
...SetTitle
...SetStatus
}
pageInfo {
hasNextPage
@ -30,6 +32,7 @@ const QUERY = gql`
${Message.commentFragment}
${LabelChange.fragment}
${SetTitle.fragment}
${SetStatus.fragment}
`
const TimelineQuery = ({id}) => (