Skip to content

Commit

Permalink
chore(mesh-wide): fix new link is down
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Sep 12, 2024
1 parent 0577b31 commit afdf347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const LinkReferenceStatus = ({
linkType: linkToShow.type,
linkToUpdate: linkToShow,
isDown,
isNewLink,
nodesToUpdate,
});

Expand Down Expand Up @@ -309,7 +310,9 @@ export const LinkReferenceStatus = ({
<br /> {dataTypeNameMapping(linkToShow.type)}
</Trans>
);
if (isDown) {
// If is down and not a new link.
// Could happen that one of the links is not on the state yet and the other is not
if (isDown && !isNewLink) {
btnText = (
<Trans>
Delete this {dataTypeNameMapping(linkToShow.type)}
Expand Down
6 changes: 3 additions & 3 deletions plugins/lime-plugin-mesh-wide/src/meshWideQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ interface IUseSetLinkReferenceState {
nodesToUpdate: { [ip: string]: string }; // { ip: hostname }
params?: any;
isDown: boolean;
isNewLink: boolean;
}

export const useSetLinkReferenceState = ({
linkType,
linkToUpdate,
isDown,
isNewLink,
nodesToUpdate,
params,
}: IUseSetLinkReferenceState) => {
Expand All @@ -174,10 +176,8 @@ export const useSetLinkReferenceState = ({
// This is a hotfix because backend returns an empty array sometimes
if (isEmpty(newReferenceLinks)) newReferenceLinks = {};

console.log("PREEE ", newReferenceLinks);

for (const mactomac of linkToUpdate.links) {
if (isDown) {
if (isDown && newReferenceLinks[mactomac.id] && !isNewLink) {
delete newReferenceLinks[mactomac.id];
continue;
}
Expand Down

0 comments on commit afdf347

Please sign in to comment.