Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-6341

[DMN Designer] New Boxed Expression editor - Improve reusability

    XMLWordPrintable

Details

    Description

      All components present on the Boxed Expression Component should be re-usable in other contexts. This improves the components legibility and maintance.

       

      This task aims the called Expression components, such as:

      • ContextExpression
      • DecisionTableExpression
      • FunctionExpression
      • InvocationExpression
      • ListExpression
      • LiteralExpression
      • RelationExpression

       

      Rendering an Expression alone will not change the `expressionDefinition`, which is the state responsible to save the current expression. This state is passed down on the tree on the `BoxedExpressionEditor`. 

      The Expression components work by updating the `expressionDefinition` state, which is created by the parent component of the `BoxedExpressionEditor`, and this is done by calling a `spread` callback, which in turn will call a function from the `beeApi`. A few considerations about this flow:

      • The `expressionDefinition` should be updated when the component is rendered, thus the `spread` function needs to be called at least one time. 
      • The `beeApi` is a global API attached to the Window, therefore it limits an application to have only one Expression by window.

       

      In the Expression components, this flow only works because the `ResizerSupervisor` happens to change the `width` of the cells, calling the `onColumnUpdate` callback (which calls the `spread` callback) for each cell (performance issue). The only exception for the specified behavior is the LiteralExpression, which is currently with an opened issue https://issues.redhat.com/browse/KOGITO-6326 .

       

      By addressing these issues, our React components will be much more flexible, improve the legibility and the maintenance of the components, as they'll work independently of the context. I think this is a good next step for improving the overall reusability of the Boxed Expression components that is already a very important piece for both the DMN Editor and the DMN Runner. As for the performance issue I've mentioned, this can be addressed later too, making the whole set of components even better.

       

      On this branch, the showcase was modified and has two LiteralExpressions. It's not possible to change one without changing the other. I've uploaded a video showing the actual behavior.

      Attachments

        Activity

          People

            lmotta@redhat.com Luiz Motta (Inactive)
            lmotta@redhat.com Luiz Motta (Inactive)
            Tomas David Tomas David
            Tomas David Tomas David
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: