-
Notifications
You must be signed in to change notification settings - Fork 117
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
feat: multiselect alert measure #5292
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things given this will be the first instance of this component in the application:
- Nit: This is a vanilla multi-select, not a "combobox", because it doesn't include a freeform text input & autocomplete. So we should rename this file to
MultiSelect.svelte
- ShadCN Svelte doesn't have a multi-select or a multi-select combobox, but it does recommend this guide for how to do a multi-select with BitsUI (which ShadCN Svelte is built upon).
- We should use the ShadCN
DropdownMenu
in place of theWithTogglableFloatingElement
andMenu
components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, it technically does have free form input and autocomplete if the main input is not set to readonly though. Don't think we ever used it anywhere in the app though so happy to get rid of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Approving so you can merge at your discretion.
@@ -19,7 +19,6 @@ | |||
function handleAddCriteria() { | |||
$form["criteria"] = $form["criteria"].concat({ | |||
...getEmptyMeasureFilterEntry(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can just be $form["criteria"].concat(getEmptyMeasureFilterEntry())
const mappedMeasure = metricsViewSpec.measures | ||
? metricsViewSpec.measures.find((mm) => mm.name === m.name) | ||
: null; | ||
return { value: m.name, label: mappedMeasure?.label }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this fallback to expression when label is empty?
@@ -73,12 +73,6 @@ | |||
if (!name) return; | |||
$form.name = name; | |||
} | |||
|
|||
$: measure = $form.measure; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still have this i feel. Right now if you deselect a measure with criteria, the criteria form shows empty value but i think the $form.criteria
still has the old measure value. So I can still create the alert with a criteria with a measure not actually selected. Which leads to a query error,
Alert check failed: failed to resolve alert: failed to execute query: failed to compile 'having': name "total_records" in expression is not a dimension or measure available in the current context
Perhaps we should unset the measure name in the criteria if it is not selected in the list of measures?
Closing in favour of new PR that also includes multi dimensional selects |
Allows for multi measure alerts.
Todo: