Fixed a few issues based on testing feedback

This commit is contained in:
Matthew Garrett 2024-04-19 10:23:44 -07:00
Родитель 20c7355203
Коммит 0bddcdde28
4 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -1688,9 +1688,6 @@ async def create_external_subnet(
if req.name in [x['name'] for x in target_external['subnets']]:
raise HTTPException(status_code=400, detail="Subnet name already exists in external network.")
if str(IPNetwork(req.cidr).cidr) != req.cidr:
raise HTTPException(status_code=400, detail="External subnet cidr invalid, should be {}".format(IPNetwork(req.cidr).cidr))
subnet_cidrs = []
for s in (s for s in target_external['subnets']):
@ -1705,6 +1702,9 @@ async def create_external_subnet(
next_cidr = IPNetwork(req.cidr)
except:
raise HTTPException(status_code=400, detail="Invalid network CIDR format.")
if str(next_cidr.cidr) != req.cidr:
raise HTTPException(status_code=400, detail="External subnet CIDR invalid, should be {}".format(IPNetwork(req.cidr).cidr))
if next_cidr not in available_set:
raise HTTPException(status_code=409, detail="Requested subnet CIDR overlaps existing subnet(s).")

Просмотреть файл

@ -465,7 +465,7 @@ const Associations = () => {
React.useEffect(() => {
if (blocks) {
if (selectedBlock) {
const blockIndex = blocks.findIndex((x) => x.name === selectedBlock.name);
const blockIndex = blocks.findIndex((x) => x.id === selectedBlock.id);
if (blockIndex > -1) {
if (!isEqual(blocks[blockIndex], selectedBlock)) {

Просмотреть файл

@ -131,7 +131,7 @@ export default function Externals() {
React.useEffect(() => {
if (blocks) {
if (selectedBlock) {
const blockIndex = blocks.findIndex((x) => x.name === selectedBlock.name);
const blockIndex = blocks.findIndex((x) => x.id === selectedBlock.id);
if (blockIndex > -1) {
if (!isEqual(blocks[blockIndex], selectedBlock)) {

Просмотреть файл

@ -713,7 +713,7 @@ const Reservations = () => {
React.useEffect(() => {
if (blocks) {
if (selectedBlock) {
const blockIndex = blocks.findIndex((x) => x.name === selectedBlock.name);
const blockIndex = blocks.findIndex((x) => x.id === selectedBlock.id);
if (blockIndex > -1) {
if (!isEqual(blocks[blockIndex], selectedBlock)) {
@ -734,6 +734,14 @@ const Reservations = () => {
}
}, [blocks, selectedBlock]);
React.useEffect(() => {
if (selectedSpace && selectedBlock) {
if (selectedBlock.parent_space !== selectedSpace.name) {
setSelectedBlock(null);
}
}
}, [selectedSpace, selectedBlock]);
React.useEffect(() => {
if (!isEmpty(reservations)) {
setSelectionModel((prev) => {
@ -756,14 +764,6 @@ const Reservations = () => {
}
}, [reservations]);
React.useEffect(() => {
if (selectedSpace && selectedBlock) {
if (selectedBlock.parent_space !== selectedSpace.name) {
setSelectedBlock(null);
}
}
}, [selectedSpace, selectedBlock]);
const refresh = React.useCallback(() => {
(async() => {
try {