From 74767b860042f7d3b98068b89a68a1b24881504a Mon Sep 17 00:00:00 2001 From: anushree-n Date: Fri, 14 Aug 2015 17:57:24 -0700 Subject: [PATCH] UI changes --- pages/static/containers_js.go | 118 ++++++++++++++++++++++++++++------ 1 file changed, 98 insertions(+), 20 deletions(-) diff --git a/pages/static/containers_js.go b/pages/static/containers_js.go index 6af1f999..72116f7a 100644 --- a/pages/static/containers_js.go +++ b/pages/static/containers_js.go @@ -714,11 +714,82 @@ function refreshStats() { }); } +function addAllLabels(containerInfo, metricsInfo) { + if (metricsInfo.length == 0) { + return; + } + var metricSpec = containerInfo.spec.custom_metrics; + for (var containerName in metricsInfo) { + var container = metricsInfo[containerName]; + for (i=0; i") + .attr("role", "presentation") + .append($("") + .attr("role", "menuitem") + .click(setLabel.bind(null, metricName, label)) + .text(label))); + if (firstLabel) { + firstLabel = false; + setLabel(metricName, label); + } + } + } + } +} + +function getMetricIndex(metricName) { + for (i = 0; i").text("Label: ")) + .append($("").text(label)) + + index = getMetricIndex(metric); + if (index == -1) { + window.cadvisor.metricLabelPair.push([metric, label]); + } else { + window.cadvisor.metricLabelPair[index][1] = label; + } + + refreshStats(); +} + +function getSelectedLabel(metricName) { + index = getMetricIndex(metricName); + if (index == -1) + return ""; + return window.cadvisor.metricLabelPair[index][1]; +} + function startCustomMetrics(elementId, containerInfo) { - var metrics = containerInfo.spec.custom_metrics; + var metricSpec = containerInfo.spec.custom_metrics; + var metricStats = containerInfo.stats.custom_metrics; var el=$("
"); - for (i = 0; i
"; + + if (metricSpec.length < window.cadvisor.maxCustomMetrics) + window.cadvisor.maxCustomMetrics = metricSpec.length + for (i = 0; i "; + divText += " "; + divText += "
"; el.append($(divText)); } el.append($("")); @@ -743,28 +814,31 @@ function drawCustomMetrics(elementId, containerInfo, metricsInfo) { var metricSpec = containerInfo.spec.custom_metrics; for (var containerName in metricsInfo) { var container = metricsInfo[containerName]; - for (i=0; i