webui: display status change in the timeline

Michael Muré created

Change summary

webui/src/bug/SetStatus.js     | 37 ++++++++++++++++++++++++++++++++++++
webui/src/bug/Timeline.js      |  3 ++
webui/src/bug/TimelineQuery.js |  3 ++
3 files changed, 43 insertions(+)

Detailed changes

webui/src/bug/SetStatus.js 🔗

@@ -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)

webui/src/bug/Timeline.js 🔗

@@ -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)

webui/src/bug/TimelineQuery.js 🔗

@@ -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}) => (