Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 1 | <!-- |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 2 | ~ Copyright 2019-present Open Networking Foundation |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 3 | ~ |
| 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | ~ you may not use this file except in compliance with the License. |
| 6 | ~ You may obtain a copy of the License at |
| 7 | ~ |
| 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ~ |
| 10 | ~ Unless required by applicable law or agreed to in writing, software |
| 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | ~ See the License for the specific language governing permissions and |
| 14 | ~ limitations under the License. |
| 15 | --> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 16 | <svg:desc xmlns:svg="http://www.w3.org/2000/svg">The force layout layer. This is |
| 17 | an SVG component that displays Nodes (Devices, Hosts and SubRegions) and |
| 18 | Links. Positions of each are driven by a forces computation engine</svg:desc> |
| 19 | <svg:g xmlns:svg="http://www.w3.org/2000/svg" class="topo2-links"> |
| 20 | <svg:desc>Topology links</svg:desc> |
| 21 | <!-- Template explanation: Creates an SVG Group and in |
| 22 | line 1) use the svg component onos-linksvg, setting it's link |
| 23 | Input parameter to the link item from the next line |
| 24 | line 2) Use the built in NgFor directive to iterate through the |
| 25 | set of links filtered by the filteredLinks() function. |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 26 | line 3) feed the highlightPorts of this (forcesvg) component in to |
| 27 | the highlightsEnabled of the link component |
| 28 | line 5) when the onos-linksvg component emits the selectedEvent, |
| 29 | call the updateSelected() method of this (forcesvg) component |
| 30 | line 6) feed the scale of this (forcesvg) component in to the scale |
| 31 | of the link |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 32 | --> |
| 33 | <svg:g onos-linksvg [link]="link" |
| 34 | *ngFor="let link of filteredLinks()" |
| 35 | [highlightsEnabled]="highlightPorts" |
Sean Condon | 00e56d0 | 2020-02-28 09:50:04 +0000 | [diff] [blame] | 36 | [linkHighlight]="linksHighlighted.get(link.id)" |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 37 | (selectedEvent)="updateSelected($event)" |
| 38 | [scale]="scale"> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 39 | </svg:g> |
| 40 | </svg:g> |
| 41 | <svg:g xmlns:svg="http://www.w3.org/2000/svg" class="topo2-nodes"> |
| 42 | <svg:desc>Topology nodes</svg:desc> |
| 43 | <!-- Template explanation - create an SVG Group and |
| 44 | line 1) use the svg component onos-devicenodesvg, setting it's device |
| 45 | Input parameter to the device item from the next line |
| 46 | line 2) Use the built in NgFor directive to iterate through all |
| 47 | of the devices in the chosen layer index. The current iteration |
| 48 | is in the device variable |
| 49 | line 3) Use the onosDraggable directive and pass this device in to |
| 50 | its draggableNode Input parameter and setting the draggableInGraph |
| 51 | Input parameter to 'graph' |
Sean Condon | 7191054 | 2019-02-16 18:16:42 +0000 | [diff] [blame] | 52 | line 4) event handler of the draggable directive - causes the new location |
| 53 | to be written back to the server |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 54 | line 5) when the onos-devicenodesvg component emits the selectedEvent, |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 55 | call the updateSelected() method of this (forcesvg) component |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 56 | line 6) feed the devicelabeltoggle of this (forcesvg) component in to |
| 57 | the labelToggle of the device |
| 58 | line 7) feed the scale of this (forcesvg) component in to the scale |
| 59 | of the device |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 60 | --> |
| 61 | <svg:g onos-devicenodesvg [device]="device" |
| 62 | *ngFor="let device of regionData.devices[visibleLayerIdx()]" |
| 63 | onosDraggableNode [draggableNode]="device" [draggableInGraph]="graph" |
Sean Condon | 7191054 | 2019-02-16 18:16:42 +0000 | [diff] [blame] | 64 | (newLocation)="nodeMoved('device', device.id, $event)" |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 65 | (selectedEvent)="updateSelected($event)" |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 66 | [labelToggle]="deviceLabelToggle" |
| 67 | [scale]="scale"> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 68 | <svg:desc>Device nodes</svg:desc> |
| 69 | </svg:g> |
| 70 | <!-- Template explanation - only display the hosts if 'showHosts' is set true --> |
| 71 | <svg:g *ngIf="showHosts"> |
| 72 | <!-- Template explanation - create an SVG Group and |
| 73 | line 1) use the svg component onos-hostnodesvg, setting it's host |
| 74 | Input parameter to the host item from the next line |
| 75 | line 2) Use the built in NgFor directive to iterate through all |
| 76 | of the hosts in the chosen layer index. The current iteration |
| 77 | is in the 'host' variable |
| 78 | line 3) Use the onosDraggable directive and pass this host in to |
| 79 | its draggableNode Input parameter and setting the draggableInGraph |
| 80 | Input parameter to 'graph' |
Sean Condon | 7191054 | 2019-02-16 18:16:42 +0000 | [diff] [blame] | 81 | line 4) event handler of the draggable directive - causes the new location |
| 82 | to be written back to the server |
| 83 | line 5) when the onos-hostnodesvg component emits the selectedEvent |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 84 | call the updateSelected() method of this (forcesvg) component |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 85 | line 6) feed the hostLabelToggle of this (forcesvg) component in to |
| 86 | the labelToggle of the host |
| 87 | line 7) feed the scale of this (forcesvg) component in to the scale |
| 88 | of the host |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 89 | --> |
| 90 | <svg:g onos-hostnodesvg [host]="host" |
| 91 | *ngFor="let host of regionData.hosts[visibleLayerIdx()]" |
| 92 | onosDraggableNode [draggableNode]="host" [draggableInGraph]="graph" |
Sean Condon | ee54576 | 2019-03-09 10:43:58 +0000 | [diff] [blame] | 93 | (newLocation)="nodeMoved('host', host.id, $event)" |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 94 | (selectedEvent)="updateSelected($event)" |
Sean Condon | 1ae1580 | 2019-03-02 09:07:18 +0000 | [diff] [blame] | 95 | [labelToggle]="hostLabelToggle" |
| 96 | [scale]="scale"> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 97 | <svg:desc>Host nodes</svg:desc> |
Sean Condon | 0c577f6 | 2018-11-18 22:40:05 +0000 | [diff] [blame] | 98 | </svg:g> |
| 99 | </svg:g> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 100 | <svg:g onos-subregionnodesvg [subRegion]="subRegion" |
| 101 | *ngFor="let subRegion of regionData.subregions" |
Sean Condon | ff85fbe | 2019-03-16 14:28:46 +0000 | [diff] [blame] | 102 | onosDraggableNode [draggableNode]="subRegion" [draggableInGraph]="graph"> |
Sean Condon | 9148182 | 2019-01-01 13:56:14 +0000 | [diff] [blame] | 103 | <svg:desc>Subregion nodes</svg:desc> |
| 104 | </svg:g> |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 105 | </svg:g> |