Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added preferences to toggle on/off sidebar #48

Conversation

prahaladhchandrahasan
Copy link
Collaborator

Implemented a feature which solves the issue:
Issue link: hawtio/hawtio#2657

src/app/page/page.component.ts Outdated Show resolved Hide resolved
@@ -24,7 +24,12 @@ namespace Page {
this.previousWidth = this.$window.innerWidth;
});
});
this.$rootScope.$on(CLOSE_MAIN_NAV_EVENT, () => this.isNavOpen = false);
var curr_state = window.localStorage.getItem('current_state');
if (curr_state === "ON")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always use { and } for if. I don't think we omit these in other places.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use Enum for the values it can be switch statement.

src/app/preferences/preferences.config.ts Outdated Show resolved Hide resolved
src/app/preferences/preferences.module.ts Outdated Show resolved Hide resolved
@prahaladhchandrahasan
Copy link
Collaborator Author

I have incorporated all the requested changes in the commit aa344f9. Please check it and provide further feedback :)

src/app/page/page.component.ts Outdated Show resolved Hide resolved
src/app/page/page.component.ts Outdated Show resolved Hide resolved
return this.$window.localStorage.getItem('defaultVerticalNavState');

}
setDefaultVerticalnavstate(defaultVerticalNavState): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what about using enum for the state variable?

@@ -24,7 +24,14 @@ namespace Page {
this.previousWidth = this.$window.innerWidth;
});
});
this.$rootScope.$on(CLOSE_MAIN_NAV_EVENT, () => this.isNavOpen = false);
let curr_state = window.localStorage.getItem('defaultVerticalNavState');
if (curr_state === "show") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls use enum I suggested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and regarding where the VerticalNavState enum type should be defined, there are a few options. But I think the simplest is just put it in the page.component.ts and then from the general-preferences.service.ts reference it.

@tadayosi
Copy link
Member

And I'd prefer the commits to be only one. Please force push to the pr branch instead of adding a commit on top of the original.

@prahaladhchandrahasan prahaladhchandrahasan force-pushed the issue-#2657-vertical-nav-preference branch 3 times, most recently from 28e8b44 to 3ae6952 Compare February 23, 2022 18:09
Copy link
Member

@tadayosi tadayosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final round of change requests.

getDefaultVerticalNavState(): string {
if (this.$window.localStorage.getItem('defaultVerticalNavState') !== null) {
return this.$window.localStorage.getItem('defaultVerticalNavState');
} else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more last change:

} else {
    ...
}

Copy link
Member

@tadayosi tadayosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@tadayosi tadayosi merged commit 1ada45e into hawtio:main Feb 24, 2022
@prahaladhchandrahasan prahaladhchandrahasan deleted the issue-#2657-vertical-nav-preference branch February 24, 2022 06:39
@prahaladhchandrahasan prahaladhchandrahasan restored the issue-#2657-vertical-nav-preference branch February 24, 2022 06:41
@prahaladhchandrahasan prahaladhchandrahasan deleted the issue-#2657-vertical-nav-preference branch February 24, 2022 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants