aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/webui/static')
-rw-r--r--fg21sim/webui/static/css/main.css28
-rw-r--r--fg21sim/webui/static/js/console.js26
2 files changed, 53 insertions, 1 deletions
diff --git a/fg21sim/webui/static/css/main.css b/fg21sim/webui/static/css/main.css
index a574990..de40123 100644
--- a/fg21sim/webui/static/css/main.css
+++ b/fg21sim/webui/static/css/main.css
@@ -374,12 +374,40 @@ button,
font-size: 1.6rem;
font-weight: bold;
}
+.panel-control {
+ float: right;
+}
.panel-body {
padding: 1.5rem;
}
/**
+ * Logging messages styles
+ */
+p.log {
+ font-size: 1.3rem;
+ margin-bottom: 0;
+}
+p.log span {
+ margin-right: 0.8rem;
+}
+p.log.log-debug {
+ color: inherit;
+}
+p.log.log-info {
+ color: #398439;
+}
+p.log.log-warning {
+ color: #d58512;
+}
+p.log.log-error,
+p.log.log-critical {
+ color: #ac2925;
+}
+
+
+/**
* Horizontal rules
*/
hr {
diff --git a/fg21sim/webui/static/js/console.js b/fg21sim/webui/static/js/console.js
index 6d5783a..f9e75dc 100644
--- a/fg21sim/webui/static/js/console.js
+++ b/fg21sim/webui/static/js/console.js
@@ -58,6 +58,30 @@ var updateTaskStatus = function (status) {
/**
+ * Append the logging messages to the "#log-messages" panel box
+ *
+ * @param {Object} msg - Server pushed logging message of "action=log"
+ */
+var appendLogMessage = function (msg) {
+ var log_icons = {
+ debug: "<span class='icon fa fa-comment'></span>",
+ info: "<span class='icon fa fa-info-circle'></span>",
+ warning: "<span class='icon fa fa-warning'></span>",
+ error: "<span class='icon fa fa-times-circle'></span>",
+ critical: "<span class='icon fa fa-times-circle'></span>",
+ };
+ var level = msg.levelname.toLowerCase();
+ var ele = $("<p>").addClass("code log log-" + level);
+ ele.append($(log_icons[level]));
+ ele.append($("<span>").addClass("asctime").text(msg.asctime));
+ ele.append($("<span>").addClass("levelname").text(msg.levelname));
+ ele.append($("<span>").addClass("name").text(msg.name));
+ ele.append($("<span>").addClass("message").text(msg.message));
+ ele.appendTo("#log-messages");
+};
+
+
+/**
* Get the task status from the server
*
* @param {Object} ws - The opened WebSocket object through which to send
@@ -84,7 +108,7 @@ var startServerTask = function (ws, time) {
*/
var handleMsgConsole = function (msg) {
if (msg.action === "log") {
- // TODO: show the logging messages
+ appendLogMessage(msg);
}
else if (msg.action === "push") {
// Update the task status