Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [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 | */ |
| 16 | |
| 17 | /* |
| 18 | ONOS GUI -- Topology No Connected Devices View. |
| 19 | View that contains the 'No Connected Devices' message |
| 20 | */ |
| 21 | |
| 22 | (function () { |
| 23 | |
| 24 | var instance; |
| 25 | |
| 26 | angular.module('ovTopo2') |
| 27 | .factory('Topo2NoDevicesConnectedService', [ |
| 28 | '$log', 'Topo2ViewController', 'GlyphService', 'SvgUtilService', |
| 29 | function ($log, ViewController, gs, sus) { |
| 30 | |
| 31 | var NoDevicesConnected = ViewController.extend({ |
| 32 | id: 'topo2-noDevsLayer', |
| 33 | displayName: 'No Devices Connected', |
| 34 | |
| 35 | init: function () { |
| 36 | instance = this; |
| 37 | this.appendElement('#topo2', 'g') |
| 38 | .attr({ |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 39 | transform: sus.translate(500, 500), |
Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [diff] [blame] | 40 | }); |
| 41 | |
| 42 | this.render(); |
| 43 | this.show(); |
| 44 | }, |
| 45 | |
| 46 | render: function () { |
| 47 | var g, box; |
| 48 | |
| 49 | g = this.node().append('g'); |
| 50 | gs.addGlyph(g, 'bird', 100).attr('class', 'noDevsBird'); |
| 51 | g.append('text').text('No devices are connected') |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 52 | .attr({ x: 120, y: 80 }); |
Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [diff] [blame] | 53 | |
| 54 | box = g.node().getBBox(); |
| 55 | box.x -= box.width/2; |
| 56 | box.y -= box.height/2; |
| 57 | g.attr('transform', sus.translate(box.x, box.y)); |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 58 | }, |
Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [diff] [blame] | 59 | }); |
| 60 | |
| 61 | return instance || new NoDevicesConnected(); |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 62 | }, |
Steven Burrows | 6501de9 | 2017-04-12 15:10:34 -0700 | [diff] [blame] | 63 | ]); |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 64 | })(); |