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

Suggested Improvement #49

Open
QNENet opened this issue May 27, 2021 · 2 comments
Open

Suggested Improvement #49

QNENet opened this issue May 27, 2021 · 2 comments
Labels
demo enhancement New feature or request karaf

Comments

@QNENet
Copy link

QNENet commented May 27, 2021

The code in MainLayout at present is

    protected void onAttach(AttachEvent attachEvent) {
        RouteRegistry registry = attachEvent.getUI().getInternals().getRouter()
                .getRegistry();

        UI ui = attachEvent.getUI();
        fillSideBar(attachEvent.getUI());
        routesListener = registry
                .addRoutesChangeListener(event -> ui.access(() -> {
                    fillSideBar(ui);
                    if (!isCurrentRouteExists(ui)) {
                        ui.navigate(DeregisteredRouteView.class,
                                ui.getInternals().getActiveViewLocation()
                                        .getPath());
                    }
                }));

    }

This results in a rather untidy view if the remnant of a previous view remain in the address bar.

The suggestion is to provide a direct navigate to the MainView for all remnants.

I have tried the following but it did not work for me.

    protected void onAttach(AttachEvent attachEvent) {
        RouteRegistry registry = attachEvent.getUI().getInternals().getRouter()
                .getRegistry();

        UI ui = attachEvent.getUI();
        fillSideBar(attachEvent.getUI());
        routesListener = registry
                .addRoutesChangeListener(event -> ui.access(() -> {
                    fillSideBar(ui);
                    if (!isCurrentRouteExists(ui)) {
                        ui.navigate(MainView.class);
                    }
                }));

    }

@QNENet
Copy link
Author

QNENet commented May 27, 2021

As the result of using 20.0.0.rc1 to fix system fail on stop of a bundle the ugliness of the process is more predominate now when menu items are removed. The current process would confuse users.

Please advise if this issue should be raised elsewhere, but it may be specific to Karaf version only.

@mstahv
Copy link
Member

mstahv commented May 28, 2021

Yup, this is just related to this demo. May modifying the Route annotation in DeregisteredView to @Route(value = "unknown", layout = MainLayout.class) would be enough? Then the message would be shown in the "main layout".

@pleku pleku added demo enhancement New feature or request karaf labels Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo enhancement New feature or request karaf
Projects
None yet
Development

No branches or pull requests

3 participants