diff --git a/app/assets/javascripts/application.js.coffee.erb b/app/assets/javascripts/application.js.coffee.erb index ef956ccf..71ea6c7e 100644 --- a/app/assets/javascripts/application.js.coffee.erb +++ b/app/assets/javascripts/application.js.coffee.erb @@ -54,7 +54,30 @@ $(document).ready -> if $(".flash").length setTimeout((-> $(".flash").slideUp(-> $(".flash").remove())), 5000) - # Agent Show + # Agent Navigation + $agentNavigate = $('#agent-navigate') + $agentNavigate.typeahead( + minLength: 0, + items: 15, + source: agentNames + ).on("change", (e) -> + if agentPaths[$agentNavigate.val()] + $('#agent-navigate').closest(".navbar-search").find(".spinner").show(); + window.location = agentPaths[$agentNavigate.val()] + ).on("focus", (e) -> + $agentNavigate.val '' + ).on("blur", (e) -> + $agentNavigate.val '' + ) + + # Pressing '/' selects the search box. + $("body").on "keypress", (e) -> + if e.keyCode == 47 # The '/' key + if e.target.nodeName == "BODY" + e.preventDefault() + $agentNavigate.focus() + +# Agent Show fetchLogs = (e) -> agentId = $(e.target).closest("[data-agent-id]").data("agent-id") e.preventDefault() @@ -85,7 +108,7 @@ $(document).ready -> $("#agent_type").on "change", -> if window.jsonEditor? - $(".spinner").fadeIn(); + $("#agent-spinner").fadeIn(); $("#agent_source_ids").select2("val", {}); $(".event-descriptions").html("").hide() $.getJSON "/agents/type_details", { type: $(@).val() }, (json) => @@ -104,7 +127,7 @@ $(document).ready -> window.jsonEditor.json = json.options window.jsonEditor.rebuild() - $(".spinner").stop(true, true).fadeOut(); + $("#agent-spinner").stop(true, true).fadeOut(); $("#agent_type").change() if $("#agent_type").length diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index 5c530ae7..29d1acd9 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -51,10 +51,6 @@ table.events { margin-left: 0 !important; } -#job-indicator, #event-indicator { - display: none; -} - img.odin { position: relative; top: -32px; @@ -86,14 +82,25 @@ img.spinner { overflow: hidden; } +// Navbar + +#job-indicator, #event-indicator { + display: none; +} + +.navbar-search > .spinner { + position: absolute; + top: -1px; + right: 1px; +} + // Flash .flash { position: fixed; - width: 500px; + width: 210px; z-index: 99999; - top: 1px; - margin-left: 250px; + right: 20px; .alert { } diff --git a/app/views/agents/edit.html.erb b/app/views/agents/edit.html.erb index ed20571a..e5b883b6 100644 --- a/app/views/agents/edit.html.erb +++ b/app/views/agents/edit.html.erb @@ -4,7 +4,7 @@