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

Web interface Quality of Life improvements #5201

Merged
merged 1 commit into from
Feb 11, 2019
Merged
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
12 changes: 6 additions & 6 deletions web/ui/assets_vfsdata.go

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions web/ui/static/js/graph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,26 @@ Prometheus.Graph.prototype.initialize = function() {
var graphWrapper = self.el.find("#graph_wrapper" + self.id);
self.queryForm = graphWrapper.find(".query_form");

// Auto-resize the text area on input or mouseclick
var resizeTextarea = function(el) {
var offset = el.offsetHeight - el.clientHeight;
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
};

self.expr = graphWrapper.find("textarea[name=expr]");
self.expr.keypress(function(e) {
const enter = 13;
if (e.which == enter && !e.shiftKey) {
self.queryForm.submit();
e.preventDefault();
}

// Auto-resize the text area on input.
var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function(el) {
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
};
$(this).on('keyup input', function() { resizeTextarea(this); });
});

self.expr.click(function(e) {
juliusv marked this conversation as resolved.
Show resolved Hide resolved
resizeTextarea(this);
});

self.expr.change(self.handleChange);

self.rangeInput = self.queryForm.find("input[name=range_input]");
Expand Down
10 changes: 10 additions & 0 deletions web/ui/static/js/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ function showUnhealthy(_, container) {
}

function init() {
if (!localStorage.selectedTab || localStorage.selectedTab == "all-targets"){
$("#all-targets").parent().addClass("active");
$(".table-container").each(showAll);
} else if (localStorage.selectedTab == "unhealthy-targets") {
$("#unhealthy-targets").parent().addClass("active");
$(".table-container").each(showUnhealthy);
}

$("button.targets").click(function () {
const tableTitle = $(this).closest("h2").find("a").attr("id");

Expand All @@ -45,8 +53,10 @@ function init() {

if (target === "all-targets") {
$(".table-container").each(showAll);
localStorage.setItem("selectedTab", "all-targets");
} else if (target === "unhealthy-targets") {
$(".table-container").each(showUnhealthy);
localStorage.setItem("selectedTab", "unhealthy-targets");
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion web/ui/templates/targets.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="container-fluid">
<h1>Targets</h1>
<div id="showTargets" class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<label class="btn btn-primary">
<input type="radio" name="targets" id="all-targets" autocomplete="off" checked> All
</label>
<label class="btn btn-primary">
Expand Down