mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-24 05:41:01 +02:00
GUI -- Strange Device View Table layout fixed in Safari.
Change-Id: Icfb3d80654a2ab009ca12b64f35a20ba98f37681
This commit is contained in:
parent
cd48d22d50
commit
55ee09b1fa
@ -122,6 +122,28 @@
|
|||||||
return patt.test(ua);
|
return patt.test(ua);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if the current browser determined to be Chrome
|
||||||
|
function isChrome() {
|
||||||
|
var isChromium = $window.chrome,
|
||||||
|
vendorName = $window.navigator.vendor,
|
||||||
|
isOpera = $window.navigator.userAgent.indexOf("OPR") > -1;
|
||||||
|
return (isChromium !== null &&
|
||||||
|
isChromium !== undefined &&
|
||||||
|
vendorName === "Google Inc." &&
|
||||||
|
isOpera == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if the current browser determined to be Safari
|
||||||
|
function isSafari() {
|
||||||
|
return ($window.navigator.userAgent.indexOf('Safari') !== -1 &&
|
||||||
|
$window.navigator.userAgent.indexOf('Chrome') === -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if the current browser determined to be Firefox
|
||||||
|
function isFirefox() {
|
||||||
|
return typeof InstallTrigger !== 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
// search through an array of objects, looking for the one with the
|
// search through an array of objects, looking for the one with the
|
||||||
// tagged property matching the given key. tag defaults to 'id'.
|
// tagged property matching the given key. tag defaults to 'id'.
|
||||||
// returns the index of the matching object, or -1 for no match.
|
// returns the index of the matching object, or -1 for no match.
|
||||||
@ -249,6 +271,9 @@
|
|||||||
areFunctionsNonStrict: areFunctionsNonStrict,
|
areFunctionsNonStrict: areFunctionsNonStrict,
|
||||||
windowSize: windowSize,
|
windowSize: windowSize,
|
||||||
isMobile: isMobile,
|
isMobile: isMobile,
|
||||||
|
isChrome: isChrome,
|
||||||
|
isSafari: isSafari,
|
||||||
|
isFirefox: isFirefox,
|
||||||
debugOn: debugOn,
|
debugOn: debugOn,
|
||||||
find: find,
|
find: find,
|
||||||
inArray: inArray,
|
inArray: inArray,
|
||||||
|
|||||||
@ -251,8 +251,9 @@
|
|||||||
$log.log('OvDeviceCtrl has been created');
|
$log.log('OvDeviceCtrl has been created');
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.directive('deviceDetailsPanel', ['$rootScope', '$window', 'KeyService',
|
.directive('deviceDetailsPanel',
|
||||||
function ($rootScope, $window, ks) {
|
['$rootScope', '$window', '$timeout', 'KeyService',
|
||||||
|
function ($rootScope, $window, $timeout, ks) {
|
||||||
return function (scope) {
|
return function (scope) {
|
||||||
var unbindWatch;
|
var unbindWatch;
|
||||||
|
|
||||||
@ -262,10 +263,19 @@
|
|||||||
wSize = fs.windowSize(pStartY);
|
wSize = fs.windowSize(pStartY);
|
||||||
pHeight = wSize.height;
|
pHeight = wSize.height;
|
||||||
}
|
}
|
||||||
heightCalc();
|
|
||||||
|
|
||||||
createDetailsPane();
|
function initPanel() {
|
||||||
|
heightCalc();
|
||||||
|
createDetailsPane();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Safari has a bug where it renders the fixed-layout table wrong
|
||||||
|
// if you ask for the window's size too early
|
||||||
|
if (scope.onos.browser === 'safari') {
|
||||||
|
$timeout(initPanel);
|
||||||
|
} else {
|
||||||
|
initPanel();
|
||||||
|
}
|
||||||
// create key bindings to handle panel
|
// create key bindings to handle panel
|
||||||
ks.keyBindings({
|
ks.keyBindings({
|
||||||
esc: [closePanel, 'Close the details panel'],
|
esc: [closePanel, 'Close the details panel'],
|
||||||
@ -276,6 +286,7 @@
|
|||||||
['scroll down', 'See more devices']
|
['scroll down', 'See more devices']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// if the panelData changes
|
||||||
scope.$watch('panelData', function () {
|
scope.$watch('panelData', function () {
|
||||||
if (!fs.isEmptyObject(scope.panelData)) {
|
if (!fs.isEmptyObject(scope.panelData)) {
|
||||||
populateDetails(scope.panelData);
|
populateDetails(scope.panelData);
|
||||||
@ -283,6 +294,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// if the window size changes
|
||||||
unbindWatch = $rootScope.$watchCollection(
|
unbindWatch = $rootScope.$watchCollection(
|
||||||
function () {
|
function () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -145,7 +145,7 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="light" ng-app="onosApp">
|
<body class="light" ng-app="onosApp">
|
||||||
<div id="frame" ng-controller="OnosCtrl as onosCtrl">
|
<div id="frame" ng-controller="OnosCtrl as onosCtrl" detect-browser>
|
||||||
<div id="mast"
|
<div id="mast"
|
||||||
ng-controller="MastCtrl as mastCtrl"
|
ng-controller="MastCtrl as mastCtrl"
|
||||||
ng-include="'app/fw/mast/mast.html'"></div>
|
ng-include="'app/fw/mast/mast.html'"></div>
|
||||||
|
|||||||
@ -69,12 +69,12 @@
|
|||||||
angular.module('onosApp', moduleDependencies)
|
angular.module('onosApp', moduleDependencies)
|
||||||
|
|
||||||
.controller('OnosCtrl', [
|
.controller('OnosCtrl', [
|
||||||
'$log', '$route', '$routeParams', '$location',
|
'$log', '$scope', '$route', '$routeParams', '$location',
|
||||||
'KeyService', 'ThemeService', 'GlyphService', 'VeilService',
|
'KeyService', 'ThemeService', 'GlyphService', 'VeilService',
|
||||||
'PanelService', 'FlashService', 'QuickHelpService',
|
'PanelService', 'FlashService', 'QuickHelpService',
|
||||||
'WebSocketService',
|
'WebSocketService',
|
||||||
|
|
||||||
function ($log, $route, $routeParams, $location,
|
function ($log, $scope, $route, $routeParams, $location,
|
||||||
ks, ts, gs, vs, ps, flash, qhs, wss) {
|
ks, ts, gs, vs, ps, flash, qhs, wss) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -83,6 +83,9 @@
|
|||||||
self.$location = $location;
|
self.$location = $location;
|
||||||
self.version = '1.3.0';
|
self.version = '1.3.0';
|
||||||
|
|
||||||
|
// shared object inherited by all views:
|
||||||
|
$scope.onos = {};
|
||||||
|
|
||||||
// initialize services...
|
// initialize services...
|
||||||
ts.init();
|
ts.init();
|
||||||
ks.installOn(d3.select('body'));
|
ks.installOn(d3.select('body'));
|
||||||
@ -131,5 +134,29 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.directive('detectBrowser', ['$log', 'FnService',
|
||||||
|
function ($log, fs) {
|
||||||
|
return function (scope) {
|
||||||
|
var body = d3.select('body'),
|
||||||
|
browser = '';
|
||||||
|
if (fs.isChrome()) {
|
||||||
|
browser = 'chrome';
|
||||||
|
} else if (fs.isSafari()) {
|
||||||
|
browser = 'safari';
|
||||||
|
} else if (fs.isFirefox()) {
|
||||||
|
browser = 'firefox';
|
||||||
|
}
|
||||||
|
body.classed(browser, true);
|
||||||
|
scope.onos.browser = browser;
|
||||||
|
|
||||||
|
if (fs.isMobile()) {
|
||||||
|
body.classed('mobile', true);
|
||||||
|
scope.onos.mobile = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$log.debug('Detected browser is', fs.cap(browser));
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
}());
|
}());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user