Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields: Regex - custom multi-select levels variable #1030

Conversation

gtk-grafana
Copy link
Contributor

@gtk-grafana gtk-grafana commented Feb 1, 2025

Parent branch: #1029

This PR adds a custom renderer for the levels field to more prominently surface detected_level filters.

image image image

…ator-ui__variable-ui' into gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui__levels-tweaks
@gtk-grafana gtk-grafana changed the title Fields: Regex - tweak levels variable for multi-select Fields: Regex - tweak levels variable for multi-select - PoC Feb 1, 2025
@gtk-grafana gtk-grafana mentioned this pull request Feb 1, 2025
@gtk-grafana gtk-grafana self-assigned this Feb 4, 2025
@gtk-grafana gtk-grafana added this to the 1.0.8 milestone Feb 4, 2025
@gtk-grafana gtk-grafana added the enhancement New feature or request label Feb 4, 2025
@gtk-grafana
Copy link
Contributor Author

There is certainly more to follow up on here, but I'll argue as of this this PR we have a minimally shippable feature.
Opening for review 🎉 🎉 🎉

@gtk-grafana gtk-grafana marked this pull request as ready for review February 4, 2025 13:45
@gtk-grafana gtk-grafana requested a review from a team as a code owner February 4, 2025 13:45
…ator-ui__variable-ui' into gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui__levels-tweaks
…ator-ui__variable-ui' into gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui__levels-tweaks
…ator-ui__variable-ui' into gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui__levels-tweaks
@gtk-grafana gtk-grafana changed the title Fields: Regex - tweak levels variable for multi-select - PoC Fields: Regex - custom multi-select levels variable Feb 4, 2025
Copy link
Contributor

@matyax matyax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works very well! Left a few minor comments and suggestions.

});
};

updateFilters = (skipPublish: boolean, forcePublish?: boolean) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
updateFilters = (skipPublish: boolean, forcePublish?: boolean) => {
updateFilters = (skipPublish: boolean, forcePublish = false) => {

Comment on lines +131 to +134
if (filters.length) {
return `| ${LEVEL_VARIABLE_VALUE}=~\`${filters.map((f) => f.value).join('|')}\``;
}
return '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
if (filters.length) {
return `| ${LEVEL_VARIABLE_VALUE}=~\`${filters.map((f) => f.value).join('|')}\``;
}
return '';
if (filters.length > 1) {
return `| ${LEVEL_VARIABLE_VALUE}=~\`${filters.map((f) => f.value).join('|')}\``;
} else if (filters.length === 1) {
return `| ${LEVEL_VARIABLE_VALUE}=\`${filters[0].value}\``;
}
return '';

@gtk-grafana gtk-grafana merged commit dae9757 into gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui Feb 5, 2025
3 checks passed
@gtk-grafana gtk-grafana deleted the gtk-grafana/issues/1009/regex-fields-from-explore__operator-ui__variable-ui__levels-tweaks branch February 5, 2025 13:03
gtk-grafana added a commit that referenced this pull request Feb 5, 2025
* Fields: Regex - Supporting regex fields from Explore (#1023)
* Fields: Regex - Operator UI updates and double-quotes (#1028)
* Fields: Regex - Combining metadata and fields (#1029)
* Fields: Regex - custom multi-select levels variable  (#1030)

---------

Co-authored-by: Matias Chomicki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants