Can we extend CamundaPropertiesProvider?


#1

Hello, i am trying to create my own custom Camunda Properties Provider, but instead of just overriding the original one, can i extend it?

And this way, if the developpers ever change anything in the code, the changes would appear in my project.
I would just just like to update the general tab with some minor changes, that’s all, and keep the rest.


#2

If you want to customize the general tab you can still use prototypal inheritance in order to do so. The problem is that there is no method like getGeneralTab on the protoype so you can’t just change that. What you could do is override getTabs and do something like

var CamundaPropertiesProvider = require('./CamundaPropertiesProvider');

function MyCamundaPropertiesProvider(...) {
  CamundaPropertiesProvider.call(this, eventBus);

  // save a reference to original method
  var baseGetTabs = this.getTabs.bind(this);

  // override original method
  this.getTabs = function(element) {

    // call original method
    var tabs = baseGetTabs(element);

    // get index of general tab
    var generalTabIndex = tabs.indexOf(tabs.filter(function(tab) { return tab.id === 'general'; })[0]);

    // override original tab
    tabs[generalTabIndex] = getMyCustomGeneralTab(element);
  }
}

#3

Alright, i will try this. I tried use binding of some form, but it didn’t work before.
I hope this will work. Thank you so much!

And this can be done with other things like the Palette as well?


#4

Yes, you can use it for the Palette as well.