de.otto.edison.navigation.NavBar Java Examples

The following examples show how to use de.otto.edison.navigation.NavBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StateRepositoryUiController.java    From synapse with Apache License 2.0 6 votes vote down vote up
public StateRepositoryUiController(final List<StateRepository<?>> stateRepositories,
                                   final JournalRegistry journals,
                                   final NavBar rightNavBar,
                                   final EdisonStateRepositoryUiProperties properties,
                                   final @Value("${edison.application.management.base-path:internal}") String managementBasePath) {
    this.stateRepositories = uniqueIndex(stateRepositories
            .stream()
            .filter(repo -> !properties.getExcluded().contains(repo.getName()))
            .collect(Collectors.toSet()), StateRepository::getName);
    this.journals = journals;
    this.managementBasePath = managementBasePath;
    this.stateRepositories.forEach((repositoryName, _repository) ->
            rightNavBar.register(navBarItem(
                    15,
                    "State Repository: " + repositoryName,
                    format("/%s/staterepositories/%s", managementBasePath, repositoryName))));
}
 
Example #2
Source File: NavigationConfiguration.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Autowired
public NavigationConfiguration(final NavBar mainNavBar,
                               final TogglzProperties togglzProperties,
                               final EdisonApplicationProperties properties) {
    mainNavBar.register(navBarItem(0, "Home", "/"));
    if (togglzProperties.getConsole().isEnabled()) {
        mainNavBar.register(navBarItem(1, "Feature Toggles", String.format("%s/toggles/console/index", properties.getManagement().getBasePath())));
    }
}
 
Example #3
Source File: NavBarConfigurationTest.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldHaveEmptyMainNavBar() {
    context.register(NavBarConfiguration.class);
    context.refresh();

    final NavBar mainNavBar = context.getBean("mainNavBar", NavBar.class);
    assertThat(mainNavBar.getItems(), hasSize(0));
}
 
Example #4
Source File: NavBarConfigurationTest.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldHaveRightNavBar() {
    TestPropertyValues.of("edison.application.management.base-path=/internal").applyTo(context);
    context.register(NavBarConfiguration.class);
    context.refresh();

    final NavBar rightNavBar = context.getBean("rightNavBar", NavBar.class);
    assertThat(rightNavBar.getItems(), hasSize(1));

    final NavBarItem item = rightNavBar.getItems().get(0);
    assertThat(item.getLink(), is("/internal/status"));
    assertThat(item.getTitle(), is("Status"));
    assertThat(item.getPosition(), is(top()));
}
 
Example #5
Source File: NavBarConfiguration.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Bean
public NavBar rightNavBar(final EdisonApplicationProperties properties) {
    final String href = properties.getManagement().getBasePath() + "/status";
    return navBar(asList(
            navBarItem(top(), "Status", href)
    ));
}
 
Example #6
Source File: LoggersConfiguration.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(prefix = "edison.logging.ui", name = "enabled", matchIfMissing = true)
public LoggersHtmlEndpoint loggersHtmlEndpoint(final LoggersEndpoint loggersEndpoint,
                                               final NavBar rightNavBar,
                                               final EdisonApplicationProperties properties) {
    return new LoggersHtmlEndpoint(loggersEndpoint, rightNavBar, properties);
}
 
Example #7
Source File: LoggersHtmlEndpoint.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
public LoggersHtmlEndpoint(final LoggersEndpoint loggersEndpoint,
                           final NavBar rightNavBar,
                           final EdisonApplicationProperties applicationProperties) {
    this.loggersEndpoint = loggersEndpoint;
    this.applicationProperties = applicationProperties;
    rightNavBar.register(navBarItem(1, "Loggers", String.format("%s/loggers", applicationProperties.getManagement().getBasePath())));
}
 
Example #8
Source File: TogglzConsoleConfiguration.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<?> togglzServlet(final @Value("${edison.application.management.base-path:/internal}") String prefix,
                                                final NavBar rightNavBar) {

    // Register Togglz Console in the right "Admin" navigation bar:
    rightNavBar.register(navBarItem(bottom(), "Feature Toggles", prefix + "/toggles/console"));
    // Register TogglzConsoleServlet:
    return new ServletRegistrationBean<>(new TogglzConsoleServlet(), prefix + TOGGLES_URL_PATTERN);
}
 
