diff options
| -rw-r--r-- | README.md | 31 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 24 |
2 files changed, 50 insertions, 5 deletions
@@ -30,7 +30,38 @@ haven't spent time researching how to optimize. I'll keep refining it over time as I learn more of AngularJS and stuff. +Building +-------- +zmNinja uses the [Ionic Framework](http://ionicframework.com/). To install Ionic, follow their easy [Getting Started instructions](http://ionicframework.com/getting-started/). + +With Ionic installed, you will need to install the build dependencies: + +```bash +$ cd zmNinja # make sure you are in the directory where the project is checked out +$ npm install +``` + +Next, build the application. You will need to specify the appropriate target, either `ios` or `android`: + +```bash +$ ionic build ios +# - OR - +$ ionic build android +``` + +If you want to run zmNinja in an emulator, you will need to install the appropriate emulator tools. + +* For iOS, you will need the latest version of XCode (available in the App Store) as well as the npm package `ios-sim`: `npm install -g ios-sim` +* For Android, you will need the latest [Android Studio](https://developer.android.com/sdk/index.html) + +Now, you can launch the emulator: + +```bash +$ ionic emulate ios +# - OR - +$ ionic emulate android +``` Screenshots: diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index efaa08e7..9bf86e65 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -155,17 +155,31 @@ function addhttp(url) { // fail in app.js that will be called to show an error // box - // Note that API auth ties into ZM Auth, so in one fell - // swoop we've just validated both. Happy? .then( function(data) { - //console.log ("THE DATA WAS " + data); - //console.log ("SHOWING POPUP "); - $ionicPopup.alert({ + // Now let's validate if the API works + + ZMDataModel.zmLog ("Validating APIs at " + apiurl); + $http.get(apiurl) + .success (function (data) { + $ionicPopup.alert({ title: 'Login validated', template: 'Please explore the menu and enjoy zmNinja!' }).then(function(res) { $ionicSideMenuDelegate.toggleLeft();}); + + }) + .error (function (error) { + ZMDataModel.displayBanner ('error',['ZoneMinder API check failed', 'Please check API settings']); + ZMDataModel.zmLog ("API login error " + JSON.stringify(error)); + $ionicPopup.alert({ + title: 'Login validated but API failed', + template: 'Please check your API settings' + }); + }); + + + }); }; |
