Suspend a link or node show status change

This commit is contained in:
Rajnikant 2022-03-24 17:28:42 +05:30
parent 2f9999b41c
commit c2410f0933
2 changed files with 12 additions and 16 deletions

View File

@ -52,13 +52,13 @@ export class InterfaceStatusWidget implements Widget {
new LinkStatus( new LinkStatus(
start_point.x, start_point.x,
start_point.y, start_point.y,
l.capturing && l.suspend ? 'suspended' : l.source.status, !l.capturing && l.suspend ? 'suspended' : l.source.status,
sourcePort sourcePort
), ),
new LinkStatus( new LinkStatus(
end_point.x, end_point.x,
end_point.y, end_point.y,
l.capturing && l.suspend ? 'suspended' : l.target.status, !l.capturing && l.suspend ? 'suspended' : l.target.status,
destinationPort destinationPort
), ),
]; ];

View File

@ -22,7 +22,7 @@ export class LinkWidget implements Widget {
private selectionManager: SelectionManager, private selectionManager: SelectionManager,
private ethernetLinkWidget: EthernetLinkWidget, private ethernetLinkWidget: EthernetLinkWidget,
private serialLinkWidget: SerialLinkWidget private serialLinkWidget: SerialLinkWidget
) {} ) { }
public draw(view: SVGSelection) { public draw(view: SVGSelection) {
const link_body = view.selectAll<SVGGElement, MapLink>('g.link_body').data((l) => [l]); const link_body = view.selectAll<SVGGElement, MapLink>('g.link_body').data((l) => [l]);
@ -50,9 +50,8 @@ export class LinkWidget implements Widget {
}) })
.attr('class', 'capture-icon') .attr('class', 'capture-icon')
.attr('transform', (link) => { .attr('transform', (link) => {
return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${ return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${(link.source.y + link.target.y) / 2 + 24
(link.source.y + link.target.y) / 2 + 24 }) scale(0.5)`;
}) scale(0.5)`;
}) })
.attr('viewBox', '0 0 20 20') .attr('viewBox', '0 0 20 20')
.append<SVGImageElement>('image') .append<SVGImageElement>('image')
@ -74,9 +73,8 @@ export class LinkWidget implements Widget {
}) })
.attr('class', 'filter-capture-icon') .attr('class', 'filter-capture-icon')
.attr('transform', (link) => { .attr('transform', (link) => {
return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${ return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${(link.source.y + link.target.y) / 2 + 24
(link.source.y + link.target.y) / 2 + 24 }) scale(0.5)`;
}) scale(0.5)`;
}) })
.attr('viewBox', '0 0 20 20') .attr('viewBox', '0 0 20 20')
.append<SVGImageElement>('image') .append<SVGImageElement>('image')
@ -99,9 +97,8 @@ export class LinkWidget implements Widget {
.attr('width', '48px') .attr('width', '48px')
.attr('height', '48px') .attr('height', '48px')
.attr('transform', (link) => { .attr('transform', (link) => {
return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${ return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${(link.source.y + link.target.y) / 2 + 24
(link.source.y + link.target.y) / 2 + 24 }) scale(0.5)`;
}) scale(0.5)`;
}) })
.attr('viewBox', '0 0 20 20') .attr('viewBox', '0 0 20 20')
.append<SVGImageElement>('image') .append<SVGImageElement>('image')
@ -113,7 +110,7 @@ export class LinkWidget implements Widget {
link_body link_body
.filter((l) => { .filter((l) => {
return ( return (
l.capturing && !l.capturing &&
l.suspend && l.suspend &&
!(l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss) !(l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)
); );
@ -125,9 +122,8 @@ export class LinkWidget implements Widget {
}) })
.attr('class', 'pause-icon') .attr('class', 'pause-icon')
.attr('transform', (link) => { .attr('transform', (link) => {
return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${ return `translate (${(link.source.x + link.target.x) / 2 + 24}, ${(link.source.y + link.target.y) / 2 + 24
(link.source.y + link.target.y) / 2 + 24 }) scale(0.5)`;
}) scale(0.5)`;
}) })
.attr('viewBox', '0 0 20 20') .attr('viewBox', '0 0 20 20')
.append<SVGImageElement>('image') .append<SVGImageElement>('image')