webui: Add Label gql fragment

Amine Hilaly created

Change summary

webui/packed_assets.go       |  4 ++--
webui/src/Label.js           | 12 ++++++++++++
webui/src/bug/Bug.js         |  8 ++------
webui/src/bug/LabelChange.js | 15 +++------------
webui/src/list/BugRow.js     |  8 ++------
5 files changed, 21 insertions(+), 26 deletions(-)

Detailed changes

webui/packed_assets.go 🔗

@@ -21,14 +21,14 @@ var WebUIAssets = func() http.FileSystem {
 	fs := vfsgen۰FS{
 		"/": &vfsgen۰DirInfo{
 			name:    "/",
-			modTime: time.Date(2019, 5, 22, 18, 37, 30, 890029596, time.UTC),
+			modTime: time.Date(2019, 5, 22, 18, 40, 14, 550155033, time.UTC),
 		},
 		"/asset-manifest.json": &vfsgen۰CompressedFileInfo{
 			name:             "asset-manifest.json",
-			modTime:          time.Date(2019, 5, 22, 18, 37, 30, 890848047, time.UTC),
+			modTime:          time.Date(2019, 5, 22, 18, 40, 14, 551035575, time.UTC),
 			uncompressedSize: 869,
 

webui/src/Label.js 🔗

@@ -1,4 +1,5 @@
 import React from 'react';
+import gql from 'graphql-tag';
 import { makeStyles } from '@material-ui/styles';
 import {
   getContrastRatio,
@@ -46,4 +47,15 @@ function Label({ label }) {
   );
 }
 
+Label.fragment = gql`
+  fragment Label on Label {
+    name
+    color {
+      R
+      G
+      B
+    }
+  }
+`;
+
 export default Label;

webui/src/bug/Bug.js 🔗

@@ -91,12 +91,7 @@ Bug.fragment = gql`
     status
     title
     labels {
-      name
-      color {
-        R
-        G
-        B
-      }
+      ...Label
     }
     createdAt
     author {
@@ -105,6 +100,7 @@ Bug.fragment = gql`
       displayName
     }
   }
+  ${Label.fragment}
 `;
 
 export default Bug;

webui/src/bug/LabelChange.js 🔗

@@ -50,23 +50,14 @@ LabelChange.fragment = gql`
         displayName
       }
       added {
-        name
-        color {
-          R
-          G
-          B
-        }
+        ...Label
       }
       removed {
-        name
-        color {
-          R
-          G
-          B
-        }
+        ...Label
       }
     }
   }
+  ${Label.fragment}
 `;
 
 export default LabelChange;

webui/src/list/BugRow.js 🔗

@@ -95,18 +95,14 @@ BugRow.fragment = gql`
     status
     createdAt
     labels {
-      name
-      color {
-        R
-        G
-        B
-      }
+      ...Label
     }
     author {
       name
       displayName
     }
   }
+  ${Label.fragment}
 `;
 
 export default BugRow;