mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 02:01:43 +03:00
webui: display title changes in the timeline
This commit is contained in:
parent
a474093774
commit
17aa40505b
43
webui/src/bug/SetTitle.js
Normal file
43
webui/src/bug/SetTitle.js
Normal file
@ -0,0 +1,43 @@
|
||||
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
|
||||
},
|
||||
bold: {
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
})
|
||||
|
||||
const SetTitle = ({op, classes}) => {
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
<Author author={op.author} bold />
|
||||
<span> changed the title from </span>
|
||||
<span className={classes.bold}>{op.was}</span>
|
||||
<span> to </span>
|
||||
<span className={classes.bold}>{op.title}</span>
|
||||
<Date date={op.date} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
SetTitle.fragment = gql`
|
||||
fragment SetTitle on Operation {
|
||||
... on SetTitleOperation {
|
||||
date
|
||||
author {
|
||||
name
|
||||
email
|
||||
}
|
||||
title
|
||||
was
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export default withStyles(styles)(SetTitle)
|
@ -2,6 +2,7 @@ import { withStyles } from '@material-ui/core/styles'
|
||||
import React from 'react'
|
||||
import LabelChange from './LabelChange'
|
||||
import Message from './Message'
|
||||
import SetTitle from './SetTitle'
|
||||
|
||||
const styles = theme => ({
|
||||
main: {
|
||||
@ -32,6 +33,8 @@ class Timeline extends React.Component {
|
||||
return <Message key={index} op={op}/>
|
||||
case 'LabelChangeOperation':
|
||||
return <LabelChange key={index} op={op}/>
|
||||
case 'SetTitleOperation':
|
||||
return <SetTitle key={index} op={op}/>
|
||||
|
||||
default:
|
||||
console.log('unsupported operation type ' + op.__typename)
|
||||
|
@ -3,6 +3,7 @@ import gql from 'graphql-tag'
|
||||
import React from 'react'
|
||||
import { Query } from 'react-apollo'
|
||||
import LabelChange from './LabelChange'
|
||||
import SetTitle from './SetTitle'
|
||||
import Timeline from './Timeline'
|
||||
import Message from './Message'
|
||||
|
||||
@ -15,6 +16,7 @@ const QUERY = gql`
|
||||
...Create
|
||||
...Comment
|
||||
...LabelChange
|
||||
...SetTitle
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
@ -27,6 +29,7 @@ const QUERY = gql`
|
||||
${Message.createFragment}
|
||||
${Message.commentFragment}
|
||||
${LabelChange.fragment}
|
||||
${SetTitle.fragment}
|
||||
`
|
||||
|
||||
const TimelineQuery = ({id}) => (
|
||||
|
Loading…
Reference in New Issue
Block a user