-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upcoming: [M3-7213] - DC Get Well endpoints, queries, and mock data (#…
…9860) * endpoints and endpoint types for dc get well * dc get well react query * mock data * update endpoint oops * changesets * fix mock data * update to region capabilities * Update packages/manager/.changeset/pr-9860-upcoming-features-1698852576816.md Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com> * Update packages/api-v4/.changeset/pr-9860-upcoming-features-1698852464578.md Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com> --------- Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
- Loading branch information
1 parent
edbb12f
commit e9e4aef
Showing
8 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/api-v4/.changeset/pr-9860-upcoming-features-1698852464578.md
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 @@ | ||
--- | ||
"@linode/api-v4": Upcoming Features | ||
--- | ||
|
||
Add `getAccountAvailabilities` and `getAccountAvailability` methods for DC Get Well initiative ([#9860](https://github.com/linode/manager/pull/9860)) |
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
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9860-upcoming-features-1698852576816.md
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 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Add RQ queries and mock data for DC Get Well ([#9860](https://github.com/linode/manager/pull/9860)) |
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 { AccountAvailability } from '@linode/api-v4'; | ||
import * as Factory from 'factory.ts'; | ||
|
||
import { pickRandom } from 'src/utilities/random'; | ||
|
||
export const accountAvailabilityFactory = Factory.Sync.makeFactory<AccountAvailability>( | ||
{ | ||
id: pickRandom(['us-mia', 'ap-south', 'ap-northeast']), | ||
unavailable: pickRandom([ | ||
['Block Storage'], | ||
['Linodes', 'Block Storage', 'Kubernetes', 'NodeBalancers'], | ||
]), | ||
} | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
AccountAvailability, | ||
getAccountAvailabilities, | ||
getAccountAvailability, | ||
} from '@linode/api-v4/lib/account'; | ||
import { | ||
APIError, | ||
Filter, | ||
Params, | ||
ResourcePage, | ||
} from '@linode/api-v4/lib/types'; | ||
import { useQuery } from 'react-query'; | ||
|
||
const queryKey = 'account-availability'; | ||
|
||
export const useAccountAvailabilitiesQuery = ( | ||
params: Params, | ||
filter: Filter, | ||
enabled: boolean = true | ||
) => { | ||
return useQuery<ResourcePage<AccountAvailability>, APIError[]>( | ||
[queryKey, 'paginated', params, filter], | ||
() => getAccountAvailabilities(params, filter), | ||
{ | ||
enabled, | ||
keepPreviousData: true, | ||
} | ||
); | ||
}; | ||
|
||
export const useAccountAvailabilityQuery = ( | ||
id: string, | ||
enabled: boolean = true | ||
) => { | ||
return useQuery<AccountAvailability, APIError[]>( | ||
[queryKey, 'accountAvailability', id], | ||
() => getAccountAvailability(id), | ||
{ | ||
enabled, | ||
} | ||
); | ||
}; |