diff --git a/webui/src/App.js b/webui/src/App.js
index ddab069180ceb9d6e3247791f1d751eb3c8d2c4b..9cb3cdc799779de5c7790e14e3fb085d76756f68 100644
--- a/webui/src/App.js
+++ b/webui/src/App.js
@@ -6,7 +6,7 @@ import CssBaseline from "@material-ui/core/CssBaseline";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
-import Bug from "./Bug";
+import BugPage from "./BugPage";
const Home = () =>
Home
;
@@ -22,7 +22,7 @@ const App = ({ location }) => (
-
+
);
diff --git a/webui/src/Bug.js b/webui/src/Bug.js
index de61bc8c6cc433a538f309360a5a810ef3bffbb7..28558a1388056356725873d73683ef6dcb915791 100644
--- a/webui/src/Bug.js
+++ b/webui/src/Bug.js
@@ -1,105 +1,38 @@
import React from "react";
-import { Query } from "react-apollo";
import gql from "graphql-tag";
import { withStyles } from "@material-ui/core/styles";
-import Avatar from "@material-ui/core/Avatar";
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import CardHeader from "@material-ui/core/CardHeader";
-import Chip from "@material-ui/core/Chip";
-import CircularProgress from "@material-ui/core/CircularProgress";
-import Typography from "@material-ui/core/Typography";
+import Comment from "./Comment";
+import BugSummary from "./BugSummary";
const styles = theme => ({
main: {
maxWidth: 600,
margin: "auto",
marginTop: theme.spacing.unit * 4
- },
- labelList: {
- display: "flex",
- flexWrap: "wrap",
- marginTop: theme.spacing.unit
- },
- label: {
- marginRight: theme.spacing.unit
- },
- summary: {
- marginBottom: theme.spacing.unit * 2
- },
- comment: {
- marginBottom: theme.spacing.unit
}
});
-const QUERY = gql`
- query GetBug($id: BugID!) {
- bug(id: $id) {
- id
- title
- status
- labels
- comments {
- message
- author {
- name
- email
- }
- }
- }
- }
-`;
-
-const Comment = withStyles(styles)(({ comment, classes }) => (
-
-
- {comment.author.name[0].toUpperCase()}
-
- }
- title={comment.author.name}
- subheader={comment.author.email}
- />
-
- {comment.message}
-
-
-));
-
-const BugView = withStyles(styles)(({ bug, classes }) => (
+const Bug = ({ bug, classes }) => (
-
-
-
- {bug.title}
-
-
- #{bug.id.slice(0, 8)} • {bug.status.toUpperCase()}
-
-
- {bug.labels.map(label => (
-
- ))}
-
-
-
+
{bug.comments.map((comment, index) => (
))}
-));
-
-const Bug = ({ match }) => (
-
- {({ loading, error, data }) => {
- if (loading) return ;
- if (error) return Error.
;
- return ;
- }}
-
);
-export default Bug;
+Bug.fragment = gql`
+ fragment Bug on Bug {
+ ...BugSummary
+ comments {
+ ...Comment
+ }
+ }
+
+ ${BugSummary.fragment}
+ ${Comment.fragment}
+`;
+
+export default withStyles(styles)(Bug);
diff --git a/webui/src/BugPage.js b/webui/src/BugPage.js
new file mode 100644
index 0000000000000000000000000000000000000000..ec0872eb76252a40ba8bf10bbabadfd82aa27ff1
--- /dev/null
+++ b/webui/src/BugPage.js
@@ -0,0 +1,29 @@
+import React from "react";
+import { Query } from "react-apollo";
+import gql from "graphql-tag";
+
+import CircularProgress from "@material-ui/core/CircularProgress";
+
+import Bug from "./Bug";
+
+const QUERY = gql`
+ query GetBug($id: BugID!) {
+ bug(id: $id) {
+ ...Bug
+ }
+ }
+
+ ${Bug.fragment}
+`;
+
+const BugPage = ({ match }) => (
+
+ {({ loading, error, data }) => {
+ if (loading) return ;
+ if (error) return Error.
;
+ return ;
+ }}
+
+);
+
+export default BugPage;
diff --git a/webui/src/BugSummary.js b/webui/src/BugSummary.js
new file mode 100644
index 0000000000000000000000000000000000000000..461fe2d00de577eaf97dcada55a2409da5b3d976
--- /dev/null
+++ b/webui/src/BugSummary.js
@@ -0,0 +1,51 @@
+import React from "react";
+import gql from "graphql-tag";
+import { withStyles } from "@material-ui/core/styles";
+
+import Card from "@material-ui/core/Card";
+import CardContent from "@material-ui/core/CardContent";
+import Chip from "@material-ui/core/Chip";
+import Typography from "@material-ui/core/Typography";
+
+const styles = theme => ({
+ labelList: {
+ display: "flex",
+ flexWrap: "wrap",
+ marginTop: theme.spacing.unit
+ },
+ label: {
+ marginRight: theme.spacing.unit
+ },
+ summary: {
+ marginBottom: theme.spacing.unit * 2
+ }
+});
+
+const BugSummary = ({ bug, classes }) => (
+
+
+
+ {bug.title}
+
+
+ #{bug.id.slice(0, 8)} • {bug.status.toUpperCase()}
+
+
+ {bug.labels.map(label => (
+
+ ))}
+
+
+
+);
+
+BugSummary.fragment = gql`
+ fragment BugSummary on Bug {
+ id
+ title
+ status
+ labels
+ }
+`;
+
+export default withStyles(styles)(BugSummary);
diff --git a/webui/src/Comment.js b/webui/src/Comment.js
new file mode 100644
index 0000000000000000000000000000000000000000..a4fd1b4002c63b0e4a20f20de66257943295b4a6
--- /dev/null
+++ b/webui/src/Comment.js
@@ -0,0 +1,44 @@
+import React from "react";
+import gql from "graphql-tag";
+import { withStyles } from "@material-ui/core/styles";
+
+import Avatar from "@material-ui/core/Avatar";
+import Card from "@material-ui/core/Card";
+import CardContent from "@material-ui/core/CardContent";
+import CardHeader from "@material-ui/core/CardHeader";
+import Typography from "@material-ui/core/Typography";
+
+const styles = theme => ({
+ comment: {
+ marginBottom: theme.spacing.unit
+ }
+});
+
+const Comment = withStyles(styles)(({ comment, classes }) => (
+
+
+ {comment.author.name[0].toUpperCase()}
+
+ }
+ title={comment.author.name}
+ subheader={comment.author.email}
+ />
+
+ {comment.message}
+
+
+));
+
+Comment.fragment = gql`
+ fragment Comment on Comment {
+ message
+ author {
+ name
+ email
+ }
+ }
+`;
+
+export default withStyles(styles)(Comment);