diff --git a/ui/gulpfile.esm.js b/ui/gulpfile.esm.js index 8b0b3ab89d..6af6beb95c 100644 --- a/ui/gulpfile.esm.js +++ b/ui/gulpfile.esm.js @@ -59,7 +59,7 @@ function updateBrowserList() { } task('gen:browserlist', () => { - return src('public/checkBrowser.js') + return src('public/compat.js') .pipe(updateBrowserList()) .pipe(dest('public', { overwrite: true })) }) diff --git a/ui/public/checkBrowser.js b/ui/public/compat.js similarity index 82% rename from ui/public/checkBrowser.js rename to ui/public/compat.js index 786e2c6604..ba54664c7a 100644 --- a/ui/public/checkBrowser.js +++ b/ui/public/compat.js @@ -40,8 +40,25 @@ function checkBrowser() { d.getElementsByTagName('a')[0].onclick = function () { d.getElementsByTagName('div')[0].style.top = '-60px' } - document.body.prepend(d) + document.body.insertBefore(d, document.body.firstChild) } } checkBrowser() + +// Dealing with compatibility issues manually for special cases + +// Object.entries +// see https://github.com/pingcap-incubator/tidb-dashboard/issues/770 +// polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries +if (!Object.entries) { + Object.entries = function( obj ){ + var ownProps = Object.keys( obj ), + i = ownProps.length, + resArray = new Array(i); // preallocate the Array + while (i--) + resArray[i] = [ownProps[i], obj[ownProps[i]]]; + + return resArray; + }; +} diff --git a/ui/public/diagnoseReport.html b/ui/public/diagnoseReport.html index 6114d4ae8a..aed243ffda 100644 --- a/ui/public/diagnoseReport.html +++ b/ui/public/diagnoseReport.html @@ -10,7 +10,7 @@ - +
diff --git a/ui/public/index.html b/ui/public/index.html index 08a29e991d..750c0f265c 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -91,7 +91,7 @@ - +