Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small UI fixes #553

Merged
merged 4 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/dashboard/content/list/FaultTreeOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ const FaultTreeOverview = () => {
onDelete={() => handleDelete(contextMenuSelectedTree)}
onClose={() => setContextMenuAnchor(contextMenuDefaultAnchor)}
canRename={canRename}
renameTooltip={canRename ? "change fault tree title" : "FHA-based fault trees cannot be renamed."}
blcham marked this conversation as resolved.
Show resolved Hide resolved
deleteTooltip={"delete fault tree"}
/>

<FaultTreeEditDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@ interface Props {
onDelete: () => void;
onClose: () => void;
canRename: boolean;
renameTooltip: string;
deleteTooltip?: string;
}

const FaultTreeContextMenu = ({ anchorPosition, onClose, onEditClick, onDelete, canRename }: Props) => {
const FaultTreeContextMenu = ({
anchorPosition,
onClose,
onEditClick,
onDelete,
canRename,
renameTooltip = "rename",
deleteTooltip = "delete",
}: Props) => {
const handleEditClick = () => {
onClose();
onEditClick();
Expand All @@ -36,12 +46,16 @@ const FaultTreeContextMenu = ({ anchorPosition, onClose, onEditClick, onDelete,
: undefined
}
>
<MenuItem disabled={!canRename} key="fault-tree-menu-rename" onClick={handleEditClick}>
Rename
</MenuItem>
<MenuItem key="fault-tree-delete" onClick={handleDeleteClick}>
Delete
</MenuItem>
<span title={renameTooltip}>
<MenuItem disabled={!canRename} key="fault-tree-menu-rename" onClick={handleEditClick}>
Rename
</MenuItem>
</span>
<span title={deleteTooltip}>
<MenuItem key="fault-tree-delete" onClick={handleDeleteClick}>
Delete
</MenuItem>
</span>
</Menu>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/table/FaultTreeTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const FaultTreeTableBody: FC<FaultTreeTableBodyProps> = ({ faultTrees, handleFau
<>
{faultTrees.map((faultTree, rowIndex) => {
const routePath = ROUTES.FTA + `/${extractFragment(faultTree.iri)}`;
const statusColor = faultTree?.status !== Status.OK ? "red" : "white";
const statusColor = faultTree?.status !== Status.OK ? "red" : "black";
const editor = faultTree?.editor || faultTree?.creator;
return (
<TableRow key={rowIndex} className={classes.noBorder}>
Expand Down
Loading