Allow defining a default dashboard for projects

It is now possible to define a default dashboard for a project in the
project.config file in the refs/meta/config branch.

Example:
[dashboard]
  default = refs/meta/dashboards/main:default

When it will be possible to inherit dashboards from parent projects, it
will be important to differentiate between a default dashboard that
is be used for this project and the dashboard that will be inherited
by the child projects as default dashboard.

This is why we allow overwriting the default dashboard by explicitly
setting a local default dashboard, which will only be used by this
project.

Example:
[dashboard]
  default = refs/meta/dashboards/main:default
  local-default = refs/meta/dashboards/main:local

Via the /dashboards/ REST endpoint it is now possible to either
retrieve all dashboards of the project or only the default dashboard
of the project.

Change-Id: I119408968bc86c3fd112c186638d3176235ca28e
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-11-14 20:46:58 +01:00
parent b2efe218a5
commit 488534349a
7 changed files with 217 additions and 34 deletions

View File

@@ -23,6 +23,7 @@ public class DashboardInfo extends JavaScriptObject {
public final native String projectName() /*-{ return this.project_name; }-*/;
public final native String description() /*-{ return this.description; }-*/;
public final native String parameters() /*-{ return this.parameters; }-*/;
public final native boolean isDefault() /*-{ return this.isDefault ? true : false; }-*/;
protected DashboardInfo() {
}

View File

@@ -28,6 +28,13 @@ public class DashboardMap extends NativeMap<DashboardInfo> {
.send(NativeMap.copyKeysIntoChildren(callback));
}
public static void projectDefault(Project.NameKey project, boolean mine,
AsyncCallback<DashboardMap> callback) {
new RestApi("/dashboards/project/" + URL.encode(project.get()).replaceAll("[?]", "%3F"))
.addParameterTrue("default")
.send(NativeMap.copyKeysIntoChildren(callback));
}
protected DashboardMap() {
}
}