-
Notifications
You must be signed in to change notification settings - Fork 366
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
upcoming: [M3-7401] - AGLB Load Balancer and Configuration Refinements #9903
Changes from 9 commits
e04fae8
8a25b02
29ac223
000e2b8
372ed16
7c29575
b5f17a0
e542a1a
614dbd9
61508f6
8fca31b
0042f79
9337378
6b9e068
ae9a3e0
12d45a8
375272b
3978ac5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Fix Configuration creation by fixing port type and other refinement ([#9903](https://github.com/linode/manager/pull/9903)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,6 @@ import { | |
useLoadBalancerConfigurationCreateMutation, | ||
useLoadBalancerConfigurationMutation, | ||
} from 'src/queries/aglb/configurations'; | ||
import { | ||
useLoadBalancerMutation, | ||
useLoadBalancerQuery, | ||
} from 'src/queries/aglb/loadbalancers'; | ||
import { getFormikErrorsFromAPIErrors } from 'src/utilities/formikErrorUtils'; | ||
|
||
import { AddRouteDrawer } from '../Routes/AddRouteDrawer'; | ||
|
@@ -49,7 +45,7 @@ interface CreateProps { | |
configuration?: never; | ||
mode: 'create'; | ||
onCancel: () => void; | ||
onSuccess: () => void; | ||
onSuccess: (configuration: Configuration) => void; | ||
} | ||
|
||
export const ConfigurationForm = (props: CreateProps | EditProps) => { | ||
|
@@ -81,11 +77,6 @@ export const ConfigurationForm = (props: CreateProps | EditProps) => { | |
configuration?.id ?? -1 | ||
); | ||
|
||
const { data: loadbalancer } = useLoadBalancerQuery(loadbalancerId); | ||
const { mutateAsync: updateLoadbalancer } = useLoadBalancerMutation( | ||
loadbalancerId | ||
); | ||
|
||
const formValues = useMemo(() => { | ||
if (mode === 'edit') { | ||
return getConfigurationPayloadFromConfiguration(configuration); | ||
|
@@ -103,19 +94,7 @@ export const ConfigurationForm = (props: CreateProps | EditProps) => { | |
try { | ||
const configuration = await mutateAsync(values); | ||
if (onSuccess) { | ||
onSuccess(); | ||
} | ||
if (mode === 'create') { | ||
if (!loadbalancer) { | ||
return; | ||
} | ||
const existingConfigs = loadbalancer?.configurations.map( | ||
(config) => config.id | ||
); | ||
// Silently associate the new configuration with the Load Balancer | ||
updateLoadbalancer({ | ||
configuration_ids: [...existingConfigs, configuration.id], | ||
}); | ||
onSuccess(configuration); | ||
} | ||
} catch (error) { | ||
helpers.setErrors(getFormikErrorsFromAPIErrors(error)); | ||
|
@@ -196,6 +175,7 @@ export const ConfigurationForm = (props: CreateProps | EditProps) => { | |
labelTooltipText="TODO: AGLB" | ||
name="port" | ||
onChange={formik.handleChange} | ||
type="number" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes the formik payload so that |
||
value={formik.values.port} | ||
/> | ||
</Stack> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import { | |
useRouteMatch, | ||
} from 'react-router-dom'; | ||
|
||
import { CircleProgress } from 'src/components/CircleProgress'; | ||
import { DocumentTitleSegment } from 'src/components/DocumentTitle'; | ||
import { ErrorState } from 'src/components/ErrorState/ErrorState'; | ||
import { LandingHeader } from 'src/components/LandingHeader'; | ||
import { Tabs } from 'src/components/ReachTabs'; | ||
import { SuspenseLoader } from 'src/components/SuspenseLoader'; | ||
|
@@ -57,7 +59,7 @@ export const LoadBalancerDetail = () => { | |
|
||
const id = Number(loadbalancerId); | ||
|
||
const { data: loadbalancer } = useLoadBalancerQuery(id); | ||
const { data: loadbalancer, isLoading, error } = useLoadBalancerQuery(id); | ||
|
||
const tabs = [ | ||
{ | ||
|
@@ -90,6 +92,14 @@ export const LoadBalancerDetail = () => { | |
location.pathname.startsWith(`${url}/${tab.path}`) | ||
); | ||
|
||
if (isLoading) { | ||
return <CircleProgress />; | ||
} | ||
|
||
if (error) { | ||
return <ErrorState errorText={error[0].reason} />; | ||
} | ||
|
||
return ( | ||
<> | ||
<DocumentTitleSegment segment={loadbalancer?.label ?? ''} /> | ||
|
@@ -108,7 +118,7 @@ export const LoadBalancerDetail = () => { | |
docsLabel="Docs" | ||
docsLink="" // TODO: AGLB - Add docs link | ||
/> | ||
<Tabs index={tabIndex === -1 ? 0 : tabIndex}> | ||
<Tabs index={tabIndex === -1 ? 0 : tabIndex} onChange={() => null}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need an |
||
<TabLinkList | ||
tabs={tabs.map((t) => ({ ...t, routeName: `${url}/${t.path}` }))} | ||
/> | ||
|
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 turned out to be a non-issue on the API, so we can remove it