diff --git a/dashboard/kpi.py b/dashboard/kpi.py new file mode 100644 index 000000000..b66ae3474 --- /dev/null +++ b/dashboard/kpi.py @@ -0,0 +1,28 @@ +# Copyright (c) 2013 Mirantis Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import flask + +from dashboard import decorators + + +blueprint = flask.Blueprint('kpi', __name__, url_prefix='/kpi') + + +@blueprint.route('/group') +@decorators.templated() +@decorators.exception_handler() +def kpi(): + return diff --git a/dashboard/static/css/style.css b/dashboard/static/css/style.css index f42e22402..8b7d3d9a8 100644 --- a/dashboard/static/css/style.css +++ b/dashboard/static/css/style.css @@ -336,6 +336,41 @@ a[href^="https://launchpad"]:after { color: #999999; } +.kpi_block { + padding-bottom: 1em; +} + +.kpi_title_block { + margin-left: 50px; +} + +.kpi_title { + font-size: 16pt; + font-weight: bold; +} + +.kpi_marker { + font-size: 19pt; + font-weight: bold; + text-align: center; vertical-align: middle; + background-color: lightgray; color: white; + float: left; width: 32px; height: 32px; +} + +.kpi_good { + background-color: #008000; +} + +.kpi_bad { + background-color: red; +} + +.kpi_note { + font-size: 11pt; + color: #606060; + display: none; +} + .select2-results { max-height: 300px; } diff --git a/dashboard/templates/kpi/base_kpi.html b/dashboard/templates/kpi/base_kpi.html new file mode 100644 index 000000000..186caef60 --- /dev/null +++ b/dashboard/templates/kpi/base_kpi.html @@ -0,0 +1,55 @@ +{% extends "base.html" %} + +{% block head %} + {% block title %}{% endblock %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% block scripts %}{% endblock %} +{% endblock %} + +{% block body %} + +
+
+ + | community heartbeat +
+ +{% block content %} +{% endblock %} + +
+{% endblock %} diff --git a/dashboard/templates/kpi/kpi.html b/dashboard/templates/kpi/kpi.html new file mode 100644 index 000000000..bf7c53cee --- /dev/null +++ b/dashboard/templates/kpi/kpi.html @@ -0,0 +1,72 @@ +{% extends "kpi/base_kpi.html" %} + +{% block title %} + Group KPI +{% endblock %} + +{% block scripts %} + +{% endblock %} + +{% macro position_target(record_filter, target_id, target_value, title) -%} + + {% set id=title.replace(' ', '_') %} + + + +
+
+
+
{{ title }}
+
+
+
+ +{%- endmacro %} + +{% block content %} +

Metrics

+ + {{ position_target({'release': 'icehouse', 'project_type': 'openstack', 'metric': 'commits'}, 'Mirantis', 5, 'Position by commits') }} + {{ position_target({'release': 'icehouse', 'project_type': 'openstack', 'metric': 'marks'}, 'Mirantis', 5, 'Position by reviews') }} + +{% endblock %} diff --git a/dashboard/web.py b/dashboard/web.py index 2d6702905..4a351ae90 100644 --- a/dashboard/web.py +++ b/dashboard/web.py @@ -23,6 +23,7 @@ from oslo.config import cfg from dashboard import decorators from dashboard import helpers +from dashboard import kpi from dashboard import parameters from dashboard import reports from dashboard import vault @@ -37,6 +38,7 @@ app = flask.Flask(__name__) app.config.from_object(__name__) app.config.from_envvar('DASHBOARD_CONF', silent=True) app.register_blueprint(reports.blueprint) +app.register_blueprint(kpi.blueprint) LOG = logging.getLogger(__name__) @@ -434,6 +436,12 @@ def timeline(records, **kwargs): gravatar = gravatar_ext.Gravatar(app, size=64, rating='g', default='wavatar') +@app.template_filter('make_url') +def to_url_params(dict_params, base_url): + return base_url + '?' + '&'.join( + ['%s=%s' % (k, v) for k, v in dict_params.iteritems()]) + + def main(): app.run(cfg.CONF.listen_host, cfg.CONF.listen_port)