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

feat: multiselect alert measure #5292

Closed
wants to merge 6 commits into from
Closed

Conversation

mindspank
Copy link
Contributor

Allows for multi measure alerts.

Todo:

  • Alert Preview queries for the Data and Criteria tab still fires when there is no valid measure or incomplete criteria

@ericpgreen2 ericpgreen2 self-requested a review July 16, 2024 15:10
Copy link
Contributor

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 the WithTogglableFloatingElement and Menu components.

Copy link
Contributor Author

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

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a 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(),
Copy link
Collaborator

@AdityaHegde AdityaHegde Jul 24, 2024

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 };
Copy link
Collaborator

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;
Copy link
Collaborator

@AdityaHegde AdityaHegde Jul 24, 2024

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?

@mindspank
Copy link
Contributor Author

Closing in favour of new PR that also includes multi dimensional selects

@mindspank mindspank closed this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants