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;
});
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_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.data, newBlock.data)) {
refreshData();

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

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