getPopupMenuEntries

In getPopupMenuEntries, i want to show only sub-process (collapsed) menu. So that i have written this below code.

Once the sub-process (collapsed) menu is Selected. why that sub-process name got disappeared?.

import { omit } from 'min-dash';

class CustomReplacePadProvider {
  constructor(eventBus, modeling, popupMenu, moddle, bpmnFactory, bpmnReplace) {
    this.modeling = modeling;
    this.moddle = moddle;
    this.replace = bpmnReplace;
    this.eventBus = eventBus;
    this.bpmnFactory = bpmnFactory;

    popupMenu.registerProvider('bpmn-replace', this);
  }

  getPopupMenuHeaderEntries(target) {
    return function(entries) {
      return omit(entries, [
        'toggle-parallel-mi',
        'toggle-sequential-mi',
        'toggle-loop'
      ]);
    };
  }

  getPopupMenuEntries(element) {
    return (entries) => {
      const filteredObject = {};

      for (let key in entries) {
        if (key !== 'replace-with-collapsed-subprocess') {
          continue;
        }
        filteredObject[key] = entries[key];
      }
      console.log('Filtered Entries:', filteredObject)
      return filteredObject;
    };
  }
}

CustomReplacePadProvider.$inject = [
  'eventBus', 
  'modeling', 
  'popupMenu', 
  'moddle', 
  'bpmnFactory', 
  'replace'
];

export default {
  __init__: ['customReplacePadProvider'],
  customReplacePadProvider: ['type', CustomReplacePadProvider]
};

BEFORE SELECT - SUB PROCESS COLLAPSE
Screenshot 2024-06-12 172908

AFTER SELECT - SUB PROCESS COLLAPSE
Screenshot 2024-06-12 173020

The element is now a collapsed subprocess. We do not show replace options for the same element type, e.g. you can’t replace a ServiceTask with another ServiceTask.

thanks for your clarification Martin.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.