Skip to content

Commit

Permalink
fix(graphs): fix graph rendering on android
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Mar 14, 2016
1 parent 8af3624 commit 42f3db2
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 66 deletions.
113 changes: 57 additions & 56 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.opennms.compass" version="2.1.0" ios-CFBundleVersion="395" android-versionCode="395" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="395" id="com.opennms.compass" ios-CFBundleVersion="395" version="2.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>OpenNMS</name>
<description>OpenNMS Compass</description>
<author email="ranger@opennms.com" href="http://www.opennms.com/">Benjamin Reed</author>
Expand All @@ -25,93 +25,94 @@
<preference name="KeyboardDisplayRequiresUserAction" value="false"/>
<preference name="MediaPlaybackRequiresUserAction" value="false"/>
<preference name="SuppressesIncrementalRendering" value="false"/>
<preference name="xwalkVersion" value="14+"/>
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect"/>
<preference name="xwalkMode" value="embedded"/>
<preference name="xwalkMultipleApk" value="true"/>
<preference name="xwalkVersion" value="org.xwalk:xwalk_core_library_beta:18+"/>
<feature name="Console">
<param name="ios-package" value="CDVLogger" onload="true"/>
<param name="ios-package" onload="true" value="CDVLogger"/>
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" onload="true"/>
<param name="ios-package" onload="true" value="CDVDevice"/>
</feature>
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" onload="true"/>
<param name="ios-package" onload="true" value="CDVConnection"/>
</feature>
<feature name="SplashScreen">
<param name="ios-package" value="CDVSplashScreen" onload="true"/>
<param name="ios-package" onload="true" value="CDVSplashScreen"/>
<param name="onload" value="true"/>
</feature>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
<param name="ios-package" onload="true" value="CDVStatusBar"/>
<param name="onload" value="true"/>
</feature>
<platform name="android">
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png"/>
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png"/>
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png"/>
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png"/>
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png"/>
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png"/>
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png"/>
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png"/>
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png"/>
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png"/>
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png"/>
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png"/>
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png"/>
</platform>
<platform name="ios">
<splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
<splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
<splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
<splash src="resources/ios/splash/Default-Landscape-736h.png" width="2208" height="1242"/>
<splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
<splash src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
<splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
<splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
<icon src="resources/ios/icon/icon.png" width="57" height="57"/>
<icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
<icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
<icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
<icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
<icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
<icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
<icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
<icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
<icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
<icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
<icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
<icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
<icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
<icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
<config-file platform="ios" target="*-Info.plist" parent="UISupportedInterfaceOrientations">
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640"/>
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750"/>
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242"/>
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208"/>
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048"/>
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024"/>
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536"/>
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768"/>
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640"/>
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320"/>
<icon height="57" src="resources/ios/icon/icon.png" width="57"/>
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114"/>
<icon height="40" src="resources/ios/icon/icon-40.png" width="40"/>
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80"/>
<icon height="50" src="resources/ios/icon/icon-50.png" width="50"/>
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100"/>
<icon height="60" src="resources/ios/icon/icon-60.png" width="60"/>
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120"/>
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180"/>
<icon height="72" src="resources/ios/icon/icon-72.png" width="72"/>
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144"/>
<icon height="76" src="resources/ios/icon/icon-76.png" width="76"/>
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152"/>
<icon height="29" src="resources/ios/icon/icon-small.png" width="29"/>
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58"/>
<config-file parent="UISupportedInterfaceOrientations" platform="ios" target="*-Info.plist">
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</config-file>
<config-file platform="ios" target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad">
<config-file parent="UISupportedInterfaceOrientations~ipad" platform="ios" target="*-Info.plist">
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</config-file>
<config-file platform="ios" target="*-Info.plist" parent="NSAppTransportSecurity">
<config-file parent="NSAppTransportSecurity" platform="ios" target="*-Info.plist">
<dict>
<key>NSAllowsArbitraryLoads</key>
<true></true>
<true/>
</dict>
</config-file>
<config-file platform="ios" target="*-Info.plist" parent="UIRequiresFullScreen">
<true></true>
<config-file parent="UIRequiresFullScreen" platform="ios" target="*-Info.plist">
<true/>
</config-file>
<config-file platform="ios" target="project.pbxproj">
<build-property name="ENABLE_BITCODE" value="NO"/>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"locator": "https://github.com/RangerRick/cordova-HTTP.git",
"id": "com.raccoonfink.cordova.plugins.http"
},
"cordova-plugin-screen-orientation"
"cordova-plugin-screen-orientation",
"cordova-plugin-crosswalk-webview"
],
"cordovaPlatforms": [
{
Expand Down
5 changes: 4 additions & 1 deletion src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
/*
require('style!css!../../bower_components/leaflet/dist/leaflet.css');
require('../../scss/opennms.scss');
require('../../bower_components/onmsicons/scss/onmsicons.scss');
*/
require('../../bower_components/onmsicons/fonts/onmsicons.eot');
require('../../bower_components/onmsicons/fonts/onmsicons.svg');
require('../../bower_components/onmsicons/fonts/onmsicons.ttf');
require('../../bower_components/onmsicons/fonts/onmsicons.woff');

var angular = require('angular');

Expand Down
2 changes: 1 addition & 1 deletion src/app/misc/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
CLEARED: 'ion-happy',
NORMAL: 'ion-record',
WARNING: 'ion-minus-circled',
MINOR: 'ion-alert-circled',
MINOR: 'ion-android-alert',
MAJOR: 'ion-flame',
CRITICAL: 'ion-nuclear'
};
Expand Down
29 changes: 26 additions & 3 deletions src/app/nodes/ResourceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,26 @@
Accept: 'application/json'
}).then(function(response) {
//$log.debug('cordovaHTTP response: ' + angular.toJson(response));
success(response.data);
if (angular.isString(response.data)) {
try {
var json = angular.fromJson(response.data);
//$log.debug('cordovaHTTP: json = ' + angular.toJson(json));
success(json);
} catch (err) {
if (err.message) {
$log.error('ResourceService.fetchFunction: error: ' + err.message);
} else {
$log.error('ResourceService.fetchFunction: error: ' + err);
}
$log.debug('ResourceService.fetchFunction: falling back to sending the raw response data string.');
success(response.data);
}
} else {
success(response.data);
}
}, function(err) {
var error = new RestError(url, err.data, err.status);
$log.error('cordovaHTTP error: ' + error.toString());
$log.error('ResourceService.fetchFunction: cordovaHTTP error: ' + error.toString());
failure(error.toString());
});
};
Expand Down Expand Up @@ -285,7 +301,14 @@
var _graphs = {};

