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

show session #14

Open
wants to merge 7 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion finish/client/src/main/webapp/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ a {
}

.headerRow {
height: 100px;
height: 120px;
position:relative;
z-index:2;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.50);
Expand Down
7 changes: 6 additions & 1 deletion finish/client/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h1 id="appTitle">Open Liberty System Load</h1>
</div>
<div class="headerTitle" id="sysPropTitle">
<h2>System Loads</h2>
<p id="SessionTitle" >Session:</p>
</div>
</div>
<div class="sectionContent">
Expand Down Expand Up @@ -74,7 +75,11 @@ <h2>System Loads</h2>
};

webSocket.onmessage = function (event) {
var data = JSON.parse(event.data);
try {
var data = JSON.parse(event.data);
} catch (e) {
document.getElementById('SessionTitle').innerHTML = "Session: " + event.data;
}
var tableRow = document.createElement('tr');
var loadAverage = data.loadAverage == null ? '-' : data.loadAverage.toFixed(2);
var memoryUsage = data.memoryUsage == null ? '-' : data.memoryUsage.toFixed(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public static void sendToAllSessions(JsonObject systemLoad) {
public void onOpen(Session session) {
logger.info("Server connected to session: " + session.getId());
sessions.add(session);
try {
session.getBasicRemote().sendObject(session.getId());
} catch (Exception e) {
e.printStackTrace();
}
}
// end::onOpenMethod[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public void onOpen(Session session) {
@OnMessage
public void onMessage(String message, Session userSession) throws Exception {
SystemLoadDecoder decoder = new SystemLoadDecoder();
JsonObject systemLoad = decoder.decode(message);
SystemServiceIT.verify(systemLoad);
if (decoder.willDecode(message)) {
JsonObject systemLoad = decoder.decode(message);
SystemServiceIT.verify(systemLoad);
}
}
// end::onMessage[]

Expand Down
2 changes: 1 addition & 1 deletion start/client/src/main/webapp/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ a {
}

.headerRow {
height: 100px;
height: 120px;
position:relative;
z-index:2;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.50);
Expand Down
Loading