From 78e2108164e6fa7bdf446caaacfe8cae79da4cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 20 Jul 2018 18:44:51 +0200 Subject: [PATCH] feat(ui): allow configuring default number of alerts to display per group --- ui/src/App.js | 5 +- .../Grid/AlertGrid/AlertGroup/index.js | 66 +++++++++++-------- ui/src/Components/Grid/AlertGrid/index.js | 7 +- ui/src/Components/Grid/index.js | 8 ++- .../Configuration/AlertGroupConfiguration.js | 61 +++++++++++++++++ .../FetchConfiguration.js} | 36 +++++----- .../InputRange.css} | 0 .../InputRange.scss} | 0 .../MainModal/Configuration/index.js | 19 ++++++ ui/src/Stores/Settings.js | 15 +++++ 10 files changed, 164 insertions(+), 53 deletions(-) create mode 100644 ui/src/Components/MainModal/Configuration/AlertGroupConfiguration.js rename ui/src/Components/MainModal/{Configuration.js => Configuration/FetchConfiguration.js} (57%) rename ui/src/Components/MainModal/{Configuration.css => Configuration/InputRange.css} (100%) rename ui/src/Components/MainModal/{Configuration.scss => Configuration/InputRange.scss} (100%) create mode 100644 ui/src/Components/MainModal/Configuration/index.js diff --git a/ui/src/App.js b/ui/src/App.js index 2d1be1474..677c2ae2d 100644 --- a/ui/src/App.js +++ b/ui/src/App.js @@ -52,7 +52,10 @@ class App extends Component { settingsStore={this.settingsStore} /> - + initialAlertsToRender) by dividing it into 5 clicks. -// Don't use step lower than 5, too much clicking if we have a group of 9: -// * we'll show initially 5 -// * step would be 1 -// * 4 extra clicks to see the entire group -// but ensure that step wouldn't push us above totalSize -// With 9 alerts and rendering 5 initially we want to show extra 9 after one -// click, and when user clicks showLess we want to go back to 5. -function getStepSize(totalSize) { - return Math.min( - Math.max(Math.round((totalSize - initialAlertsToRender) / 5), 5), - totalSize - initialAlertsToRender - ); -} - const LoadButton = ({ icon, action }) => { return (