Skip to content

Commit

Permalink
rename getNodesAllocatedTo to getAttachedNodes for address pools
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwang401 committed Nov 28, 2023
1 parent 375e338 commit fae34af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeResponse> => {
Expand All @@ -32,4 +32,4 @@ const getNodesAllocatedTo = async (
}
}

export default getNodesAllocatedTo
export default getAttachedNodes
Original file line number Diff line number Diff line change
@@ -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 = (
Expand All @@ -13,7 +13,7 @@ const useAddressPoolNodesSWR = (
return useSWR<NodeResponse>(
['admin.address-pools.nodes', poolId, page, query],
() =>
getNodesAllocatedTo(poolId, {
getAttachedNodes(poolId, {
page,
query,
...params,
Expand Down
2 changes: 1 addition & 1 deletion routes/api-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fae34af

Please sign in to comment.