Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I obtain information from dashboard?

Hi,

is it possible to obtain information from the dashboard in order to provide them to a custom viewlet?

For example in my custom viewlet I call a custom service with a parameter which is the project area name. Is it possible to obtain this information (or the project area UUID)?

Thanks,

Michele.

1 vote


Accepted answer

Permanent link
Michele,

As you suspected, there is a very simple way to do this. There is an API available to viewlets to get the "scope" of its container. When the viewlet is on a project or team dashboard, this API will give you the details of that parent artifact. The methods you want to call are Viewlet#getScope and Viewlet#getScopeItem. The former will give you what the type of scope is (Contributor, Project or Team). The result will be a constant from the "com.ibm.team.dashboard.web.ui.DashboardConstants" javascript module. You can simply require this module and compare to the DashboardConstants.SCOPE_CONTRIBUTOR, DashboardConstants.SCOPE_PROJECT_AREA and DashboardConstants.SCOPE_TEAM_AREA constants. The latter method, getScopeItem, will give you details about the actual associated item. This will come in the form of a json object with two properties: name and itemId.

Additionally, you can add a setting to the viewlet if you like that will allow the user to override the "scope" of the viewlet. By default the properties of the dashboard will be used, but this gives the consumer of the viewlet the ability to change which project/team's information is displayed. This can be useful for allowing users to use the viewlet on their personal dashboards with a bit of customization. To make your viewlet "scopable" and provide scope options in the settings area for the viewlet, you need to make some changes to the extension point declaration for your viewlet. The fields you care about in your viewlet definition are "scope-sensitive" and "applies-to". The "scope-sensitive" settings is a boolean that controls whether or not you want the scope settings to be surfaced and you should set it to true. The "applies-to" field controls what types of scope the viewlet will recognize. It sounds like for your purposes this should be "projects-and-teams", but you can see the other options available to you by using the plugin-manifest editor in the Eclipse client.

For more information on the API available to viewlets, see:

https://jazz.net/wiki/bin/view/Main/ViewletFunctions

Included in there are docs about the getScope and getScopeItem methods:

https://jazz.net/wiki/bin/view/Main/ViewletFunctions#GetScope
https://jazz.net/wiki/bin/view/Main/ViewletFunctions#GetScopeItem
Michele Pegoraro selected this answer as the correct answer

1 vote

Comments

Adam, thank you very much for these information. I'm going to learn more on this as it seems to be very useful.

Best regards, Michele.


3 other answers

Permanent link
sorry, I do not understand your question..

0 votes


Permanent link

Sam,

probably I was not very clear, but I think it is a very simple thing. I have created a new custom viewlet and added to my dashboard. In this viewlet I've a button which call a service I've created. This service need a parameter which is the project area (or team area) that owned the dashboard.

Currently I've created a string setting so I can obtain the project area name putting it there.

What I was asking to me is that probably there is a javascript method (something like the getAutenticatedContributor) that can give me the project/team area of the dashboard on which I've put the viewlet. In this way I don't have to configure the settings for the viewlet each time I create a new dashoboard. I've take a look to the WEB UI API (https://jazz.net/library/LearnItem.jsp?href=content/docs/web-ui-programming/web-ui-api.html) but I cannot find anything like this.

Is it possible?

Thanks,

Michele.

0 votes


Permanent link
ok, got it.. I don't know the answer

but I agree, its probably a javascript function. I haven't seen any documented methods for determining details of the runtime from either workitems, menus or dashboards.


0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 11
× 1

Question asked: Nov 26 '12, 11:08 a.m.

Question was seen: 7,361 times

Last updated: Nov 30 '12, 5:16 a.m.

Confirmation Cancel Confirm