CR fixes
authorDaniel Kos <daniel.kos@contractors.roche.com>
Wed, 2 Jan 2019 07:56:28 +0000 (08:56 +0100)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Wed, 2 Jan 2019 07:56:28 +0000 (08:56 +0100)
Feature #14348

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/components/data-explorer/data-explorer.tsx
src/views-components/data-explorer/renderers.tsx

index d2b161edc24e9ba68e0a97c32de02f5d663efa36..878f47ff769b026741c7203b78c77bdb9317e156 100644 (file)
@@ -122,7 +122,7 @@ export const DataExplorer = withStyles(styles)(
                             component="div" /> : <Button
                                 variant="text"
                                 size="medium"
-                                onClick={() => this.loadMore(this.props.page)}
+                                onClick={this.loadMore}
                                 >Load more</Button>}
                     </Grid>
                 </Toolbar>
@@ -137,8 +137,8 @@ export const DataExplorer = withStyles(styles)(
             this.props.onChangeRowsPerPage(parseInt(event.target.value, 10));
         }
 
-        loadMore = (page: number) => {
-            this.props.onLoadMore(page + 1);
+        loadMore = () => {
+            this.props.onLoadMore(this.props.page + 1);
         }
 
         renderContextMenuTrigger = (item: T) =>
index d52dcab1b9e31fa7a4978b2e65d4794904e829bb..6905e96084083861c25d4842599039721d772c0c 100644 (file)
@@ -233,9 +233,10 @@ const clusterColors = [
 ];
 
 export const ResourceCluster = (props: { uuid: string }) => {
-    const p = props.uuid.indexOf('-');
-    const clusterId = p >= 5 ? props.uuid.substr(0, p) : '';
-    const ci = p >= 5 ? (props.uuid.charCodeAt(0) + props.uuid.charCodeAt(1)) % clusterColors.length : 0;
+    const CLUSTER_ID_LENGTH = 5;
+    const pos = props.uuid.indexOf('-');
+    const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substr(0, pos) : '';
+    const ci = pos >= CLUSTER_ID_LENGTH ? (props.uuid.charCodeAt(0) + props.uuid.charCodeAt(1)) % clusterColors.length : 0;
     return <Typography>
         <div style={{
             backgroundColor: clusterColors[ci][0],