Skip to content

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
bctiemann added a commit that referenced this pull request Jan 28, 2025
…ow (#18375)

* Fix validation of site in Assign Device to Cluster flow

* Validate Location as well as Site scope
bctiemann added a commit that referenced this pull request Jan 29, 2025
…ow (#18375)

* Fix validation of site in Assign Device to Cluster flow

* Validate Location as well as Site scope
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot Assign devices to Cluster

3 participants