Context
With the new Bolt architecture, Impac! widgets API is able to render unified responses, sharing common pivot-formats called "layouts".
While writing the new Impac! Angular v2 library, the goal is to make the most of this capability: instead of using one custom front-end component per widget endpoint (as per the v1), we want to define generic templates, each of them based on one or several layouts.
Each widget will support one or several layouts. After the widget has computed its metrics, it is going to "fill" the supported layouts required by the user (as specified in the request to the API), and render all the layouts with the response.
Each layout will have its own structure, regardless of the widget using it. Each widget has to advertise what are its supported layouts. This information can be retrieved by calling the INDEX endpoint of the widgets API (no authentication required).
Here are the potential layouts identified so far:
highstocks
highcharts
plain_chart
figure
table
grouped_table
A "template" is an angular component that takes one or several layouts as a data source to render a widget.
For example, the widget endpoint "balance_sheet" may specify it supports the layout "grouped_table", in which case when a user tries to add a Balance Sheet widget to his dashboard, Impac! Angular will fetch the widget content (structured in a grouped_table layout), and inject it to the grouped-table template component.
Some templates will be made of combinations of layouts. For example, the template ratio needs a widget compatible with the layouts "grouped_table" and "highstocks" to render.
Here are the potential templates identified so far, with the corresponding existing widgets (A=Accounting, I=Invoicing, H=HR, S=Sales):
highstocks
highcharts
figure
figure-plus-highstocks
ratio (other template using figure + highstocks layouts)
collapsable-figure-plus-highstocks (other template using figure + highstocks layouts)
grouped_table-plus-highstocks
grouped_table
funnel (other template using the grouped_table layout) / existing template should be reworked completely
table
details (other template using the table layout)
? (very specific templates)