-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vrack-services): refactor codebase to follow best practices
ref: MANAGER-16503 Signed-off-by: Quentin Pavy <[email protected]>
- Loading branch information
Quentin Pavy
committed
Jan 6, 2025
1 parent
da641d0
commit 5620f56
Showing
86 changed files
with
394 additions
and
460 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/manager/apps/vrack-services/mocks/vrack/association.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/vrack-services/src/data/vrack/delete.ts → ...elete/dissociateVrackServicesFromVrack.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/manager/apps/vrack-services/src/data/api/delete/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dissociateVrackServicesFromVrack'; |
14 changes: 14 additions & 0 deletions
14
packages/manager/apps/vrack-services/src/data/api/get/elegibleManagedServiceList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
import { EligibleManagedService } from '@/types'; | ||
|
||
export const getEligibleManagedServiceListQueryKey = ( | ||
vrackServicesId: string, | ||
) => [`get/vrackServices/resource/${vrackServicesId}/eligibleManagedService`]; | ||
|
||
/** | ||
* List all managed services eligible to the requested vRack Services | ||
*/ | ||
export const getEligibleManagedServiceList = async (vrackServicesId: string) => | ||
apiClient.v2.get<EligibleManagedService[]>( | ||
`/vrackServices/resource/${vrackServicesId}/eligibleManagedService`, | ||
); |
2 changes: 1 addition & 1 deletion
2
...r/apps/vrack-services/src/data/iam/get.ts → ...-services/src/data/api/get/iamResource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/manager/apps/vrack-services/src/data/api/get/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export * from './vrackServicesResource'; | ||
export * from './vrackServicesResourceList'; | ||
export * from './iamResource'; | ||
export * from './elegibleManagedServiceList'; | ||
export * from './vrackList'; | ||
export * from './vrackAllowedServices'; | ||
export * from './vrackServicesReferenceRegionList'; |
25 changes: 25 additions & 0 deletions
25
packages/manager/apps/vrack-services/src/data/api/get/vrackAllowedServices.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
import { | ||
AllowedServicesResponse, | ||
GetVrackAllowedServicesParams, | ||
} from '@/types'; | ||
|
||
export const getVrackAllowedServicesQueryKey = ({ | ||
vrack, | ||
serviceFamily, | ||
}: GetVrackAllowedServicesParams) => [ | ||
`get/vrack/${vrack}/allowedServices${serviceFamily || ''}`, | ||
]; | ||
|
||
/** | ||
* allowedServices operations : List all services allowed in this vrack | ||
*/ | ||
export const getVrackAllowedServices = async ({ | ||
vrack, | ||
serviceFamily, | ||
}: GetVrackAllowedServicesParams) => | ||
apiClient.v6.get<AllowedServicesResponse>( | ||
`/vrack/${vrack}/allowedServices${ | ||
serviceFamily ? `?serviceFamily=${serviceFamily}` : '' | ||
}`, | ||
); |
5 changes: 5 additions & 0 deletions
5
packages/manager/apps/vrack-services/src/data/api/get/vrackList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
|
||
export const getVrackListQueryKey = ['get/vrack']; | ||
|
||
export const getVrackList = () => apiClient.v6.get<string[]>('/vrack'); |
12 changes: 12 additions & 0 deletions
12
packages/manager/apps/vrack-services/src/data/api/get/vrackServicesReferenceRegionList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
import { Region } from '@/types'; | ||
|
||
export const getvrackServicesReferenceRegionListQueryKey = [ | ||
'get/vrackServices/reference/region', | ||
]; | ||
|
||
/** | ||
* List all vRack Services regions | ||
*/ | ||
export const getvrackServicesReferenceRegionList = () => | ||
apiClient.v2.get<Region[]>('/vrackServices/reference/region'); |
14 changes: 14 additions & 0 deletions
14
packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
import { VrackServicesWithIAM } from '@/types'; | ||
|
||
export const getVrackServicesResourceQueryKey = (vrackServicesId: string) => [ | ||
`get/vrackServices/resource/${vrackServicesId}`, | ||
]; | ||
|
||
/** | ||
* Get the vRack Services | ||
*/ | ||
export const getVrackServicesResource = async (vrackServicesId: string) => | ||
apiClient.v2.get<VrackServicesWithIAM>( | ||
`/vrackServices/resource/${vrackServicesId}`, | ||
); |
21 changes: 21 additions & 0 deletions
21
packages/manager/apps/vrack-services/src/data/api/get/vrackServicesResourceList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { apiClient } from '@ovh-ux/manager-core-api'; | ||
import { | ||
GetVrackServicesResourceListParams, | ||
VrackServicesWithIAM, | ||
} from '@/types'; | ||
|
||
export const getVrackServicesResourceListQueryKey = [ | ||
'get/vrackServices/resource', | ||
]; | ||
|
||
/** | ||
* Operations on vRack Services : List all vRack Services | ||
*/ | ||
export const getVrackServicesResourceList = async ({ | ||
cursor, | ||
}: GetVrackServicesResourceListParams = {}) => | ||
apiClient.v2.get<VrackServicesWithIAM[]>('/vrackServices/resource', { | ||
headers: { | ||
'X-Pagination-Cursor': cursor, | ||
}, | ||
}); |
3 changes: 1 addition & 2 deletions
3
...ps/vrack-services/src/data/vrack/index.ts → ...apps/vrack-services/src/data/api/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './get'; | ||
export * from './put'; | ||
export * from './post'; | ||
export * from './delete'; | ||
export * from './vrack.type'; | ||
export * from './hooks'; |
9 changes: 1 addition & 8 deletions
9
...pps/vrack-services/src/data/vrack/post.ts → ...c/data/api/post/associateVrackServices.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/manager/apps/vrack-services/src/data/api/post/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './associateVrackServices'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './updateVrackServices'; |
5 changes: 1 addition & 4 deletions
5
...k-services/src/data/vrack-services/put.ts → ...s/src/data/api/put/updateVrackServices.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './useVrackServicesList'; | ||
export * from './useVrackServices'; | ||
export * from './useUpdateVrackServices'; | ||
export * from './useServiceList'; | ||
export * from './useAssociateVrack'; | ||
export * from './useDissociateVrack'; | ||
export * from './useAllowedVrackList'; | ||
export * from './useVrackList'; |
8 changes: 4 additions & 4 deletions
8
...c/data/vrack/hooks/useAllowedVrackList.ts → ...ces/src/data/hooks/useAllowedVrackList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.