mirror of
				https://github.com/opennetworkinglab/onos.git
				synced 2025-11-03 17:51:26 +01:00 
			
		
		
		
	GUI -- added 'debug' query param and cut out noisy debug console messages by default.
Change-Id: I8b3eff58677a3882c62c7f2267a5258ba2cd2593
This commit is contained in:
		
							parent
							
								
									53ae34f312
								
							
						
					
					
						commit
						4deb0e8de7
					
				@ -1,33 +1,44 @@
 | 
			
		||||
# Framework related code
 | 
			
		||||
 | 
			
		||||
- Util
 | 
			
		||||
    - General Functions
 | 
			
		||||
    - Key Handler
 | 
			
		||||
    - Theme Service
 | 
			
		||||
    - Alert Service
 | 
			
		||||
    - Preference Service
 | 
			
		||||
 | 
			
		||||
- Mast
 | 
			
		||||
    - Masthead
 | 
			
		||||
 | 
			
		||||
- Svg
 | 
			
		||||
    - Glyph Service
 | 
			
		||||
    - Icon Service
 | 
			
		||||
    - Map Service
 | 
			
		||||
    - Zoom Service
 | 
			
		||||
 | 
			
		||||
- Layers
 | 
			
		||||
- layer
 | 
			
		||||
    - Flash Service (transient messages)
 | 
			
		||||
    - Panel Service (floating panels)
 | 
			
		||||
    - Quick Help Service (key bindings, mouse gestures)
 | 
			
		||||
    - Death Mask Service (loss of server connection)
 | 
			
		||||
    - Veil Service (loss of server connection)
 | 
			
		||||
 | 
			
		||||
- Remote
 | 
			
		||||
    - Login Service
 | 
			
		||||
- mast
 | 
			
		||||
    - Masthead Service
 | 
			
		||||
 | 
			
		||||
- nav
 | 
			
		||||
    - Navigation Service (navigation menu)
 | 
			
		||||
 | 
			
		||||
- remote
 | 
			
		||||
    - REST Service
 | 
			
		||||
    - URL functin Service
 | 
			
		||||
    - Web Socket Service
 | 
			
		||||
    - Web Socket Event Service
 | 
			
		||||
    - Web Socket encapsulation
 | 
			
		||||
 | 
			
		||||
- Widget
 | 
			
		||||
    - Table Styling Directives
 | 
			
		||||
    - (Login Service) << planned
 | 
			
		||||
 | 
			
		||||
- svg
 | 
			
		||||
    - GeoData Service (TopoJSON map functions)
 | 
			
		||||
    - Glyph Service
 | 
			
		||||
    - Icon Service
 | 
			
		||||
    - Map Service
 | 
			
		||||
    - SVG Utilities Service
 | 
			
		||||
    - Zoom Service
 | 
			
		||||
 | 
			
		||||
- util
 | 
			
		||||
    - General Functions
 | 
			
		||||
    - Key Handler
 | 
			
		||||
    - User Preference Service
 | 
			
		||||
    - Randomization Service
 | 
			
		||||
    - Theme Service
 | 
			
		||||
 | 
			
		||||
- widget
 | 
			
		||||
    - Button Service
 | 
			
		||||
    - Table Service (table styling directives)
 | 
			
		||||
    - Table Builder Service
 | 
			
		||||
    - Toolbar Service
 | 
			
		||||
    - Button Service
 | 
			
		||||
    - Tooltip Service
 | 
			
		||||
 | 
			
		||||
