Removed users loaded server side in chat

and added a spinner
This commit is contained in:
Rohan Sircar 2020-06-03 13:48:21 +05:30
parent 858b6ce035
commit dc015254ef
2 changed files with 4 additions and 34 deletions

View File

@ -44,8 +44,8 @@ public class Home {
.anyMatch(r -> r.getAuthority().equals("ROLE_ADMIN")
|| r.getAuthority().equals("ROLE_SUPER_USER"));
log.trace("Is admin? " + isAdmin);
model.addAttribute("activeUsers",
userService.getOtherActiveUsers(principal.getName()));
// model.addAttribute("activeUsers",
// userService.getOtherActiveUsers(principal.getName()));
return "chat";
}
}

View File

@ -57,37 +57,7 @@
</div>
<div class="card-body contacts_body">
<ui class="contacts" id="contacts-box">
<th:block th:each="au: ${activeUsers}">
<li name="user-box" class="user-box">
<div class="d-flex bd-highlight">
<div class="img_cont">
<img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img">
<span th:if="${au.online == true}" class="online_icon"></span>
</div>
<div class="user_info">
<span class="to-user-span" th:text="${au.userName}">Khalid</span>
<div th:switch="${au.online}">
<p th:case="true" th:text="${au.userName} + ' is online'">Khalid is online</p>
<th:block th:case="false">
<th:block th:if="${au.lastActive == null}">
<p th:text="'User has not logged in yet'"></p>
</th:block>
<th:block th:if="${au.lastActive != null}">
<p th:text="'Last active ' + ${au.lastActive}">Last active 3 hours ago</p>
</th:block>
<!-- <p th:case="${au.online == true}" th:text="${au.userName} + ' is online'">Khalid is online</p>
<p th:if="${au.online == false}" th:text="${au.userName} + ' is offline' + ' Last active = ' + ${au.lastActive}">Khalid is offline. -->
<!-- <span th:text="'Last active = ' + ${au.lastActive}"></span> -->
</th:block>
</div>
</div>
<div class="d-flex flex-column ml-auto">
<div class="text-right">Dec 25</div>
<div style="color: rgba(255,255,255,0.7);">Hello how are you</div>
</div>
</div>
</li>
</th:block>
<li class="text-center"><div class="spinner-grow text-info"></div></li>
</ui>
</div>
<div class="card-footer"></div>
@ -112,7 +82,7 @@
</div>
<div class="user_info">
<span id="user-name-span">Chat with Khalid</span>
<p id="num-messages-p">1767 Messages</p>
<p id="num-messages-p"></p>
</div>
<div class="video_cam">
<span><i class="fas fa-video"></i></span>