From fae34af2b34df0d8345144573cc6774ef7f185b5 Mon Sep 17 00:00:00 2001 From: Eric Wang <37554696+ericwang401@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:03:26 -0600 Subject: [PATCH] rename getNodesAllocatedTo to getAttachedNodes for address pools --- .../Admin/AddressPools/AddressPoolController.php | 2 +- .../{getNodesAllocatedTo.ts => getAttachedNodes.ts} | 4 ++-- .../api/admin/addressPools/useAddressPoolNodesSWR.ts | 6 +++--- routes/api-admin.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename resources/scripts/api/admin/addressPools/{getNodesAllocatedTo.ts => getAttachedNodes.ts} (92%) diff --git a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php index ad2594f7d63..b5c85ae3572 100644 --- a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php +++ b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php @@ -35,7 +35,7 @@ public function show(AddressPool $addressPool) return fractal($addressPool, new AddressPoolTransformer)->respond(); } - public function getNodesAllocatedTo(Request $request, AddressPool $addressPool) + public function getAttachedNodes(Request $request, AddressPool $addressPool) { $nodes = QueryBuilder::for($addressPool->nodes()) ->withCount('servers') diff --git a/resources/scripts/api/admin/addressPools/getNodesAllocatedTo.ts b/resources/scripts/api/admin/addressPools/getAttachedNodes.ts similarity index 92% rename from resources/scripts/api/admin/addressPools/getNodesAllocatedTo.ts rename to resources/scripts/api/admin/addressPools/getAttachedNodes.ts index ecac6843713..c0a6828797e 100644 --- a/resources/scripts/api/admin/addressPools/getNodesAllocatedTo.ts +++ b/resources/scripts/api/admin/addressPools/getAttachedNodes.ts @@ -9,7 +9,7 @@ export interface QueryParams { perPage?: number | null } -const getNodesAllocatedTo = async ( +const getAttachedNodes = async ( addressPoolId: number, { query, fqdn, locationId, page, perPage = 50 }: QueryParams ): Promise => { @@ -32,4 +32,4 @@ const getNodesAllocatedTo = async ( } } -export default getNodesAllocatedTo +export default getAttachedNodes diff --git a/resources/scripts/api/admin/addressPools/useAddressPoolNodesSWR.ts b/resources/scripts/api/admin/addressPools/useAddressPoolNodesSWR.ts index a1cb8dda2dc..cf908ed7924 100644 --- a/resources/scripts/api/admin/addressPools/useAddressPoolNodesSWR.ts +++ b/resources/scripts/api/admin/addressPools/useAddressPoolNodesSWR.ts @@ -1,9 +1,9 @@ import { useParams } from 'react-router-dom' import useSWR from 'swr' -import getNodesAllocatedTo, { +import getAttachedNodes, { QueryParams, -} from '@/api/admin/addressPools/getNodesAllocatedTo' +} from '@/api/admin/addressPools/getAttachedNodes' import { NodeResponse } from '@/api/admin/nodes/getNodes' const useAddressPoolNodesSWR = ( @@ -13,7 +13,7 @@ const useAddressPoolNodesSWR = ( return useSWR( ['admin.address-pools.nodes', poolId, page, query], () => - getNodesAllocatedTo(poolId, { + getAttachedNodes(poolId, { page, query, ...params, diff --git a/routes/api-admin.php b/routes/api-admin.php index 7bad3cc68a4..6bc927855b1 100644 --- a/routes/api-admin.php +++ b/routes/api-admin.php @@ -56,7 +56,7 @@ Route::resource('address-pools', Admin\AddressPools\AddressPoolController::class) ->only(['index', 'show', 'store', 'update', 'destroy']); Route::prefix('/address-pools/{address_pool}')->group(function () { - Route::get('/nodes', [Admin\AddressPools\AddressPoolController::class, 'getNodesAllocatedTo']); + Route::get('/attached-nodes', [Admin\AddressPools\AddressPoolController::class, 'getAttachedNodes']); }); Route::resource('address-pools.addresses', Admin\AddressPools\AddressController::class)