From a8f3e1781475f74b417c2db77ed1b977c31ef74b Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 11 May 2024 04:29:00 +0300 Subject: [PATCH 01/20] added config history --- src/dashboard/Data/Browser/Browser.scss | 7 +++++ src/dashboard/Data/Config/Config.react.js | 25 +++++++++++++++++ .../Data/Config/ConfigDialog.react.js | 28 +++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/src/dashboard/Data/Browser/Browser.scss b/src/dashboard/Data/Browser/Browser.scss index ba6b92c463..a813d58742 100644 --- a/src/dashboard/Data/Browser/Browser.scss +++ b/src/dashboard/Data/Browser/Browser.scss @@ -141,6 +141,13 @@ body:global(.expanded) { } } +.history { + display: flex; + flex-wrap: wrap; + padding: .5rem; + gap: .5rem; +} + .notificationMessage, .notificationError { @include animation('fade-in 0.2s ease-out'); position: absolute; diff --git a/src/dashboard/Data/Config/Config.react.js b/src/dashboard/Data/Config/Config.react.js index 148cc2042f..c2da880079 100644 --- a/src/dashboard/Data/Config/Config.react.js +++ b/src/dashboard/Data/Config/Config.react.js @@ -252,6 +252,18 @@ class Config extends TableView { .then( () => { this.setState({ modalOpen: false }); + const configHistory = localStorage.getItem('configHistory') + if(!configHistory) { + localStorage.setItem('configHistory', JSON.stringify({ + [name]: [value] + })); + } else { + const history = JSON.parse(configHistory) + localStorage.setItem('configHistory', JSON.stringify({ + ...history, + [name]: !history[name] ? [value] : [value, ...history[name]].slice(0, 5) + })); + } }, () => { // Catch the error @@ -263,6 +275,19 @@ class Config extends TableView { this.props.config.dispatch(ActionTypes.DELETE, { param: name }).then(() => { this.setState({ showDeleteParameterDialog: false }); }); + const configHistory = localStorage.getItem('configHistory') + if(configHistory) { + const history = JSON.parse(configHistory); + if(history[name]) { + delete history[name] + if(Object.keys(history).length === 0) { + localStorage.removeItem('configHistory'); + } + else { + localStorage.setItem('configHistory', JSON.stringify(history)); + } + } + } } createParameter() { diff --git a/src/dashboard/Data/Config/ConfigDialog.react.js b/src/dashboard/Data/Config/ConfigDialog.react.js index 711b66efe0..f799448df6 100644 --- a/src/dashboard/Data/Config/ConfigDialog.react.js +++ b/src/dashboard/Data/Config/ConfigDialog.react.js @@ -17,6 +17,7 @@ import Parse from 'parse'; import React from 'react'; import TextInput from 'components/TextInput/TextInput.react'; import Toggle from 'components/Toggle/Toggle.react'; +import Button from 'components/Button/Button.react'; import validateNumeric from 'lib/validateNumeric'; import styles from 'dashboard/Data/Browser/Browser.scss'; import semver from 'semver/preload.js'; @@ -190,6 +191,9 @@ export default class ConfigDialog extends React.Component { ))} ); + const configHistory = localStorage.getItem('configHistory') + const history = configHistory && JSON.parse(configHistory)[this.state.name] + return ( ) : null } + { + !newParam && history && + + } + input={ +
+ {history.slice(1).map((value, i) => +
+ } + className={styles.addColumnToggleWrapper} + /> + }
); } From c8fc200d3314ee3c5b82a1c8027b0e5cf2b81583 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 11 May 2024 17:28:51 +0300 Subject: [PATCH 02/20] fix styling, broken types --- src/dashboard/Data/Browser/Browser.scss | 15 +++++++++++++-- src/dashboard/Data/Config/Config.react.js | 2 +- src/dashboard/Data/Config/ConfigDialog.react.js | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/dashboard/Data/Browser/Browser.scss b/src/dashboard/Data/Browser/Browser.scss index a813d58742..2eaa0e2fca 100644 --- a/src/dashboard/Data/Browser/Browser.scss +++ b/src/dashboard/Data/Browser/Browser.scss @@ -142,12 +142,23 @@ body:global(.expanded) { } .history { - display: flex; - flex-wrap: wrap; + max-width: 100%; + max-height: 150px; padding: .5rem; + overflow-x: hidden; + overflow-y: auto; + display: flex; + flex-direction: column; gap: .5rem; + + span { + display: block; + overflow: hidden; + text-overflow: ellipsis; + } } + .notificationMessage, .notificationError { @include animation('fade-in 0.2s ease-out'); position: absolute; diff --git a/src/dashboard/Data/Config/Config.react.js b/src/dashboard/Data/Config/Config.react.js index c2da880079..29816feffd 100644 --- a/src/dashboard/Data/Config/Config.react.js +++ b/src/dashboard/Data/Config/Config.react.js @@ -261,7 +261,7 @@ class Config extends TableView { const history = JSON.parse(configHistory) localStorage.setItem('configHistory', JSON.stringify({ ...history, - [name]: !history[name] ? [value] : [value, ...history[name]].slice(0, 5) + [name]: !history[name] ? [value] : [value, ...history[name]].slice(0, 10) })); } }, diff --git a/src/dashboard/Data/Config/ConfigDialog.react.js b/src/dashboard/Data/Config/ConfigDialog.react.js index f799448df6..2dc2eeb63e 100644 --- a/src/dashboard/Data/Config/ConfigDialog.react.js +++ b/src/dashboard/Data/Config/ConfigDialog.react.js @@ -272,8 +272,8 @@ export default class ConfigDialog extends React.Component { + -