Added fix for randomly missing Virtual Network associations and fix for switching between two Spaces with similar Block names

This commit is contained in:
Matthew Garrett 2023-11-17 15:18:11 -08:00
Родитель 470bddc929
Коммит 73fca7fb3b
2 изменённых файлов: 9 добавлений и 4 удалений

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

@ -499,7 +499,7 @@ export default function EditVnets(props) {
item['active'] = true; item['active'] = true;
}); });
const missing = block['vnets'].map(vnet => vnet.id).filter(item => !data.map(a => a.id).includes(item)); const missing = block['vnets'].map(vnet => vnet.id).filter(item => !data.map(a => a.id.toLowerCase()).includes(item.toLowerCase()));
missing.forEach((item) => { missing.forEach((item) => {
missing_data.push(mockVNet(item)); missing_data.push(mockVNet(item));
@ -585,6 +585,11 @@ export default function EditVnets(props) {
} }
}; };
console.log("NEW BLOCK");
console.log("------------------");
console.log(newBlock);
console.log("------------------");
if(isEqual(prevBlock.identity, newBlock.identity)) { if(isEqual(prevBlock.identity, newBlock.identity)) {
if(!isEqual(prevBlock.data, newBlock.data)) { if(!isEqual(prevBlock.data, newBlock.data)) {
refreshData(); refreshData();

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

@ -118,8 +118,8 @@ export default function BlockDataGrid(props) {
}, [selectionModel, setSelectedBlock]); }, [selectionModel, setSelectedBlock]);
React.useEffect(() => { React.useEffect(() => {
if(blocks && selectedBlock) { if(blocks && selectedBlock && selectedSpace) {
const currentBlock = blocks.find(block => block.name === selectedBlock.name); const currentBlock = blocks.find(block => (block.name === selectedBlock.name) && (block.parent_space === selectedSpace.name));
if(!currentBlock) { if(!currentBlock) {
setSelectionModel({}); setSelectionModel({});
@ -127,7 +127,7 @@ export default function BlockDataGrid(props) {
setSelectedBlock(currentBlock); setSelectedBlock(currentBlock);
} }
} }
}, [blocks, selectedBlock, setSelectedBlock, setSelectionModel]); }, [blocks, selectedSpace, selectedBlock, setSelectedBlock, setSelectionModel]);
const handleMenuClick = (event) => { const handleMenuClick = (event) => {
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);