mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-09 03:24:13 +00:00
clean
This commit is contained in:
parent
055a161b17
commit
ffb261ce64
@ -9,7 +9,7 @@ class TestDataSource extends DataSource<Item> {
|
||||
protected findIndex(item: Item) {
|
||||
return this.data.findIndex((i: Item) => i.id === item.id);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
describe('TestDataSource', () => {
|
||||
|
@ -19,56 +19,55 @@ export class InterfaceStatusWidget implements Widget {
|
||||
|
||||
let statuses = [];
|
||||
|
||||
|
||||
if (link_path.node().getTotalLength() > 2 * 45 + 10) {
|
||||
statuses = [
|
||||
new LinkStatus(start_point.x, start_point.y, l.source.status),
|
||||
new LinkStatus(end_point.x, end_point.y, l.target.status)
|
||||
new LinkStatus(start_point.x, start_point.y, l.source.status),
|
||||
new LinkStatus(end_point.x, end_point.y, l.target.status)
|
||||
];
|
||||
}
|
||||
|
||||
const status_started = link_group
|
||||
.selectAll<SVGCircleElement, LinkStatus>('circle.status_started')
|
||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'started'));
|
||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'started'));
|
||||
|
||||
const status_started_enter = status_started
|
||||
.enter()
|
||||
.append<SVGCircleElement>('circle');
|
||||
.append<SVGCircleElement>('circle');
|
||||
|
||||
status_started
|
||||
.merge(status_started_enter)
|
||||
.attr('class', 'status_started')
|
||||
.attr('cx', (ls: LinkStatus) => ls.x)
|
||||
.attr('cy', (ls: LinkStatus) => ls.y)
|
||||
.attr('r', 6)
|
||||
.attr('fill', '#2ecc71');
|
||||
.attr('class', 'status_started')
|
||||
.attr('cx', (ls: LinkStatus) => ls.x)
|
||||
.attr('cy', (ls: LinkStatus) => ls.y)
|
||||
.attr('r', 6)
|
||||
.attr('fill', '#2ecc71');
|
||||
|
||||
status_started
|
||||
.exit()
|
||||
.remove();
|
||||
.remove();
|
||||
|
||||
const status_stopped = link_group
|
||||
.selectAll<SVGRectElement, LinkStatus>('rect.status_stopped')
|
||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'stopped'));
|
||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'stopped'));
|
||||
|
||||
const status_stopped_enter = status_stopped
|
||||
.enter()
|
||||
.append<SVGRectElement>('rect');
|
||||
.append<SVGRectElement>('rect');
|
||||
|
||||
const STOPPED_STATUS_RECT_WIDTH = 10;
|
||||
|
||||
status_stopped
|
||||
.merge(status_stopped_enter)
|
||||
.attr('class', 'status_stopped')
|
||||
.attr('x', (ls: LinkStatus) => ls.x - STOPPED_STATUS_RECT_WIDTH / 2.)
|
||||
.attr('y', (ls: LinkStatus) => ls.y - STOPPED_STATUS_RECT_WIDTH / 2.)
|
||||
.attr('width', STOPPED_STATUS_RECT_WIDTH)
|
||||
.attr('height', STOPPED_STATUS_RECT_WIDTH)
|
||||
.attr('fill', 'red');
|
||||
.attr('class', 'status_stopped')
|
||||
.attr('x', (ls: LinkStatus) => ls.x - STOPPED_STATUS_RECT_WIDTH / 2.)
|
||||
.attr('y', (ls: LinkStatus) => ls.y - STOPPED_STATUS_RECT_WIDTH / 2.)
|
||||
.attr('width', STOPPED_STATUS_RECT_WIDTH)
|
||||
.attr('height', STOPPED_STATUS_RECT_WIDTH)
|
||||
.attr('fill', 'red');
|
||||
|
||||
status_stopped
|
||||
.exit()
|
||||
.remove();
|
||||
.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export class LinksWidget implements Widget {
|
||||
}
|
||||
|
||||
public getLinkWidget() {
|
||||
return this.linkWidget
|
||||
return this.linkWidget;
|
||||
}
|
||||
|
||||
public redrawLink(view: SVGSelection, link: Link) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user