Skip to content

Commit

Permalink
NestedViewsSearch made optional
Browse files Browse the repository at this point in the history
enabeled by default, can be disabled by existence of ~/.nestedViewsSearch
  • Loading branch information
judovana committed Jan 22, 2022
1 parent 45037f2 commit b907365
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
import hudson.search.Search;
import hudson.search.SearchFactory;
import hudson.search.SearchableModelObject;
import jenkins.model.Jenkins;

import javax.inject.Inject;

import java.io.File;

@Extension
public class NestedViewsSearchFactory extends SearchFactory {

@Override
public Search createFor(final SearchableModelObject owner) {
return new NestedViewsSearch();
String userHomeDir = System.getProperty("user.home");
if (userHomeDir == null) {
return new NestedViewsSearch();
} else {
File nestedViewsFile = new File(userHomeDir, ".nestedViewsSearch");
if (nestedViewsFile.exists()) {
return new Search();
} else {
return new NestedViewsSearch();
}
}
}
}

0 comments on commit b907365

Please sign in to comment.