grafana-prometheus-alertmanager-datasource
grafana-prometheus-alertmanager-datasource copied to clipboard
refactor: rewrite plugin to add multiples queries support
With this PR, I completely rewrite this plugin to add the possibility to have multiples possibles queries to execute and be able to choose the one we want through a scenario
parameter.
Indeed, I introduced a new QueryEditor type called EditorQuery
, it's extends DataQuery
and have a scenario attribute.
All custom QueryEditors will now extends EditorQuery
instead of DataQuery
to have this new common attribute.
On the query editor view of the plugin, a new selector will be available to choose which query we want to build. If user change this settings, the query editor will be updated for the new scenario with associated fields for the query config. Atm, only one scenario is available which is the old one for alerts but a new one is coming to fetch silences rules from Alertmanager.
Before:
Now:
By doing this change, I must rewrite almost all this plugin. So, I refactor others aspects of the code and updated some parts of it to more modern typescript.