@@ -37,6 +46,7 @@ class Console extends Class
""")
@text = @container.find(".console-text")
@text_elem = @text[0]
+ @tabs = @container.find(".console-tabs")
@text.on "mousewheel", (e) => # Stop animation on manual scrolling
if e.originalEvent.deltaY < 0
@@ -47,6 +57,12 @@ class Console extends Class
@container.appendTo(document.body)
@tag = @container.find(".console")
+ for tab_type in @tab_types
+ tab = $("
", {href: "#", "data-filter": tab_type.filter}).text(tab_type.title)
+ if tab_type.filter == @tab_active
+ tab.addClass("active")
+ tab.on("click", @handleTabClick)
+ @tabs.append(tab)
@container.on "mousedown touchend touchcancel", (e) =>
if e.target != e.currentTarget
@@ -98,26 +114,31 @@ class Console extends Class
loadConsoleText: =>
- @sidebar.wrapper.ws.cmd "consoleLogRead", {filter: @filter}, (res) =>
+ @sidebar.wrapper.ws.cmd "consoleLogRead", {filter: @filter, read_size: @read_size}, (res) =>
@text.html("")
pos_diff = res["pos_end"] - res["pos_start"]
size_read = Math.round(pos_diff/1024)
size_total = Math.round(res['pos_end']/1024)
+ @text.append("
")
@text.append("Displaying #{res.lines.length} of #{res.num_found} lines found in the last #{size_read}kB of the log file. (#{size_total}kB total)
")
@addLines res.lines, false
@text_elem.scrollTop = @text_elem.scrollHeight
+ if @stream_id
+ @sidebar.wrapper.ws.cmd "consoleLogStreamRemove", {stream_id: @stream_id}
@sidebar.wrapper.ws.cmd "consoleLogStream", {filter: @filter}, (res) =>
@stream_id = res.stream_id
close: =>
+ window.top.location.hash = ""
@sidebar.move_lock = "y"
@sidebar.startDrag()
@sidebar.stopDrag()
open: =>
- @createHtmltag()
- @sidebar.fixbutton_targety = @sidebar.page_height
- @stopDragY()
+ @sidebar.startDrag()
+ @sidebar.moved("y")
+ @sidebar.fixbutton_targety = @sidebar.page_height - @sidebar.fixbutton_inity - 50
+ @sidebar.stopDrag()
onOpened: =>
@sidebar.onClosed()
@@ -157,4 +178,20 @@ class Console extends Class
if not @opened
@onClosed()
-window.Console = Console
\ No newline at end of file
+ changeFilter: (filter) =>
+ @filter = filter
+ if @filter == ""
+ @read_size = 32 * 1024
+ else
+ @read_size = 1024 * 1024
+ @loadConsoleText()
+
+ handleTabClick: (e) =>
+ elem = $(e.currentTarget)
+ @tab_active = elem.data("filter")
+ $("a", @tabs).removeClass("active")
+ elem.addClass("active")
+ @changeFilter(@tab_active)
+ return false
+
+window.Console = Console
diff --git a/plugins/Sidebar/media/Console.css b/plugins/Sidebar/media/Console.css
index dc386d70..d81253dd 100644
--- a/plugins/Sidebar/media/Console.css
+++ b/plugins/Sidebar/media/Console.css
@@ -1,9 +1,19 @@
.console-container { width: 100%; z-index: 998; position: absolute; top: -100vh; padding-bottom: 100%; }
.console-container .console { background-color: #212121; height: 100vh; transform: translateY(0px); padding-top: 80px; box-sizing: border-box; }
-.console-top { color: white; font-family: Consolas, monospace; font-size: 11px; line-height: 20px; padding: 5px; height: 100%; box-sizing: border-box; letter-spacing: 0.5px;}
-.console-text { overflow-y: scroll; height: 100%; color: #DDD; }
-
+.console-top { color: white; font-family: Consolas, monospace; font-size: 11px; line-height: 20px; height: 100%; box-sizing: border-box; letter-spacing: 0.5px;}
+.console-text { overflow-y: scroll; height: calc(100% - 10px); color: #DDD; padding: 5px; margin-top: -36px; }
+.console-tabs {
+ background-color: #41193fad; position: relative; margin-right: 15px; backdrop-filter: blur(2px);
+ box-shadow: 0px 0px 45px #7d2463; background: linear-gradient(-75deg, #591a48ed, #70305e66); border-bottom: 1px solid #792e6473;
+}
+.console-tabs a {
+ margin-right: 5px; padding: 5px 15px; text-decoration: none; color: #AAA;
+ font-size: 11px; font-family: "Consolas"; text-transform: uppercase; border: 1px solid #666;
+ border-bottom: 0px; display: inline-block; margin: 5px; margin-bottom: 0px; background-color: rgba(0,0,0,0.5);
+}
+.console-tabs a:hover { color: #FFF }
+.console-tabs a.active { background-color: #46223c; color: #FFF }
.console-middle {height: 0px; top: 50%; position: absolute; width: 100%; left: 50%; display: none; }
.console .mynode {