blob: e64d625de201845cbd583710ed658f029e115aab [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Dashboards
Edwin Kempind25d10a2012-07-19 10:56:34 +02002
Edwin Kempin1f556222015-04-22 13:24:39 +02003[[custom-dashboards]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004== Custom Dashboards
Edwin Kempind25d10a2012-07-19 10:56:34 +02005
6A custom dashboard is shown in a layout similar to the per-user
7dashboard, but the sections are entirely configured from the URL.
8Because of this custom dashboards are stateless on the server side.
9Users or projects can simply trade URLs using an external system like
10a project wiki, or site administrators can put the links into the
11site's `GerritHeader.html` or `GerritFooter.html`.
12
13Dashboards are available via URLs like:
14----
15 /#/dashboard/?title=Custom+View&To+Review=reviewer:john.doe@example.com&Pending+In+myproject=project:myproject+is:open
16----
17This opens a view showing the title "Custom View" with two sections,
18"To Review" and "Pending in myproject":
19----
20 Custom View
21
22 To Review
23
24 Results of `reviewer:john.doe@example.com`
25
26 Pending In myproject
27
28 Results of `project:myproject is:open`
29----
30
31The dashboard URLs are easy to configure. All keys and values in the
32URL are encoded as query parameters. Set the page and window title
33using an optional `title=Text` parameter.
34
35Each section's title is defined by the parameter name, the section
36display order is defined by the order the parameters appear in the
37URL, and the query results are defined by the parameter value. To
38limit the number of rows in a query use `limit:N`, otherwise the
39entire result set will be shown (up to the user's query limit).
40
41Parameters may be separated from each other using any of the following
42characters, as some users may find one more readable than another:
43`&` or `;` or `,`
44
Martin Fick99898fc2012-11-13 00:04:16 -070045The special `foreach=...` parameter is designed to facilitate
David Pursehouse92463562013-06-24 10:16:28 +090046more easily writing similar queries in a dashboard. The value of the
Martin Fick99898fc2012-11-13 00:04:16 -070047foreach parameter will be used in every query in the dashboard by
48appending it to their ends with a space (ANDing it with the queries).
49
50Example custom dashboard using foreach to constrain a dashboard
51to changes for the current user:
52
53----
54 /#/dashboard/?title=Mine&foreach=owner:self&My+Pending=is:open&My+Merged=is:merged
55----
56
57
Edwin Kempin861d4e12013-03-27 10:28:18 +010058[[project-dashboards]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080059== Project Dashboards
Edwin Kempinb2efe212012-11-12 23:03:36 +010060
61It is possible to share custom dashboards at a project level. To do
Jonathan Nieder5758f182015-03-30 11:28:55 -070062this define the dashboards in a `+refs/meta/dashboards/*+` branch of the
Martin Fick671767b2012-11-18 14:11:06 -070063project. For each dashboard create a config file. The file path/name
64will be used as name (equivalent to a title in a custom dashboard) for
65the dashboard.
Edwin Kempinb2efe212012-11-12 23:03:36 +010066
Bruce Zu4bb60f7a2013-08-09 12:52:19 +080067Example of a dashboard config file:
Edwin Kempinb2efe212012-11-12 23:03:36 +010068
69----
Edwin Kempinf6db7ff2012-11-20 16:42:06 +010070[dashboard]
Edwin Kempinb2efe212012-11-12 23:03:36 +010071 description = Most recent open and merged changes.
72[section "Open Changes"]
73 query = status:open project:myProject limit:15
74[section "Merged Changes"]
75 query = status:merged project:myProject limit:15
76----
77
Martin Fick7aa89fe2012-11-18 14:05:58 -070078Once defined, project dashboards are accessible using stable URLs by
79using the project name, refname and pathname of the dashboard via URLs
Bruce Zu4bb60f7a2013-08-09 12:52:19 +080080, e.g. create a dashboard config file named `Main` and push it
81to `refs/meta/dashboards/Site` branch of All-Projects, then access it
Martin Fick7aa89fe2012-11-18 14:05:58 -070082like:
83----
84 /#/projects/All-Projects,dashboards/Site:Main
85----
86
Martin Fickc2f373f2012-11-14 01:24:47 -070087Project dashboards are inherited from ancestor projects unless
Martin Fick671767b2012-11-18 14:11:06 -070088overridden by dashboards with the same ref and name. This makes
89it easy to define common dashboards for every project by simply
90defining project dashboards on the All-Projects project.
Martin Fickc2f373f2012-11-14 01:24:47 -070091
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080092=== Token `${project}`
Edwin Kempin07fb6122013-04-04 08:44:41 +020093
Martin Fickc31ee092012-11-14 14:16:42 -070094Project dashboard queries may contain the special `${project}` token
Edwin Kempin07fb6122013-04-04 08:44:41 +020095which will be replaced with the name of the project to which the
96dashboard is being applied. This is useful for defining dashboards
97designed to be inherited. With this token, it is possible to cause a
98query in a project dashboard to be restricted to only changes for the
99project in which an inherited dashboard is being applied by simply
100adding `project:${project}` to the query in the dashboard.
Martin Fickc31ee092012-11-14 14:16:42 -0700101
Edwin Kempin07fb6122013-04-04 08:44:41 +0200102The `${project}` token can also be used in the link:#dashboard.title[
103dashboard title] and in the link:#dashboard.description[dashboard
104description].
Edwin Kempinb2efe212012-11-12 23:03:36 +0100105
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800106=== Section `dashboard`
Edwin Kempin07fb6122013-04-04 08:44:41 +0200107
108[[dashboard.title]]dashboard.title::
Edwin Kempinf6db7ff2012-11-20 16:42:06 +0100109+
110The title of the dashboard.
111+
112If not specified the path of the dashboard config file is used as
113title.
114
Edwin Kempin07fb6122013-04-04 08:44:41 +0200115[[dashboard.description]]dashboard.description::
Edwin Kempinb2efe212012-11-12 23:03:36 +0100116+
117The description of the dashboard.
118
Martin Fickcb8fe2f2012-11-19 21:58:20 -0700119dashboard.foreach::
120+
121The value of the foreach parameter gets appended to every query in the
122dashboard.
123+
124Example dashboard config section to constrain the entire dashboard to
125the project to which it is applied:
126+
127----
128[dashboard]
129 foreach = project:${project}
130----
131
132
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800133=== Section `section`
Edwin Kempinb2efe212012-11-12 23:03:36 +0100134
135section.<name>.query::
136+
137The change query that should be used to populate the section with the
138given name.
139
Edwin Kempin861d4e12013-03-27 10:28:18 +0100140[[project-default-dashboard]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800141== Project Default Dashboard
Edwin Kempin48853432012-11-14 20:46:58 +0100142
143It is possible to define a default dashboard for a project in the
144projects `project.config` file in the `refs/meta/config` branch:
145
146----
147[dashboard]
148 default = refs/meta/dashboards/main:default
149----
150
151The dashboard set as the default dashboard will be inherited as the
152default dashboard by child projects if they do not define their own
153default dashboard. The `local-default` entry makes it possible to
154define a different default dashboard that is only used by this project
155but not inherited to the child projects.
156
157----
158[dashboard]
159 default = refs/meta/dashboards/main:default
160 local-default = refs/meta/dashboards/main:local
161----
162
Edwin Kempind25d10a2012-07-19 10:56:34 +0200163GERRIT
164------
165Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700166
167SEARCHBOX
168---------