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

Fixes: #18373 - Fix validation of site in Assign Device to Cluster flow #18375

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

bctiemann
Copy link
Contributor

Fixes: #18373

Assigning a Device to a Cluster goes through a validation to ensure the Site of both objects is the same. Because Cluster is now generically scoped, this causes an error as Cluster.site no longer exists.

This change fixes the validation to compare Site objects properly, and also conforms to a pattern that can be extended to validate Location, Site Group, etc. scopes if they are added to the Assign Device form in the future.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

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

I think we need to validate every potential type of cluster scope (region, site group, site, or location). Ideally, this should happen under the model validation, but that might be difficult to manage given the deviation from standard patterns in this particular view.

@bctiemann
Copy link
Contributor Author

As it turns out Device doesn't have site_group or region fields, only site and location. So I extended this validation to cover both those fields, and it means it's further a pattern outlier that isn't likely to be applicable to many other objects that aren't fully scoped.

Also note that this validation will throw an error of one of the Device or Cluster has a value specified but the other is null. Maybe we don't want that to be an error condition?

@jeremystretch jeremystretch merged commit 993d8f1 into main Jan 17, 2025
6 checks passed
@jeremystretch jeremystretch deleted the 18373-fix-assign-device-to-cluster-scope branch January 17, 2025 13:35
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.

Cannot Assign devices to Cluster
2 participants