Skip to content

Commit

Permalink
Merge pull request #2206 from eliasbruvik/FIX-2204-deleteCurves
Browse files Browse the repository at this point in the history
FIX-2204 Filter out indexCurve when deleting log curves
  • Loading branch information
eliasbruvik authored Jan 12, 2024
2 parents d4c956b + 767639a commit aa7e98e
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const LogCurveInfoContextMenu = (
selectedServer,
servers
} = props;
const checkedLogCurveInfoRowsWithoutIndexCurve =
checkedLogCurveInfoRows.filter(
(lc) => lc.mnemonic !== selectedLog.indexCurve
);

const onClickOpen = () => {
dispatchOperation({ type: OperationType.HideContextMenu });
Expand Down Expand Up @@ -111,10 +115,11 @@ const LogCurveInfoContextMenu = (
};

const toDelete = createComponentReferences(
checkedLogCurveInfoRows.map((lc) => lc.mnemonic),
checkedLogCurveInfoRowsWithoutIndexCurve.map((lc) => lc.mnemonic),
selectedLog,
ComponentType.Mnemonic
);

return (
<ContextMenu
menuItems={[
Expand Down Expand Up @@ -177,7 +182,7 @@ const LogCurveInfoContextMenu = (
JobType.DeleteComponents
)
}
disabled={checkedLogCurveInfoRows.length === 0}
disabled={checkedLogCurveInfoRowsWithoutIndexCurve.length === 0}
>
<StyledIcon
name="deleteToTrash"
Expand All @@ -187,7 +192,7 @@ const LogCurveInfoContextMenu = (
{menuItemText(
"delete",
ComponentType.Mnemonic,
checkedLogCurveInfoRows
checkedLogCurveInfoRowsWithoutIndexCurve
)}
</Typography>
</MenuItem>,
Expand All @@ -210,9 +215,8 @@ const LogCurveInfoContextMenu = (
</NestedMenuItem>,
<MenuItem
key={"analyzeGaps"}
onClick={
onClickAnalyzeGaps
} /*disabled={checkedLogCurveInfoRows.length !== 1}*/
onClick={onClickAnalyzeGaps}
disabled={checkedLogCurveInfoRowsWithoutIndexCurve.length === 0}
>
<StyledIcon name="beat" color={colors.interactive.primaryResting} />
<Typography color={"primary"}>Analyze gaps</Typography>
Expand Down

0 comments on commit aa7e98e

Please sign in to comment.