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(compass-saved-aggregations-queries): update namespace for saved aggregations/queries (COMPASS-7665) #5462

Merged
merged 6 commits into from
Feb 27, 2024

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Feb 16, 2024

Description

If a collection is renamed, any queries or aggregations associated with that namespace are not updated. Users have the ability to open a query or aggregation by selecting the namespace, but they have no way of permanently re-associating a namespace with their queries/aggregations.

This PR adds the ability to permanently update the name space associated with an aggregation or query when they use they open it from the "select namespace" modal. This scenario may become more common after the "rename collection" feature is released.

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@baileympearson baileympearson marked this pull request as ready for review February 20, 2024 23:00
});
} else if (selectedItem.type === 'query') {
await queryStorage?.updateAttributes(id, { _ns: newNamespace });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we shouldn't dispatch some 'itemUpdated' action here. probably not necessary, it just feels weird that there would be no trace of this change happening in redux.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, I'd say that as in this case there is no effect on the actual reducer and we already dispatch an action that you can trace back to this handler, it's okay not to do this. Maybe if there was even more logic involved and the state of the update was part of the reducer, this would make more sense to do. Good point though!

className={checkbox}
checked={updateItemNamespace}
onChange={(event) => {
dispatch(updateItemNamespaceChecked(event.target.checked));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Super nit, feel free to ignore: as we are already using connect and mapDispatch here, it might be a bit cleaner to stick with the pattern for now

});
} else if (selectedItem.type === 'query') {
await queryStorage?.updateAttributes(id, { _ns: newNamespace });
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, I'd say that as in this case there is no effect on the actual reducer and we already dispatch an action that you can trace back to this handler, it's okay not to do this. Maybe if there was even more logic involved and the state of the update was part of the reducer, this would make more sense to do. Good point though!

@baileympearson baileympearson merged commit 7d3b82a into main Feb 27, 2024
16 checks passed
@baileympearson baileympearson deleted the COMPASS-7665 branch February 27, 2024 15:09
kmruiz pushed a commit that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants