Excerpt |
---|
This page lists all the available functions used to manipulate dashboards and gadgets. |
Child pages (Children Display) | ||
---|---|---|
|
Structures used in cloud:
JSharePermission
Code Block |
---|
int id; // the id of the permission
string type; // the type of the permission
string object; //the corresponding object id, see notes |
Type must be one of the following:
"user"
- object must be theaccountId
"group"
- object must begroupid
"project"
- object must beprojectKey
"projectRole"
- object must have this formprojectKey|roleId
"global"
- object value is discarded"loggedin"
- object value is discarded
JDashboard
Code Block | ||
---|---|---|
| ||
string id; //id
string name; // name
string description; //description
string viewUrl; // the direct url to view this dashboard
boolean system; //true if it's a system dashboard
string owner; //the owner. For system dashboards it's the admin
int refreshInterval; // auto-refresh in millis
int popularity; // popularity. how many times favourited by users
int rank; //rank
JSharePermission [] editPermissions; // edit perms
JSharePermission [] sharePermissions; //share perms |
JGadget
Code Block | ||
---|---|---|
| ||
int id; //id of the gadget instance
string moduleKey; //uri or module key must be non-null
string title; //mandatory.
string uri; //uri or module key must be non-null
string color; //standard colors only: "blue", "red", "yellow", "green", "cyan", "purple", "gray", "white"
int row; //row, index starts at 0
int column; //column. index starts at 0 |
Examples
Manipulating dashboards & their permissions
Code Block | ||
---|---|---|
| ||
JDashboard [] dashes = admGetDashboardsByName("Default");
JDashboard dash = admGetDashboardById(10000);
JDashboard created;
created.name="Empty dash no 1";
created.description="This is a description";
created.owner = currentUser();
//This is how you share the dashboards:
// JSharePermission perm;
// perm.type="project";
// perm.object="TEST";
//created.sharePermissions += perm;
JSharePermission permLI;
permLI.type="loggedin";
created.sharePermissions += permLI;
created = admCreateDashboard(created);
runnerLog("Just created:" + created);
JDashboard copy = admCopyDashboard(created.id, currentUser());
copy.description ="this is a new description";
copy = admUpdateDashboard(copy);
runnerLog("Copy of it:" + copy);
admDeleteDashboard(created.id);
admDeleteDashboard(copy.id); |
Modifying a dashboard
Code Block | ||
---|---|---|
| ||
JDashboard dash = admGetDashboardsForUser(currentUser())[0];
JGadget [] gadgets = admGetAvailableGadgets();
JGadget gadget;
for(JGadget g in gadgets) {
if(g.title == "Activity Stream") {
gadget = g;
break;
}
}
gadget = admAddGadgetToDashboard(dash.id, gadget);
gadget.color = "red";
gadget.admUpdateGadgetInDashboard(dash.id, gadget);
return admGetDashboardGadgets(dash.id); |