fbaligand / kibana-enhanced-table

Kibana visualization like a Data Table, but with enhanced features like computed columns, filter bar, and “Split Cols” bucket
Apache License 2.0
305 stars 65 forks source link

Adding Shared Code #302

Open kobi2c opened 1 year ago

kobi2c commented 1 year ago

Would it be possible to add "shared code" text field to computed fields UI?

Motive

The idea is "Shared code" will be prepended to each expression:

It will make it much easier to maintain the table since there will be one place to update the repeated code ( variables, columns titles, functions and so on).

Sample use case

Suppose we have the following expression in each computed field:

cssChange(s1) = if ( s1 >= 0 , "color: #480" , "color:#F00" ); cssChange(value)

If we want to update the colors, we need to update all the computed fields. It is time consuming and error prone :(

However with the shared code feature, we can write in the shared code:

cssChange(s1) = if ( s1 >= 0 , "color: #480" , "color:#F00" );

And in each computed field:

cssChange(value)

Now it is much easier to change the colors as we need to update the code in one place :)

fbaligand commented 1 year ago

This could be an enhancement. How would you see that feature? A textarea named "Shared code"?

kobi2c commented 1 year ago

Yes, textarea named "Shared code" in "Enhanced Settings" section.