Multiple buttons in one Camunda tasklist plugin

61 Views Asked by At

Im currently trying to write a tasklist plugin for camunda. My goal is a plugin having multiple buttons doing different stuff. My pluginPoint is supposed to be 'tasklist.task.detail'. I saw a youtube video where someone implemented one button by using node.onclick. But having multiple buttons doesn't seem to be working with that. Can I put nodes inside nodes? My current approach is just writing a '.html' like string using it with node.innerHTML. But that doesn't seem to work either because the functions of my script don't get seen when cllicking the button.

I'm not sure if I have to write some kind of Java plugin for that but I'm currently not thinking so because I don't want to change any existing functionality nor extend the backend in any way.

export default {
  id: 'tasklist.myButtons',
  pluginPoint: 'tasklist.task.detail',
  priority: 9001,
  render: (node) => {
    const myContent = `
    <!DOCTYPE html>
    <script>
      function complete(){
        console.log("complete was pressed");
      }

      function claim(){
        console.log("claim was pressed");
      }
    </script>
    
    <button onclick="complete()">Complete</button>
    <button onclick="claim()">Claim</button>
    `
    node.innerHTML = myContent;
    node.onclick = function(){
      for(var p in node){
        console.log(p)
      }
    }
  },
  properties: {
    label: 'myButtons'
  }

}

I disabled contentSecurityHeaders so my script doesn't just get blocked right away (knowing this is probably not the smartest way) I'd be very thankful for some help.

My buttons themselves are shown fine

Hope you have a nice day!

0

There are 0 best solutions below