-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(network) fix review notes for network overhaul
- use new view for managed networks, remove old network overview - topology should be calculated for managed networks - search placeholder: "Search for key" - search over the description and field name - hide topology on yaml config - on creation: asterisk for name and uplink/parent - on creation: disable submit until a parent is selected - left align topology Signed-off-by: David Edler <[email protected]>
- Loading branch information
Showing
17 changed files
with
170 additions
and
310 deletions.
There are no files selected for viewing
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
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 was deleted.
Oops, something went wrong.
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,81 @@ | ||
import { FC } from "react"; | ||
import { FormikProps } from "formik/dist/types"; | ||
import { NetworkFormValues } from "pages/networks/forms/NetworkForm"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { queryKeys } from "util/queryKeys"; | ||
import { fetchNetworkState } from "api/networks"; | ||
import { MainTable } from "@canonical/react-components"; | ||
|
||
interface Props { | ||
formik: FormikProps<NetworkFormValues>; | ||
project: string; | ||
} | ||
|
||
const NetworkAddresses: FC<Props> = ({ formik, project }) => { | ||
const { data: networkState } = useQuery({ | ||
queryKey: [ | ||
queryKeys.projects, | ||
project, | ||
queryKeys.networks, | ||
formik.values.bareNetwork?.name, | ||
queryKeys.state, | ||
], | ||
retry: 0, // physical managed networks can sometimes 404, show error right away and don't retry | ||
queryFn: () => | ||
fetchNetworkState(formik.values.bareNetwork?.name ?? "", project), | ||
enabled: !formik.values.isCreating, | ||
}); | ||
|
||
return ( | ||
<> | ||
<h2 className="p-heading--4">Addresses</h2> | ||
{(networkState?.addresses ?? []).length > 0 ? ( | ||
<MainTable | ||
sortable | ||
headers={[ | ||
{ content: "IP", sortKey: "ip" }, | ||
{ content: "Netmask", sortKey: "netmask" }, | ||
{ content: "Scope", sortKey: "scope" }, | ||
{ content: "Family", sortKey: "family" }, | ||
]} | ||
rows={networkState?.addresses.map((item) => { | ||
return { | ||
columns: [ | ||
{ | ||
content: item.address, | ||
role: "cell", | ||
"aria-label": "Address", | ||
}, | ||
{ | ||
content: item.netmask, | ||
role: "cell", | ||
"aria-label": "Netmask", | ||
}, | ||
{ | ||
content: item.scope, | ||
role: "cell", | ||
"aria-label": "Scope", | ||
}, | ||
{ | ||
content: item.family, | ||
role: "cell", | ||
"aria-label": "family", | ||
}, | ||
], | ||
sortData: { | ||
ip: item.address, | ||
netmask: item.netmask, | ||
scope: item.scope, | ||
family: item.family, | ||
}, | ||
}; | ||
})} | ||
/> | ||
) : ( | ||
"None" | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default NetworkAddresses; |
Oops, something went wrong.