Added KPI goal specified as absolute metric value

+ renamed example template to 'example.html'
+ added example on new KPI goal

Change-Id: I531dfe106bb19db868424db6a03dcb7cad7d9a30
This commit is contained in:
Ilya Shakhat 2013-12-06 20:54:05 +04:00
parent ad87ea9322
commit 3fd72e42cf
3 changed files with 22 additions and 5 deletions

View File

@ -21,8 +21,8 @@ from dashboard import decorators
blueprint = flask.Blueprint('kpi', __name__, url_prefix='/kpi')
@blueprint.route('/group')
@blueprint.route('/example')
@decorators.templated()
@decorators.exception_handler()
def kpi():
def example():
return

View File

@ -80,8 +80,23 @@
var mark = item.index <= position;
return {
mark: mark,
info: mark? "Achieved position is " + position:
"Position " + item.index + " is worse than target position " + position,
info: mark? "Achieved position is " + item.index:
"Position " + item.index + " is worse than the goal position " + position,
value: item.index
}
});
});
}
function goal_metric(container_id, query_options, item_type, item_id, metric, goal) {
$(document).ready(function () {
process_stats(container_id, "/api/1.0/stats/" + item_type, query_options, item_id, goal,
function(item, sum) {
var mark = item.metric > metric;
return {
mark: mark,
info: mark? "Achieved metric " + item.metric:
"Position " + item.metric + " is worse than the goal in " + metric,
value: item.index
}
});
@ -98,7 +113,7 @@
var goal_percentage_formatted = Math.round(goal_percentage * 100) + "%";
return {
mark: mark,
info: mark? "Achieved percentage " + goal_percentage_formatted:
info: mark? "Achieved percentage " + percentage_formatted:
"Value " + percentage_formatted + " is more than the goal " + goal_percentage_formatted,
value: percentage_formatted
}

View File

@ -19,6 +19,8 @@
{release: "all", metric: "commits", project_type: "stackforge", module: "stackalytics"},
"companies", "Mirantis", 0.8, "Mirantis contribution is less than 80%");
goal_metric("kpi_container_position", {release: "icehouse", metric: "bpd", project_type: "openstack", module: "glance", exclude: "core"},
"modules", "glance", 10, "File at least 10 blueprints into Glance");
});
</script>
{% endblock %}