Add generic SimpleCollection base classes to reduce collection boilerplate#964
Conversation
…ses to reduce boilerplate in collection management Co-authored-by: sridmad <7445097+sridmad@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors Service Fabric Explorer collection models by introducing a generic factory pattern to reduce boilerplate code. The refactoring creates two new generic base classes (SimpleCollection and SimpleCollectionWithParent) that encapsulate common patterns for fetching data and mapping it to model instances.
Changes:
- Added
SimpleCollectionandSimpleCollectionWithParentgeneric base classes in CollectionBase.ts - Refactored 4 collection classes (BackupPolicyCollection, ApplicationBackupConfigurationInfoCollection, ServiceBackupConfigurationInfoCollection, SinglePartitionBackupCollection) to use the new generic pattern
- Added comprehensive unit tests for the new generic collection classes
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/SfxWeb/src/app/Models/DataModels/collections/CollectionBase.ts | Added two new generic collection base classes with type-safe constructors and fetch patterns |
| src/SfxWeb/src/app/Models/DataModels/collections/Collections.ts | Refactored 4 collection classes to use the new generic pattern, reducing boilerplate code |
| src/SfxWeb/src/app/Models/DataModels/collections/CollectionBase.spec.ts | Added comprehensive unit tests covering both generic collection classes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread run tests and resolve fixed comments |
…dback Co-authored-by: sridmad <7445097+sridmad@users.noreply.github.com>
Applied all review changes in commit 6268c0f:
Build, lint, and all 79 tests pass. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread run tests on changes |
Co-authored-by: sridmad <7445097+sridmad@users.noreply.github.com>
Removed unused Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot update other existing collection classes to leverage this change. |
…ceCollection to use generic base classes Co-authored-by: jeffj6123 <15344718+jeffj6123@users.noreply.github.com>
Refactored 3 additional collection classes to use the generic base classes in commit 49bfe62:
Other collections like Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SimpleCollectionandSimpleCollectionWithParentgeneric base classes in CollectionBase.tsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.