blob: b14ed7c0429645e264f4675df700fe0668633a9c [file] [log] [blame]
Steven Burrows6501de92017-04-12 15:10:34 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Steven Burrows6501de92017-04-12 15:10:34 -07003 *
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({
Simon Hunt5c3ed732017-07-20 19:03:28 +000039 transform: sus.translate(500, 500)
Steven Burrows6501de92017-04-12 15:10:34 -070040 });
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')
Simon Hunt5c3ed732017-07-20 19:03:28 +000052 .attr({ x: 120, y: 80});
Steven Burrows6501de92017-04-12 15:10:34 -070053
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));
Simon Hunt5c3ed732017-07-20 19:03:28 +000058 }
Steven Burrows6501de92017-04-12 15:10:34 -070059 });
60
61 return instance || new NoDevicesConnected();
Simon Hunt5c3ed732017-07-20 19:03:28 +000062 }
Steven Burrows6501de92017-04-12 15:10:34 -070063 ]);
Simon Hunt5c3ed732017-07-20 19:03:28 +000064})();