英文:
How to have a tiny highlighted icon on my button in a web page to show new updates are present?
问题
我目前制作了一个Java Web应用程序。它有一个服务器(MyServer)和客户端(网页)。客户端向MyServer发出请求以获取一些信息。现在,MyServer会向Confluence API服务器发出请求,以从我们Confluence空间中的最新Confluence页面获取信息。
当我们在客户端网页上点击“What's New”按钮时,Confluence空间中的最新页面会显示在“What's New”网络小部件中。用户可以点击“What's New”按钮,最新的Confluence页面将显示出来。
现在我想做的是:
- 每当有新的更新(无论是同一Confluence页面的更改还是创建了新的Confluence页面)时,“What's New”按钮上会显示一个小亮点图标(请参见所附的示例所需图片-另外,就像在任何聊天应用程序中一样{如WhatsApp,FbMessenger等,当收到新消息时})。
- 一旦我的特定用户看到了新的更新,那个小亮点图标就会消失,适用于该特定用户。
- 对于首次登录的所有用户,如果他们还没有打开新的更新,那么小亮点图标应该显示出来。如果用户1打开它-小亮点图标就会消失,而“What's New”按钮应恢复为普通的非亮点按钮。但是,如果用户2还没有打开它,这个小亮点图标应该保持显示。
- 然后,如果我们在Confluence页面中进行新的更改,并且用户1尚未看到此新的更新-那么用户1的小亮点图标应该再次显示。
我应该如何着手处理?感谢您的帮助。
英文:
I have currently made a Java web application. It has a server(MyServer) and the client side(the webpage). The client makes request to MyServer to get some information. MyServer now makes request to Confluence API server to get information from our latest Confluence page in our Confluence space.
When we click on "What's New" button (in our client -website) - the latest page in our Confluence space shows in the What's New web widget. The user can click on the What's New button and the most latest page from the Confluence page shows up.
What I would like to do now is-
- Every time a new update is made, (either changes in the same Confluence page/or new Confluence page is created), a little highlighted icon shows on my "What's New" button. (Please find the sample required picture attached - also, like in any chat applications {Whats app, FbMessanger etc when a new message is received}).
- Once my particular user sees that new update that tiny highlighted icon goes away for that particular user.
- The tiny highlighted icon should show for all the logged-in users for the first time if they have not opened the new update yet. If user1 opens it - the tiny highlighted icon should go away for that user1 (and the "What's New" button should become a normal non-higlighted button) But, this tiny highlighted icon should stay for user2 if they have not opened it.
- Then if we make a new change in our Confluence page and user1 has not seen this new update yet - the tiny highlighted icon should show again for user1.
答案1
得分: 1
关于解决你的问题的通用解决方案,
-
你需要实现 WebSockets 来从后端获取实时聊天类似的通知。
-
你可以编写 JavaScript 代码来定位一个元素,例如在这种情况下是你的通知图标。
假设它的 ID 是 #notifIcon隐藏操作
document.getElementbyId('notifIcon').style.display = 'none'
显示操作
document.getElementbyId('notifIcon').style.display = 'block'
-
为了保持用户特定,你可以从数据库模式中获取数据并相应地进行更新。
-
再次通过 WebSockets 更新你的数据。
英文:
About the generic solution to your problems,
-
You need to implement websockets to get the realtime chat like notification from back-end
-
You can write a JavaScript code to target an element, in this case your notification icon.
Consider the it's ID is #notifIconto hide
document.getElementbyId('notifIcon').style.display = 'none'
to show
document.getElementbyId('notifIcon').style.display = 'block'
-
To keep it user specific, you can take data from database schema and update accordingly
-
Again update your data with websockets
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论