refactor: rewrite plugin to add multiples queries support #129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 extendsDataQuery
and have a scenario attribute.All custom QueryEditors will now extends
EditorQuery
instead ofDataQuery
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.