}
this.handleQueryChange(true);
const footer = document.getElementById('footer');
- footer && footer.classList.add('page-footer-with-sidebar');
+ if (footer) {
+ footer.classList.add('page-footer-with-sidebar');
+ }
}
componentDidUpdate(prevProps: Props) {
componentWillUnmount() {
this.mounted = false;
const footer = document.getElementById('footer');
- footer && footer.classList.remove('page-footer-with-sidebar');
+ if (footer) {
+ footer.classList.remove('page-footer-with-sidebar');
+ }
}
getView = () => this.state.query.view || 'overall';
getSort = () => this.state.query.sort || 'name';
- isFiltered = () => Object.values(this.state.query).some(value => value !== undefined);
+ isFiltered = (query = this.state.query) =>
+ Object.values(query).some(value => value !== undefined);
stopLoading = () => {
if (this.mounted) {
const savedOptionsSet = savedOptions.sort || savedOptions.view || savedOptions.visualization;
// if there is no filter, but there are saved preferences in the localStorage
- if (initialMount && !this.isFiltered() && savedOptionsSet) {
+ if (initialMount && !this.isFiltered(query) && savedOptionsSet) {
this.context.router.replace({ pathname: this.props.location.pathname, query: savedOptions });
} else {
this.fetchProjects(query);
return open("/organizations/" + organization + "/projects", ProjectsPage.class);
}
+ public ProjectsPage openProjectsWithQuery(String query) {
+ return open("/projects?" + query, ProjectsPage.class);
+ }
+
public IssuesPage openIssues() {
return open("/issues", IssuesPage.class);
}
page.shouldHaveTotal(1);
page.searchProject("sample").shouldHaveTotal(0);
}
+
+ @Test
+ public void should_open_permalink() {
+ String user = tester.users().generate().getLogin();
+ Navigation nav = tester.openBrowser().logIn().submitCredentials(user);
+
+ // make a search, so its parameters saved to local storage
+ nav.openProjects().changePerspective("Leak");
+
+ // change a page
+ nav.openHome();
+
+ // open a permalink to a particular visualization, it must be kept
+ nav.openProjectsWithQuery("view=visualizations&visualization=coverage");
+ assertThat(url()).contains("view=visualizations&visualization=coverage");
+ }
}