var favoritesDB = db.get('favorites');
favoritesDB.createIndex({
index: {
fields: ['time', 'server', 'username']
}
});
var findFavorites = function(options) {
var fields = Object.keys(options.selector);
// $log.debug('findFavorites: fields=' + fields);
return favoritesDB.createIndex({
index: {
fields: Object.keys(options.selector)
Expand Down Expand Up @@ -396,7 +419,7 @@
var getFavorites = function() {
//$log.debug('ResourceService.getFavorites()');
return _getServer('getFavorites').then(function(server) {
return findFavorites({
return findFavorites({
selector: {
server: server._id,
username: server.username,
Expand Down
1 change: 1 addition & 0 deletions src/app/servers/Servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
if (!server._id) {
server._id = uuid4.generate();
}
server = angular.fromJson(angular.toJson(server));

return serversDB.get(server._id).then(function(doc) {
angular.extend(doc, server);
Expand Down
8 changes: 5 additions & 3 deletions src/app/settings/SettingsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
};

var _loadSettings = function() {
return settingsDB.find({
return findSettings({
selector: {key: {$gt: null}},
sort: ['key']
}).then(function(result) {
Expand Down Expand Up @@ -288,8 +288,10 @@
};

var _setDefaultServerId = function(id) {
storage.set('opennms.default-server-id', id);
return $q.when(id);
return getSettings().then(function(settings) {
settings.defaultServerId = id;
return saveSettings(settings);
});
};

var _getRestLimit = function() {
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'">
<meta http-equiv="Content-Security-Policy" content="img-src 'self' data:; font-src 'self' data:; default-src *; style-src 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'">

<style>
[ng\:cloak], [ng-cloak], .ng-cloak {
Expand Down

0 comments on commit 42f3db2

Please sign in to comment.