闲置通知未显示-Vaadin 14

发布于 2025-02-09 02:59:11 字数 1353 浏览 2 评论 0原文

我正在尝试使用add-on https://vaadin.com/directory/directory/component/空闲通知用于会话管理。我想在给定时间中使用用户在应用程序中不活动时显示通知。

我有主要布局:

@PWA(name = "App", shortName = "App", enableInstallPrompt = false)
@Theme(themeFolder = "app")
@CssImport(value = "./styles/example.css", themeFor = "vaadin-grid")
@PreserveOnRefresh
@Push
public class MainView extends AppLayout implements AfterNavigationObserver {

    public MainView() {
         ...
         
         IdleNotification idleNotification = new IdleNotification();
         idleNotification.setSecondsBeforeNotification(90);
         idleNotification.setMessage("Your session will expire in " +  
                                   IdleNotification.MessageFormatting.SECS_TO_TIMEOUT  
         + " seconds.");
         idleNotification.addExtendSessionButton("Extend session");
         idleNotification.addRedirectButton("Logout now", "logout");
         idleNotification.addCloseButton();
         idleNotification.setExtendSessionOnOutsideClick(false);

         UI.getCurrent().add(idleNotification);
    }
}

不幸的通知未显示。 中的设置参数。

vaadin.closeIdleSessions=false
vaadin.heartbeatInterval=true
vaadin.pushMode=true

我还尝试了应用程序

I'm trying to use an add-on https://vaadin.com/directory/component/idle-notification for Session Management. I would like to show notification when user is inactive in the application for a given time.

I have Main Layout:

@PWA(name = "App", shortName = "App", enableInstallPrompt = false)
@Theme(themeFolder = "app")
@CssImport(value = "./styles/example.css", themeFor = "vaadin-grid")
@PreserveOnRefresh
@Push
public class MainView extends AppLayout implements AfterNavigationObserver {

    public MainView() {
         ...
         
         IdleNotification idleNotification = new IdleNotification();
         idleNotification.setSecondsBeforeNotification(90);
         idleNotification.setMessage("Your session will expire in " +  
                                   IdleNotification.MessageFormatting.SECS_TO_TIMEOUT  
         + " seconds.");
         idleNotification.addExtendSessionButton("Extend session");
         idleNotification.addRedirectButton("Logout now", "logout");
         idleNotification.addCloseButton();
         idleNotification.setExtendSessionOnOutsideClick(false);

         UI.getCurrent().add(idleNotification);
    }
}

Unfortunatelly notification not showing.
I also tried set parameters in application.properties as:

vaadin.closeIdleSessions=false
vaadin.heartbeatInterval=true
vaadin.pushMode=true

but that does not solve the problem

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌上青苔 2025-02-16 02:59:11

问题是设置vaadin.whitelisted packages = com.my.app,我将com.vaadin.com pontontfactory添加到vaadin.whitelisted-capkages and Works。

The problem was setting vaadin.whitelisted-packages = com.my.app, I added com.vaadin.componentfactory to vaadin.whitelisted-packages and work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文