From 3973bf045156f484bc53ca0b896b940eea1ee044 Mon Sep 17 00:00:00 2001 From: Chan Ger Hean Date: Mon, 8 Mar 2021 20:27:39 +0800 Subject: [PATCH] [#1468] Dashboard loading empty if base URL is given (#1469) Repositories with more than 19 different types of files will crash, which can be traced from line 448 of `v_summary.js`. Bug is caused by a function not being copied properly in #1421, leading to an undefined function call. Let's copy the function over properly. --- frontend/src/static/js/utils/ramp_colour_generator.js | 5 ++++- frontend/src/static/js/v_summary.js | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/static/js/utils/ramp_colour_generator.js b/frontend/src/static/js/utils/ramp_colour_generator.js index bf62142a26..9299053633 100644 --- a/frontend/src/static/js/utils/ramp_colour_generator.js +++ b/frontend/src/static/js/utils/ramp_colour_generator.js @@ -1,7 +1,10 @@ +// eslint-disable-next-line new-cap +const randomGenerator = new Math.seedrandom('Seeded Random Generator'); + function getRandomHex() { const maxHexColorValue = 16777214; // excludes #000000 and #FFFFFF as they are reserved - return `#${Math.round(this.randomGenerator() * maxHexColorValue + 1).toString(16).padStart(6, '0')}`; + return `#${Math.round(randomGenerator() * maxHexColorValue + 1).toString(16).padStart(6, '0')}`; } function rgb2lab(rgb) { diff --git a/frontend/src/static/js/v_summary.js b/frontend/src/static/js/v_summary.js index 69d089ef03..2e17efd324 100644 --- a/frontend/src/static/js/v_summary.js +++ b/frontend/src/static/js/v_summary.js @@ -28,8 +28,6 @@ window.vSummary = { maxDate: '', fileTypeColors: {}, isSafariBrowser: /.*Version.*Safari.*/.test(navigator.userAgent), - // eslint-disable-next-line new-cap - randomGenerator: new Math.seedrandom('Seeded Random Generator'), filterGroupSelectionWatcherFlag: false, }; },