blob: 7e1b43dd96c350960851a4086da27b6b1f12ca52 [file] [log] [blame]
Bri Prebilic Cole47bb7802015-02-05 17:25:15 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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 -- Layer -- Veil Service
19
20 Provides a mechanism to display an overlaying div with information.
21 Used mainly for web socket connection interruption.
22 */
23(function () {
24 'use strict';
25
26 // injected references
27 var $log, fs;
28
29 var veil, svg;
30
31 function show(msg) {
32 veil.selectAll('p').remove();
33
34 //veil.data(msg).enter().append('p').text(function (d) { return d; });
35
36 msg.forEach(function (line) {
37 veil.insert('p').text(line);
38 });
39
40 veil.style('display', 'block');
41
42 // TODO: disable key bindings
43 }
44
45 function hide() {
46 veil.style('display', 'none');
47 // TODO: re-enable key bindings
48 }
49
50 angular.module('onosLayer')
51 .factory('VeilService', ['$log', 'FnService', 'GlyphService',
52 function (_$log_, _fs_, gs) {
53 $log = _$log_;
54 fs = _fs_;
55
56 veil = d3.select('#veil');
57
58 svg = veil.append('svg').attr({
59 width: 500,
60 height: 500,
61 viewBox: '0 0 500 500'
62 });
63
64 gs.addGlyph(svg, 'bird', 400);
65
66 return {
67 show: show,
68 hide: hide
69 };
70 }]);
71
72}());