Cockpit Plugin - Parameter Howto

149 views
Skip to first unread message

webcyberrob

unread,
Jun 23, 2014, 3:52:13 AM6/23/14
to camunda-...@googlegroups.com
Hi guys,

I have a custom cockpit plugin successfully integrated into the cockpit.processDefinition.runtime.tab

Now I would like to use the view's context, ie the process definition ID as one of my plugin parameters (I have acustom query based on process Id). Hence what's the best/recommended way to get access to the current process definition id?

Option 1: parse the $location
Option 2: Other?

regards

Rob

Roman Smirnov

unread,
Jun 23, 2014, 4:45:30 AM6/23/14
to camunda-...@googlegroups.com
Hi Rob,

The process definition is set on the injected $scope of your controller. So inside your controller you have access to the process definition object (which has been already loaded in the outerscope), for example:


ngDefine
(..., [...], function (module, ...) {
...

 
var ViewController = function ($scope, ...) {

   
var processDefinition = $scope.processDefinition;

   
// get the process definition id
   
var processDefinitionId = processDefinition.id;

   
// perform your logic
   
...

 
};

 
ViewController.$inject = ['$scope'];

 
module.config(function(ViewsProvider) {
    ViewsProvider.registerDefaultView('cockpit.some-view', {
      id
: 'some-view-special-plugin',
      label
: 'Very Special Plugin',
      url
: 'plugin://myPlugin/static/app/view.html',
      controller
: ViewController
   
});
 
});

});

 

Does it help you?

Cheers,
Roman

webcyberrob

unread,
Jun 23, 2014, 6:50:39 AM6/23/14
to camunda-...@googlegroups.com
Thanks Roman,

This was just what I was after. I now have a generic KPI cockpit plugin (see attached image)

regards

Rob


Camunda_KPI_Plugin.png

Bernd Rücker (camunda)

unread,
Jul 23, 2014, 3:21:49 AM7/23/14
to camunda-...@googlegroups.com

Hi Rob.

 

Back from vacation I wanted to ask if you drove this further? Is it maybe possible even to share some code? If it is still project specific you could send it privately to me and I could maybe take care to make it generic and add an example?

 

Background: We have our yearly “ShipItDay” where we build cool stuff in 48 hours (literally – sleeping is optional ;-)). We have a small team of 4 guys who wants to deliver something cool around cockpit plugins (stay tuned! Don’t want to leak too much information beforehand) – and it would be really nice to have this as an additional example.

 

Thanks a lot and looking forward to meet you in Semptember!

 

Cheers

Bernd

Consultant & Evangelist (www.camunda.org/community/team.html)

We are hiring: http://www.camunda.org/community/jobs.html

--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/f002936f-ea6e-48a0-a437-f262d013c847%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

webcyberrob

unread,
Jul 23, 2014, 7:02:31 AM7/23/14
to camunda-...@googlegroups.com
Hi Bernd,

I was considering contributing this as a community contribution or another cockpit example, so happy to share some code as a starting point. I have a working implementation as a proof of concept, heres some additional considerations on my wishlist;

It needs to be 'productionised' - ie unit tests etc.
It needs to be made database agnostic - at the moment I have a MySql and Oracle custom query, Im not familar enough with MyBatis to know how to switch at runtime.
Date handling could be improved - perhaps the dates could be sourced from the filter panel
Change the order such that its not the first tab
Other...

In addition Id like it to show number of instances started and number of instances completed within the date range. Hence it becomes a general purpose stats overview

Happy to see this go further,

regards

Rob

webcyberrob

unread,
Jul 23, 2014, 7:12:22 AM7/23/14
to camunda-...@googlegroups.com
Bernd,

Whilst we are at it I can contribute another plugin prototype for 'productionising'

I have a find by businesskey on the front panel which can find all process instances (completed or not) across all process definitions. The result is a table layout of process instance ID, Type, Start Date, End Date and a link to current or historic instance view.

In addition, If I were to throw in a feature request, it would be great to a a job view tab to the process instance view which displayed job details, eg the actual date/time a timer is due to expire.

regards

Rob

webcyberrob

unread,
Jul 23, 2014, 7:15:00 AM7/23/14
to camunda-...@googlegroups.com
For bonus points, showing the KPI values as a histogram graphic would look very cool!
Reply all
Reply to author
Forward
0 new messages