@ -185,16 +185,22 @@
 | 
			
		||||
                    $log.warn('Panel with ID "' + id + '" already exists');
 | 
			
		||||
                    return null;
 | 
			
		||||
                }
 | 
			
		||||
                $log.debug('creating panel:', id, settings);
 | 
			
		||||
                if (fs.debugOn('widget')) {
 | 
			
		||||
                    $log.debug('creating panel:', id, settings);
 | 
			
		||||
                }
 | 
			
		||||
                return makePanel(id, settings);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            function destroyPanel(id) {
 | 
			
		||||
                if (panels[id]) {
 | 
			
		||||
                    $log.debug('destroying panel:', id);
 | 
			
		||||
                    if (fs.debugOn('widget')) {
 | 
			
		||||
                        $log.debug('destroying panel:', id);
 | 
			
		||||
                    }
 | 
			
		||||
                    removePanel(id);
 | 
			
		||||
                } else {
 | 
			
		||||
                    $log.debug('no panel to destroy:', id);
 | 
			
		||||
                    if (fs.debugOn('widget')) {
 | 
			
		||||
                        $log.debug('no panel to destroy:', id);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -67,6 +67,7 @@
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // function that only invokes the veil if the caller is the current view
 | 
			
		||||
    // TODO: review - is this deprecated ?
 | 
			
		||||
    function lostServer(ctrlName, msg) {
 | 
			
		||||
        if ($route.current.$$route.controller === ctrlName) {
 | 
			
		||||
            $log.debug('VEIL-service: ', ctrlName);
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,9 @@
 | 
			
		||||
        $log.info('Web socket open - ', url);
 | 
			
		||||
        vs.hide();
 | 
			
		||||
 | 
			
		||||
        $log.debug('Sending ' + pendingEvents.length + ' pending event(s)...');
 | 
			
		||||
        if (fs.debugOn('txrx')) {
 | 
			
		||||
            $log.debug('Sending ' + pendingEvents.length + ' pending event(s)...');
 | 
			
		||||
        }
 | 
			
		||||
        pendingEvents.forEach(function (ev) {
 | 
			
		||||
            _send(ev);
 | 
			
		||||
        });
 | 
			
		||||
@ -82,7 +84,9 @@
 | 
			
		||||
            $log.error('Message.data is not valid JSON', msgEvent.data, e);
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        $log.debug(' << *Rx* ', ev.event, ev.payload);
 | 
			
		||||
        if (fs.debugOn('txrx')) {
 | 
			
		||||
            $log.debug(' << *Rx* ', ev.event, ev.payload);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (h = handlers[ev.event]) {
 | 
			
		||||
            try {
 | 
			
		||||
@ -140,7 +144,9 @@
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function _send(ev) {
 | 
			
		||||
        $log.debug(' *Tx* >> ', ev.event, ev.payload);
 | 
			
		||||
        if (fs.debugOn('txrx')) {
 | 
			
		||||
            $log.debug(' *Tx* >> ', ev.event, ev.payload);
 | 
			
		||||
        }
 | 
			
		||||
        ws.send(JSON.stringify(ev));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,20 @@
 | 
			
		||||
(function () {
 | 
			
		||||
    'use strict';
 | 
			
		||||
 | 
			
		||||
    var $window;
 | 
			
		||||
    // injected services
 | 
			
		||||
    var $window, $log;
 | 
			
		||||
 | 
			
		||||
    // internal state
 | 
			
		||||
    var debugFlags = {};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    function _parseDebugFlags(dbgstr) {
 | 
			
		||||
        var bits = dbgstr ? dbgstr.split(",") : [];
 | 
			
		||||
        bits.forEach(function (key) {
 | 
			
		||||
            debugFlags[key] = true;
 | 
			
		||||
        });
 | 
			
		||||
        $log.debug('Debug flags:', dbgstr);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function isF(f) {
 | 
			
		||||
        return typeof f === 'function' ? f : null;
 | 
			
		||||
@ -186,10 +199,18 @@
 | 
			
		||||
                        .replace(/\.\d*/, ''));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // return true if the given debug flag was specified in the query params
 | 
			
		||||
    function debugOn(tag) {
 | 
			
		||||
        return debugFlags[tag];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    angular.module('onosUtil')
 | 
			
		||||
        .factory('FnService', ['$window', function (_$window_) {
 | 
			
		||||
        .factory('FnService',
 | 
			
		||||
        ['$window', '$location', '$log', function (_$window_, $loc, _$log_) {
 | 
			
		||||
            $window = _$window_;
 | 
			
		||||
            $log = _$log_;
 | 
			
		||||
 | 
			
		||||
            _parseDebugFlags($loc.search().debug);
 | 
			
		||||
 | 
			
		||||
            return {
 | 
			
		||||
                isF: isF,
 | 
			
		||||
@ -201,6 +222,7 @@
 | 
			
		||||
                areFunctionsNonStrict: areFunctionsNonStrict,
 | 
			
		||||
                windowSize: windowSize,
 | 
			
		||||
                isMobile: isMobile,
 | 
			
		||||
                debugOn: debugOn,
 | 
			
		||||
                find: find,
 | 
			
		||||
                inArray: inArray,
 | 
			
		||||
                removeFromArray: removeFromArray,
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@
 | 
			
		||||
    'use strict';
 | 
			
		||||
 | 
			
		||||
    // injected refs
 | 
			
		||||
    var $log, $cookies;
 | 
			
		||||
    var $log, $cookies, fs;
 | 
			
		||||
 | 
			
		||||
    // internal state
 | 
			
		||||
    var cache = {};
 | 
			
		||||
@ -106,14 +106,17 @@
 | 
			
		||||
 | 
			
		||||
        // FORCE cookie to be set by writing directly to document.cookie...
 | 
			
		||||
        document.cookie = name + '=' + encodeURIComponent(str);
 | 
			
		||||
        $log.debug('<<>> Wrote cookie <'+name+'>:', str);
 | 
			
		||||
        if (fs.debugOn('prefs')) {
 | 
			
		||||
            $log.debug('<<>> Wrote cookie <'+name+'>:', str);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    angular.module('onosUtil')
 | 
			
		||||
    .factory('PrefsService', ['$log', '$cookies',
 | 
			
		||||
        function (_$log_, _$cookies_) {
 | 
			
		||||
    .factory('PrefsService', ['$log', '$cookies', 'FnService',
 | 
			
		||||
        function (_$log_, _$cookies_, _fs_) {
 | 
			
		||||
            $log = _$log_;
 | 
			
		||||
            $cookies = _$cookies_;
 | 
			
		||||
            fs = _fs_;
 | 
			
		||||
 | 
			
		||||
            return {
 | 
			
		||||
                getPrefs: getPrefs,
 | 
			
		||||
 | 
			
		||||
@ -70,7 +70,9 @@
 | 
			
		||||
                    cstmWidths[index] = h.attr(colWidth);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            $log.debug('Headers with custom widths: ', cstmWidths);
 | 
			
		||||
            if (fs.debugOn('widget')) {
 | 
			
		||||
                $log.debug('Headers with custom widths: ', cstmWidths);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function setTdWidths(elem) {
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,9 @@
 | 
			
		||||
 | 
			
		||||
        function startRefresh() {
 | 
			
		||||
            promise = $interval(function () {
 | 
			
		||||
                $log.debug('Refreshing ' + root + ' page');
 | 
			
		||||
                if (fs.debugOn('widget')) {
 | 
			
		||||
                    $log.debug('Refreshing ' + root + ' page');
 | 
			
		||||
                }
 | 
			
		||||
                sortCb(o.scope.sortParams);
 | 
			
		||||
            }, refreshInterval);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user