-
Notifications
You must be signed in to change notification settings - Fork 19
Manage IP pools #1910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Manage IP pools #1910
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
de66425
basic IP pools page and list silos for pool
david-crespo adef77b
Stubbing out tabs for silo IP pools
charliepark 4bd7ff7
Stubbing out tabs for silo IP pools
charliepark 5b88a8e
Switch to query param-based URL and tabs
charliepark 7447f00
Copy change
charliepark d5a1e85
Cleanup on IP Pools page, but not there yet
charliepark 4fb4acd
use the right API endpoint
david-crespo a0afdcf
Merge branch 'main' into ip-pools-ui
david-crespo 159e627
make/clear default row action
david-crespo 0c3c848
use silo page loader for API calls backing the tabs
david-crespo 33c1527
tweak display
david-crespo 5ff5d6c
move fleet role mapping into a tab
david-crespo c8b7a81
add properties table to silo detail
david-crespo f8b5968
unlink pool
david-crespo 4380a91
make e2e tests pass, improve empty fleet role mapping state
david-crespo d791ca4
Merge main into ip-pools-ui
david-crespo d21d0ce
add IP ranges
david-crespo f870531
make /system/ip-pools the top-level route for now
david-crespo 04cfc28
add apology for incomplete UI, will hopefully get far enough to remove
david-crespo e4f5b9a
create pool form
david-crespo 71b9c81
delete IP pool
david-crespo 0245432
ip pool edit form
david-crespo 4fd02e9
update path-builder test
david-crespo 8e49838
basic e2e tests
david-crespo e4b7bdc
Merge main into ip-pools-ui
david-crespo 944d2a8
silo names on IP pools silo list, link to silo, help text
david-crespo d2df6fe
make *NameFromId rendering logic more uniform
david-crespo 38844e8
Merge branch 'main' into ip-pools-ui
david-crespo afc72a6
change IP pools page back to Networking with one tab
david-crespo 1421a81
confirm actions on silo IP pools list
david-crespo bef5353
add docs links, remove apology callout
david-crespo 7bb3711
confirm unlink in ip pool silos list
david-crespo 5ae447c
link silo from ip pool silos list
david-crespo 9b8654a
link pool from silo pools list
david-crespo 153142e
error toast and loading states on link modals
david-crespo bbae349
fix e2e test with confirm
david-crespo ce722af
Merge branch 'main' into ip-pools-ui
david-crespo 1d4989d
fix already exists check on mock ip pool update handler
david-crespo b9c6eda
add disabled range add/remove buttons to suggest using API instead
david-crespo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,27 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import cn from 'classnames' | ||
|
|
||
| type ExternalLinkProps = { | ||
| href: string | ||
| className?: string | ||
| children: React.ReactNode | ||
| } | ||
|
|
||
| export function ExternalLink({ href, className, children }: ExternalLinkProps) { | ||
| return ( | ||
| <a | ||
| href={href} | ||
| className={cn('underline text-accent-secondary hover:text-accent', className)} | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| > | ||
| {children} | ||
| </a> | ||
| ) | ||
| } |
This file contains hidden or 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,10 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import { classed } from '@oxide/util' | ||
|
|
||
| export const HL = classed.span`text-sans-semi-md text-default` |
This file contains hidden or 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 hidden or 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,54 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import { useNavigate } from 'react-router-dom' | ||
|
|
||
| import { useApiMutation, useApiQueryClient, type IpPoolCreate } from '@oxide/api' | ||
|
|
||
| import { DescriptionField, NameField, SideModalForm } from 'app/components/form' | ||
| import { useForm } from 'app/hooks' | ||
| import { addToast } from 'app/stores/toast' | ||
| import { pb } from 'app/util/path-builder' | ||
|
|
||
| const defaultValues: IpPoolCreate = { | ||
| name: '', | ||
| description: '', | ||
| } | ||
|
|
||
| export function CreateIpPoolSideModalForm() { | ||
| const navigate = useNavigate() | ||
| const queryClient = useApiQueryClient() | ||
|
|
||
| const onDismiss = () => navigate(pb.ipPools()) | ||
|
|
||
| const createPool = useApiMutation('ipPoolCreate', { | ||
| onSuccess(_pool) { | ||
| queryClient.invalidateQueries('ipPoolList') | ||
| addToast({ content: 'Your IP pool has been created' }) | ||
| navigate(pb.ipPools()) | ||
| }, | ||
| }) | ||
|
|
||
| const form = useForm({ defaultValues }) | ||
|
|
||
| return ( | ||
| <SideModalForm | ||
| id="create-pool-form" | ||
| form={form} | ||
| title="Create IP pool" | ||
| onDismiss={onDismiss} | ||
| onSubmit={({ name, description }) => { | ||
| createPool.mutate({ body: { name, description } }) | ||
| }} | ||
| loading={createPool.isPending} | ||
| submitError={createPool.error} | ||
| > | ||
| <NameField name="name" control={form.control} /> | ||
| <DescriptionField name="description" control={form.control} /> | ||
| </SideModalForm> | ||
| ) | ||
| } |
This file contains hidden or 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,65 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * Copyright Oxide Computer Company | ||
| */ | ||
| import { useNavigate, type LoaderFunctionArgs } from 'react-router-dom' | ||
|
|
||
| import { | ||
| apiQueryClient, | ||
| useApiMutation, | ||
| useApiQueryClient, | ||
| usePrefetchedApiQuery, | ||
| } from '@oxide/api' | ||
|
|
||
| import { DescriptionField, NameField, SideModalForm } from 'app/components/form' | ||
| import { getIpPoolSelector, useForm, useIpPoolSelector, useToast } from 'app/hooks' | ||
| import { pb } from 'app/util/path-builder' | ||
|
|
||
| EditIpPoolSideModalForm.loader = async ({ params }: LoaderFunctionArgs) => { | ||
| const { pool } = getIpPoolSelector(params) | ||
| await apiQueryClient.prefetchQuery('ipPoolView', { path: { pool } }) | ||
| return null | ||
| } | ||
|
|
||
| export function EditIpPoolSideModalForm() { | ||
| const queryClient = useApiQueryClient() | ||
| const addToast = useToast() | ||
| const navigate = useNavigate() | ||
|
|
||
| const poolSelector = useIpPoolSelector() | ||
|
|
||
| const onDismiss = () => navigate(pb.ipPools()) | ||
|
|
||
| const { data: pool } = usePrefetchedApiQuery('ipPoolView', { path: poolSelector }) | ||
|
|
||
| const editPool = useApiMutation('ipPoolUpdate', { | ||
| onSuccess(_pool) { | ||
| queryClient.invalidateQueries('ipPoolList') | ||
| addToast({ content: 'Your IP pool has been updated' }) | ||
| onDismiss() | ||
| }, | ||
| }) | ||
|
|
||
| const form = useForm({ defaultValues: pool }) | ||
|
|
||
| return ( | ||
| <SideModalForm | ||
| id="edit-pool-form" | ||
| form={form} | ||
| title="Edit IP pool" | ||
| onDismiss={onDismiss} | ||
| onSubmit={({ name, description }) => { | ||
| editPool.mutate({ path: poolSelector, body: { name, description } }) | ||
| }} | ||
| loading={editPool.isPending} | ||
| submitError={editPool.error} | ||
| submitLabel="Save changes" | ||
| > | ||
| <NameField name="name" control={form.control} /> | ||
| <DescriptionField name="description" control={form.control} /> | ||
| </SideModalForm> | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unrelated but I made all the NameForId components use LinkCell and have the nice Skeleton state