This is an automated email from the ASF dual-hosted git repository.
arafat2198 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 692b229216 HDDS-12084. Persist currently selected UI type (new/old)
between refreshes (#7705)
692b229216 is described below
commit 692b22921635d81c8e8e8bd6168d3d56b3a8136f
Author: Abhishek Pal <[email protected]>
AuthorDate: Mon Jan 27 21:46:39 2025 +0530
HDDS-12084. Persist currently selected UI type (new/old) between refreshes
(#7705)
---
.../src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx
index 0b7607f297..3f1327f1d6 100644
---
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx
+++
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx
@@ -48,7 +48,8 @@ class App extends React.Component<Record<string, object>,
IAppState> {
super(props);
this.state = {
collapsed: false,
- enableOldUI: false
+ // Set the state from data persisted in current session storage, else
default to new UI
+ enableOldUI: JSON.parse(sessionStorage.getItem('enableOldUI') ?? 'false')
};
}
@@ -78,9 +79,15 @@ class App extends React.Component<Record<string, object>,
IAppState> {
<AntDSwitch
unCheckedChildren={<div style={{ paddingRight: '2px'
}}>Old UI</div>}
checkedChildren={<div style={{ paddingLeft: '2px' }}>New
UI</div>}
+ checked={this.state.enableOldUI}
onChange={(checked: boolean) => {
this.setState({
enableOldUI: checked
+ }, () => {
+ // This is to persist the state of the UI between
refreshes.
+ // While using session storage to store state is an
anti-pattern, provided the size of the data stored in this case
+ // and the plan to deprecate UI v1 (old UI) in the
future - this is the simplest approach/fix for persisting state.
+ sessionStorage.setItem('enableOldUI',
JSON.stringify(checked));
});
}} />
</span>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]