Example #9
Source File: NavigationConfiguration.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Autowired
public NavigationConfiguration(final NavBar mainNavBar,
                               final EdisonApplicationProperties  properties) {
    mainNavBar.register(navBarItem(0, "Home", "/"));
    mainNavBar.register(navBarItem(1, "Status", String.format("%s/status", properties.getManagement().getBasePath())));
    mainNavBar.register(navBarItem(2, "Job Overview", String.format("%s/jobs", properties.getManagement().getBasePath())));
    mainNavBar.register(navBarItem(3, "Job Definitions", String.format("%s/jobdefinitions", properties.getManagement().getBasePath())));
}
 
Example #10
Source File: JobDefinitionsController.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Autowired
public JobDefinitionsController(final JobDefinitionService definitionService,
                                final JobMetaService jobMetaService,
                                final NavBar rightNavBar,
                                final EdisonApplicationProperties applicationProperties) {
    this.jobDefinitionService = definitionService;
    this.jobMetaService = jobMetaService;
    this.applicationProperties = applicationProperties;
    jobDefinitionsUri = String.format("%s/jobdefinitions", applicationProperties.getManagement().getBasePath());
    rightNavBar.register(navBarItem(10, "Job Definitions", jobDefinitionsUri));
}
 
Example #11
Source File: JobsController.java    From edison-microservice with Apache License 2.0 5 votes vote down vote up
@Autowired
JobsController(final JobService jobService,
               final JobMetaService jobMetaService,
               final NavBar rightNavBar,
               final EdisonApplicationProperties applicationProperties) {
    this.jobService = jobService;
    this.jobMetaService = jobMetaService;
    this.applicationProperties = applicationProperties;
    rightNavBar.register(navBarItem(10, "Job Overview", applicationProperties.getManagement().getBasePath() + "/jobs"));
}
 
Example #12
Source File: NavigationConfiguration.java    From edison-microservice with Apache License 2.0 4 votes vote down vote up
@Autowired
public NavigationConfiguration(final NavBar mainNavBar,
                               final EdisonApplicationProperties properties) {
    mainNavBar.register(navBarItem(top(), "Status", String.format("%s/status", properties.getManagement().getBasePath())));
}
 
Example #13
Source File: NavigationConfiguration.java    From edison-microservice with Apache License 2.0 4 votes vote down vote up
@Autowired
public NavigationConfiguration(final NavBar mainNavBar,
                               final EdisonApplicationProperties properties) {
    mainNavBar.register(navBarItem(0, "Home", "/"));
    mainNavBar.register(navBarItem(1, "Feature Toggles", format("%s/toggles/console/index", properties.getManagement().getBasePath())));
}
 
Example #14
Source File: NavBarConfiguration.java    From edison-microservice with Apache License 2.0 4 votes vote down vote up
@Bean
public NavBar mainNavBar() {
    return emptyNavBar();
}
 
Example #15
Source File: LoggersAcceptanceTest.java    From edison-microservice with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldHaveLoggersInRightNavBar() {
    final NavBar rightNavBar = ctx.getBean("rightNavBar", NavBar.class);
    assertThat(rightNavBar.getItems().stream().anyMatch(item->item.getTitle().equals("Loggers")), is(true));
}
 
Example #16
Source File: NavigationConfiguration.java    From jlineup with Apache License 2.0 4 votes vote down vote up
@Autowired
public NavigationConfiguration(final NavBar mainNavBar,
                               final EdisonApplicationProperties  properties) {
    mainNavBar.register(navBarItem(0, "Status", String.format("%s/status", properties.getManagement().getBasePath())));
    mainNavBar.register(navBarItem(1, "Reports", String.format("%s/reports", properties.getManagement().getBasePath())));
}
 
Example #17
Source File: StateRepositoryControllerTestConfiguration.java    From synapse with Apache License 2.0 4 votes vote down vote up
@Bean
public NavBar rightNavBar() {
    return emptyNavBar();
}