chore(drilldown): add documentation for `getParentChain`

This commit is contained in:
Martin Stamm 2022-01-13 09:31:18 +01:00
parent c89f4a4e02
commit 70d38eb447
1 changed files with 14 additions and 5 deletions

View File

@ -22,17 +22,17 @@ export default function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays
container.appendChild(breadcrumbs);
function updateBreadcrumbs(currentRoot) {
var parents = getParentChain(currentRoot);
var boParents = getBoParentChain(currentRoot);
var path = parents.map(function(parent) {
var path = boParents.map(function(parent) {
var title = escapeHTML(parent.name || parent.id);
var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
var parentPlane = canvas.findRoot(planeId(parent)) || canvas.findRoot(parent.id);
// when the root is a collaboration, the process does not have a corresponding
// element in the elementRegisty. Instead, we search for the corresponding participant
if (!parentPlane && is(parent, 'bpmn:Process')) {
// root is a collaboration
var participant = elementRegistry.find(function(element) {
var bo = getBusinessObject(element);
return bo && bo.processRef && bo.processRef === parent;
@ -69,7 +69,16 @@ DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'overlays', 'can
// helpers
function getParentChain(child) {
/**
* Returns the parents for the element using the business object chain,
* starting with the root element.
*
* @param {djs.model.Shape} child
*
* @returns {Array<djs.model.Shape>} parents
*/
function getBoParentChain(child) {
var bo = getBusinessObject(child);
var parents = [];