From 6b598f34cdab793228c1ad0d94ecc3a9f85718b1 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 4 Apr 2018 19:00:28 +0300 Subject: [PATCH 1/3] scrollbar: fix 'legendScrollbar.destroy is not a function' error --- public/app/plugins/panel/graph/legend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/legend.ts b/public/app/plugins/panel/graph/legend.ts index 1952f7241e7..c4ff5b31355 100644 --- a/public/app/plugins/panel/graph/legend.ts +++ b/public/app/plugins/panel/graph/legend.ts @@ -19,7 +19,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { scope.$on('$destroy', function() { if (legendScrollbar) { - legendScrollbar.destroy(); + legendScrollbar.dispose(); } }); From 4df4249aeadf16247350685eb92ec64f875f56b6 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 4 Apr 2018 19:21:17 +0300 Subject: [PATCH 2/3] scrollbar: fix dashboard width bug --- public/app/core/components/scroll/scroll.ts | 12 ++++++++++-- public/sass/components/_scrollbar.scss | 7 +------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public/app/core/components/scroll/scroll.ts b/public/app/core/components/scroll/scroll.ts index ad8b4ed3d8e..0eb1c68ab71 100644 --- a/public/app/core/components/scroll/scroll.ts +++ b/public/app/core/components/scroll/scroll.ts @@ -27,14 +27,17 @@ export function geminiScrollbar() { $(scrollBarHTML).appendTo(scrollRoot); elem.addClass(scrollerClass); - let scrollbar = baron({ + let scrollParams = { root: scrollRoot[0], scroller: scroller[0], bar: '.baron__bar', barOnCls: '_scrollbar', scrollingCls: '_scrolling', track: '.baron__track', - }); + direction: 'v', + }; + + let scrollbar = baron(scrollParams); let lastPos = 0; @@ -57,6 +60,11 @@ export function geminiScrollbar() { scope ); + appEvents.on('toggle-sidemenu', evt => { + // force updating dashboard width + scrollbar.scroll(); + }); + scope.$on('$routeChangeSuccess', () => { lastPos = 0; elem[0].scrollTop = 0; diff --git a/public/sass/components/_scrollbar.scss b/public/sass/components/_scrollbar.scss index 776c85d96b5..7fb8ac6608c 100644 --- a/public/sass/components/_scrollbar.scss +++ b/public/sass/components/_scrollbar.scss @@ -196,13 +196,8 @@ } // Fix for side menu on mobile devices -.sidemenu-open.sidemenu-open--xs { - .main-view.baron { - min-width: 0%; - } -} .main-view.baron { - min-width: 99%; + min-width: unset; } .baron__clipper { From 175937a679393080d0f4276aa8a0090a44ce14c6 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 4 Apr 2018 19:26:29 +0300 Subject: [PATCH 3/3] scrollbar: remove perfect-scrollbar and add baron to package list --- package.json | 1 - yarn.lock | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 724bbffb6fa..e3c0db170b6 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,6 @@ "moment": "^2.18.1", "mousetrap": "^1.6.0", "mousetrap-global-bind": "^1.1.0", - "perfect-scrollbar": "^1.2.0", "prop-types": "^15.6.0", "react": "^16.2.0", "react-dom": "^16.2.0", diff --git a/yarn.lock b/yarn.lock index 2de60f03c27..1cc9ccc869c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1162,6 +1162,10 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +baron@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/baron/-/baron-3.0.3.tgz#0f0a08a567062882e130a0ecfd41a46d52103f4a" + base64-arraybuffer@0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz#73926771923b5a19747ad666aa5cd4bf9c6e9ce8" @@ -7503,10 +7507,6 @@ pend@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" -perfect-scrollbar@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/perfect-scrollbar/-/perfect-scrollbar-1.2.0.tgz#ad23a2529c17f4535f21d1486f8bc3046e31a9d2" - performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5"