Cockpit Plugin - Paging

Hi everyone,

I am currently trying to implement a simple Plugin for our Camunda-Cockpit. I am displaying a list of all processes in the history table that have the state “COMPLETED”.

Now I am trying to add a paging-functionality to this list.

The html part of the plugin looks like the following:

The query in the xml file looks like this:

paging1

At a lot of places the Camunda Plugins do also already provide a paging functionality.
I am wondering if there is some kind of template or function that can be used to add the paging-functionality to my own Plugin? Or has anyone ever implemented such a paging-functionality for a Camunda Plugin by themself?

Thanks in advance.

Regards
Michael

Hi @MichiDahm,

You actually have to provide paging functionality since from version 7.12, unbounded queries in the Webapps are not allowed. You can check out the following query to see how it’s done: https://github.com/camunda/camunda-bpm-platform/blob/d5ea8f1513e064db25db38b2cce23f14990d4799/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml#L182-L191

The limit values are provided through Java code when the MyBatis library resolves the queries.

Best,
Nikola

2 Likes

Hi @nikola.koevski,

thanks for your answer.

I was able to improve the code of my plugin.

The query now looks like this:

paging4

And in my Java Code i used a QueryParameters object to set the values for firstResult and maxResults:

This code does indeed only return the first then elements of the query.

But how do I go on at this place?
How do I know the number of pages, and how do I display this information in the UI and execute the next query from the UI to get the next ten values?

Regards
Michael

AFAIK, count endpoints are used to determine the total count of an Entity. They usually don’t have any limits set since their only purpose is to return the number of records for the given criteria.

Best,
Nikola

1 Like