Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
36 changes: 32 additions & 4 deletions dashboard/src/styles/detailPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pre.code-block .json-string {
flex-direction: column;
gap: 12px;
min-width: 280px;
flex: 0 0 auto;
flex: 1 1 0;
}

@media (max-width: 599px) {
Expand All @@ -216,6 +216,9 @@ pre.code-block .json-string {
background-color: #ffffff;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
min-height: 80px;
display: flex;
flex-direction: column;
overflow: hidden;
}

.relationship-card__header {
Expand Down Expand Up @@ -296,6 +299,7 @@ pre.code-block .json-string {
.relationship-card__content {
display: flex;
flex-direction: column;
min-width: 0;
}

.relationship-card__search {
Expand Down Expand Up @@ -330,15 +334,18 @@ pre.code-block .json-string {

.relationship-card__item {
font-size: 0.875rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5;
}

.relationship-card__link {
color: #2563eb;
text-decoration: none;
display: inline-block;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
}

.relationship-card__link:hover {
Expand All @@ -356,6 +363,12 @@ pre.code-block .json-string {

.relationship-card__text {
color: #334155;
display: inline-block;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
}

.relationship-card__empty {
Expand Down Expand Up @@ -572,3 +585,18 @@ pre.code-block .json-string {
cursor: pointer !important;
margin-left: 6px !important;
}

.relationship-node-link {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.text-active {
color: #1976d2 !important;
}

.text-deleted {
color: #BB5838 !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,40 @@ import { CloseIcon, LightTooltip } from "@components/muiComponents";
import { useAppSelector } from "@hooks/reducerHook";
import { Link as MUILink } from "@mui/material";

interface CustomLinkProps {
href: string;
status: string;
guid: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guid is declared in the interface and destructured but never used.
Remove unused guid from CustomLinkProps and destructuring, or use it (e.g. as key / data-testid).

verify and update

name: string;
typeName: string;
params: URLSearchParams | string;
}

const CustomLink = ({
href,
status,
entityColor,
guid,
name,
typeName,
params
}: any): any => {
}: CustomLinkProps): JSX.Element => {
const displayLabel = typeName ? `${name} (${typeName})` : name;
return (
<li className={status}>
<MUILink
component={RouterLink}
to={{
pathname: href,
search: params.toString() ? params.toString() : ""
}}
style={{ color: entityColor }}
replace={true}
>
{name} ({typeName})
</MUILink>
<LightTooltip title={displayLabel}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(~lines 71–84, 541–549)

MUI Tooltip expects a child that holds a ref. MUILink + RouterLink can trigger console warnings. Wrapping in <span style={{ display: 'block', overflow: 'hidden' }}> is safer.

<MUILink
component={RouterLink}
to={{
pathname: href,
search: params.toString() ? params.toString() : ""
}}
className={`relationship-node-link ${status.includes("deleted-relation") ? "text-deleted" : "text-active"}`}
replace={true}
underline="hover"
>
{displayLabel}
</MUILink>
</LightTooltip>
</li>
);
};
Expand All @@ -79,8 +91,8 @@ const RelationshipLineage = ({
relationshipAttributes,
isLoading
}: {
entity: Record<string, any>;
relationshipAttributes?: Record<string, any[]>;
entity: Record<string, unknown>;
relationshipAttributes?: Record<string, unknown[]>;
isLoading?: boolean;
}) => {
const entityData = cloneDeep(entity);
Expand All @@ -95,13 +107,13 @@ const RelationshipLineage = ({
const zoomOutButtonRef = useRef(null);
const relationshipSVG = useRef(null);
const [drawerOpen, setDrawerOpen] = useState(false);
const [nodeDetails, setNodeDetails] = useState<any>({});
const [nodeDetails, setNodeDetails] = useState<Record<string, unknown>>({});
const [searchTerm, setSearchTerm] = useState("");
const [zoomId, setZoomId] = useState("");

const createData = (entityData: Record<string, any>) => {
const createData = (entityData: Record<string, unknown>) => {
let links = [];
let nodes: Record<string, any> = {};
let nodes: Record<string, unknown> = {};
if (entityData && entityData.relationshipAttributes) {
for (const obj in entityData.relationshipAttributes) {
if (!isEmpty(entityData.relationshipAttributes[obj])) {
Expand Down Expand Up @@ -146,9 +158,9 @@ const RelationshipLineage = ({
selectedNodeColor = "#4a90e2";

var svg = d3
.select(svgElement)
.attr("viewBox", `${-padding} ${-padding} ${width + padding * 2} ${height + padding * 2}`)
.attr("enable-background", `new ${-padding} ${-padding} ${width + padding * 2} ${height + padding * 2}`),
.select(svgElement)
.attr("viewBox", `${-padding} ${-padding} ${width + padding * 2} ${height + padding * 2}`)
.attr("enable-background", `new ${-padding} ${-padding} ${width + padding * 2} ${height + padding * 2}`),
node,
path;

Expand Down Expand Up @@ -187,7 +199,7 @@ const RelationshipLineage = ({

var forceLink = d3
.forceLink()
.id(function (d: any) {
.id(function (d: Record<string, unknown>) {
return d.id;
})
.distance(function (d) {
Expand Down Expand Up @@ -252,7 +264,7 @@ const RelationshipLineage = ({
d.radius = 25;
return d.radius;
})
.attr("fill", function (d: any) {
.attr("fill", function (d: Record<string, unknown>) {
if (d && d.value && d.value.guid == guid) {
if (isAllEntityRelationDeleted({ data: d, type: "node" })) {
return deletedEntityColor;
Expand Down Expand Up @@ -472,7 +484,6 @@ const RelationshipLineage = ({
? " deleted-relation"
: "";
let nodeGuid = options.guid;
let entityColor = obj.color;
let name = obj.name;
let typeName = options.typeName;
let keys = Array.from(searchParams.keys());
Expand All @@ -491,7 +502,6 @@ const RelationshipLineage = ({
<CustomLink
href={tempLink}
status={status}
entityColor={entityColor}
guid={nodeGuid}
name={name}
typeName={typeName}
Expand All @@ -504,7 +514,6 @@ const RelationshipLineage = ({
<CustomLink
href={`/detailPage/${nodeGuid}`}
status={status}
entityColor={entityColor}
guid={nodeGuid}
name={name}
typeName={typeName}
Expand All @@ -519,23 +528,25 @@ const RelationshipLineage = ({
let status = entityStateReadOnly[entityStatus]
? " deleted-relation"
: "";
let entityColor = obj.color;
let name = obj.name;

if (obj.relationship) {
status = entityStateReadOnly[relationshipStatus]
? "deleted-relation"
: "";
}
const displayLabel = options.typeName ? `${name} (${options.typeName})` : name;
return (
<li className={status}>
<MUILink
component={RouterLink}
to={`/detailPage/${options.guid}?tabActive=relationship`}
style={{ color: entityColor }}
>
{name} ({options.typeName})
</MUILink>
<LightTooltip title={displayLabel}>
<MUILink
component={RouterLink}
to={`/detailPage/${options.guid}?tabActive=relationship`}
className={`relationship-node-link ${status.includes("deleted-relation") ? "text-deleted" : "text-active"}`}
>
{displayLabel}
</MUILink>
</LightTooltip>
</li>
);
};
Expand Down Expand Up @@ -617,7 +628,7 @@ const RelationshipLineage = ({
listString.push(<Fragment key={itemKey}>{getElement(data)}</Fragment>);
}
return (
<Stack sx={{ background: "white" }} minHeight={"150px"} maxWidth="520px">
<Stack sx={{ background: "white" }} minHeight={"150px"} maxWidth="350px">
{/* {listString?.length > 1 && ( */}
<Paper
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,41 @@ describe('RelationshipLineage', () => {
});
});

describe('Tooltip Rendering', () => {
it('should render LightTooltip for relationship nodes in drawer', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add negative/edge cases: deleted status styling, missing typeName label, and at least one assertion that tooltip title matches full untruncated text. Classic UI tooltip lifecycle has zero automated coverage.

render(
<TestWrapper>
<RelationshipLineage entity={mockEntityWithRelationships} />
</TestWrapper>
);

const mockNode = {
name: 'Process',
value: [
{
guid: 'proc-1',
typeName: 'Process',
displayText: 'Test Tooltip Name',
entityStatus: 'ACTIVE',
relationshipStatus: 'ACTIVE'
}
]
};

act(() => {
if (mockEnterSelection.clickHandler) {
mockEnterSelection.clickHandler(mockNode);
}
});

await waitFor(() => {
const tooltips = screen.getAllByTestId('light-tooltip');
const targetTooltip = tooltips.find(t => t.getAttribute('title') === 'Test Tooltip Name (Process)');
expect(targetTooltip).toBeInTheDocument();
}, { timeout: 3000 });
});
});

describe('Edge Cases', () => {
it('should handle entity without relationshipAttributes', () => {
const entityWithoutAttributes = {
Expand Down
7 changes: 7 additions & 0 deletions dashboardv2/public/css/scss/graph.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
margin-bottom: 5px;
text-align: left;

&.entity-list-item {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ellipsis is applied to ul > li.entity-list-item, but buildListItem() in RelationshipLayoutView.js (~lines 359–361) puts long text inside . Ellipsis on

  • does not reliably truncate nested inline text.

    Consider moving truncation to .entity-list-item .entity-type-name (with display: inline-block; max-width: 100%) — same pattern used for .relationship-card-link in relationship.scss. Truncation on

  • alone may not clip anchor content.

    confirm this, and update

  • white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    }

    &.deleted-relation {
    .deleteBtn {
    padding: 2px 8px !important;
    Expand Down
    25 changes: 22 additions & 3 deletions dashboardv2/public/css/scss/relationship.scss
    Original file line number Diff line number Diff line change
    Expand Up @@ -121,7 +121,7 @@
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
    flex: 0 0 auto;
    flex: 1 1 0;
    }

    @media (max-width: 599px) {
    Expand Down Expand Up @@ -220,6 +220,7 @@
    flex-direction: column;
    padding: 12px;
    min-height: 0;
    min-width: 0;
    overflow: hidden;

    .relationship-card-search {
    Expand All @@ -241,6 +242,7 @@
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    min-width: 0;
    position: relative;

    &::-webkit-scrollbar {
    Expand All @@ -267,10 +269,14 @@
    padding: 0;
    margin: 0;
    text-align: left;
    width: 100%;
    overflow: hidden;

    .relationship-card-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
    overflow: hidden;

    &:last-child {
    border-bottom: none;
    Expand All @@ -290,7 +296,12 @@
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    word-break: break-word;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;

    &:hover {
    text-decoration: underline;
    Expand Down Expand Up @@ -547,4 +558,12 @@
    50% {
    background-position: -200% 0;
    }
    }
    }
    .entity-type-name {
    &.active {
    color: #1976d2;
    }
    &.deleted {
    color: #BB5838;
    }
    }
    Loading
    Loading