Support '${project}' token in dashboard title and description

The `${project}` token in a dashboard title or description will now be
replaced with the project name to which the dashboard is being applied.

Change-Id: I1e825b0197fcd197991e6f434ea06726f7a396cf
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-04-04 08:44:41 +02:00
parent b1d656f98f
commit 07fb61204a
2 changed files with 21 additions and 14 deletions

View File

@@ -89,25 +89,32 @@ overridden by dashboards with the same ref and name. This makes
it easy to define common dashboards for every project by simply
defining project dashboards on the All-Projects project.
Token `${project}`
~~~~~~~~~~~~~~~~~~
Project dashboard queries may contain the special `${project}` token
which will be replaced with the project name to which the dashboard is
being applied. This is useful for defining dashboards designed to be
inherited. With this token, it is possible to cause a query in a
project dashboard to be restricted to only changes for the project in
which an inherited dashboard is being applied by simply adding
`project:${project}` to the query in the dashboard.
which will be replaced with the name of the project to which the
dashboard is being applied. This is useful for defining dashboards
designed to be inherited. With this token, it is possible to cause a
query in a project dashboard to be restricted to only changes for the
project in which an inherited dashboard is being applied by simply
adding `project:${project}` to the query in the dashboard.
Section dashboard
~~~~~~~~~~~~~~~~~
The `${project}` token can also be used in the link:#dashboard.title[
dashboard title] and in the link:#dashboard.description[dashboard
description].
dashboard.title::
Section `dashboard`
~~~~~~~~~~~~~~~~~~~
[[dashboard.title]]dashboard.title::
+
The title of the dashboard.
+
If not specified the path of the dashboard config file is used as
title.
dashboard.description::
[[dashboard.description]]dashboard.description::
+
The description of the dashboard.
@@ -125,8 +132,8 @@ the project to which it is applied:
----
Section section
~~~~~~~~~~~~~~~
Section `section`
~~~~~~~~~~~~~~~~~
section.<name>.query::
+

View File

@@ -160,8 +160,8 @@ class DashboardsCollection implements
DashboardInfo info = new DashboardInfo(refName, path);
info.project = project;
info.definingProject = definingProject.getName();
info.title = config.getString("dashboard", null, "title");
info.description = config.getString("dashboard", null, "description");
info.title = replace(project, config.getString("dashboard", null, "title"));
info.description = replace(project, config.getString("dashboard", null, "description"));
info.foreach = config.getString("dashboard", null, "foreach");
if (setDefault) {