summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-05-02 06:16:17 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-05-02 06:16:17 -0400
commit046444b87be89c1fdd277c6b74ea99b2a46c1a7f (patch)
tree7b343ee594a996b2c14f94aeb95689e50c84d706
parenta33f23116f2e06019f6debd492499a1bfe724331 (diff)
#234 - reduced wizard to 3 steps, auto populated server name
Former-commit-id: c7350db27cb0aa8d217c5599fe37b2424e0f3e3b
-rw-r--r--www/js/LoginCtrl.js1
-rw-r--r--www/js/WizardCtrl.js31
-rw-r--r--www/templates/wizard.html43
3 files changed, 40 insertions, 35 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index eb2e5583..b9d26a0a 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -209,6 +209,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
{
ZMDataModel.zmLog ("Creating new login entry for wizard");
$scope.loginData = angular.copy(ZMDataModel.getDefaultLoginObject());
+ $scope.loginData.serverName = $rootScope.wizard.serverName;
$scope.loginData.url = $rootScope.wizard.loginURL;
$scope.loginData.apiurl = $rootScope.wizard.apiURL;
$scope.loginData.streamingurl = $rootScope.wizard.streamingURL;
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js
index 8acedb96..f8a40989 100644
--- a/www/js/WizardCtrl.js
+++ b/www/js/WizardCtrl.js
@@ -2,7 +2,7 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console, Masonry, URI */
-angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicHistory', '$state', '$ionicPopup', 'SecuredPopups', '$http', '$q', 'zm','$ionicLoading', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicHistory, $state, $ionicPopup, SecuredPopups, $http, $q, zm, $ionicLoading) {
+angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicHistory', '$state', '$ionicPopup', 'SecuredPopups', '$http', '$q', 'zm','$ionicLoading', 'WizardHandler', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicHistory, $state, $ionicPopup, SecuredPopups, $http, $q, zm, $ionicLoading, WizardHandler) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
@@ -331,18 +331,26 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
// tries to log into the portal and then discover api and cgi-bin
//--------------------------------------------------------------------------
- $scope.exitValidate = function () {
+ function validateData() {
$rootScope.authSession = 'undefined';
$rootScope.zmCookie = '';
- $scope.portalValidText = "";
- $scope.apiValidateText = "";
- $scope.streamingValidateText = "";
+ $scope.wizard.portalValidText = "";
+ $scope.wizard.apiValidText = "";
+ $scope.wizard.streamingValidText = "";
$scope.wizard.fqportal = "";
-
+ $scope.wizard.loginURL= "";
+ $scope.wizard.apiURL= "";
+ $scope.wizard.streamingURL= "";
+ $scope.wizard.serverName = "";
+
var d = $q.defer();
var c = URI.parse($scope.wizard.portalurl);
+
+ $scope.wizard.serverName = c.host;
+ if (c.port)
+ $scope.wizard.serverName += "-"+c.port;
var b = "";
if ($scope.wizard.useauth && $scope.wizard.usebasicauth) {
@@ -452,7 +460,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
}); //finally
return d.promise;
- };
+ }
//--------------------------------------------------------------------------
@@ -514,7 +522,11 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
}
}
}
- return true;
+ // Coming here means we can go to the next step
+ // load the step
+ WizardHandler.wizard().next();
+ // start discovery;
+ validateData();
};
@@ -589,7 +601,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
// part of auth wizard - toggles display of auth components
//--------------------------------------------------------------------------
$scope.toggleAuth = function () {
- $scope.wizard.useauth = !$scope.wizard.useauth;
+
if (!$scope.wizard.useauth) {
$scope.wizard.usebasicauth = false;
$scope.wizard.usezmauth = false;
@@ -646,6 +658,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
apiColor: "",
streamingValidText: "",
streamingColor: "",
+ serverName: "",
};
diff --git a/www/templates/wizard.html b/www/templates/wizard.html
index fa89c977..a3af8b51 100644
--- a/www/templates/wizard.html
+++ b/www/templates/wizard.html
@@ -36,23 +36,25 @@
<!-- auth mode -->
- <wz-step wz-title="2" canexit="exitAuth" >
+ <wz-step wz-title="2" >
<h4>Portal Authentication</h4>
<p>Lets talk about how you have configured authentication If you have enabled authentication, toggle this button</p>
- <ion-toggle ng-change="toggleAuth" ng-model="wizard.useauth" toggle-class="toggle-calm">I use authentication</ion-toggle>
-
- <ion-toggle ng-show="wizard.useauth" ng-model="wizard.usezmauth" toggle-class="toggle-calm">I use ZM authentication</ion-toggle>
- <label class="item item-input item-floating-label" ng-show="wizard.usezmauth">
- <span class="input-label">user name</span>
- <input autocapitalize="none" autocomplete="off" type="text" ng-model="wizard.zmuser" placeholder="zm auth username" >
- </label>
- <label class="item item-input item-floating-label" ng-show="wizard.usezmauth">
- <span class="input-label">password</span>
- <input type="password" ng-model="wizard.zmpassword" placeholder="zm auth password" >
- </label>
+ <ion-toggle ng-change="toggleAuth()" ng-model="wizard.useauth" ng-checked="wizard.useauth" toggle-class="toggle-calm">I use authentication</ion-toggle>
+ <ion-toggle ng-show="wizard.useauth" ng-model="wizard.usezmauth" ng-checked="wizard.usezmauth" toggle-class="toggle-calm">I use ZM authentication</ion-toggle>
+
+ <div ng-if="wizard.usezmauth">
+ <label class="item item-input item-floating-label" >
+ <span class="input-label">user name</span>
+ <input autocapitalize="none" autocomplete="off" type="text" ng-model="wizard.zmuser" placeholder="zm auth username" >
+ </label>
+ <label class="item item-input item-floating-label" >
+ <span class="input-label">password</span>
+ <input type="password" ng-model="wizard.zmpassword" placeholder="zm auth password" >
+ </label>
+ </div>
- <ion-toggle ng-show="wizard.useauth" ng-model="wizard.usebasicauth" toggle-class="toggle-calm">I use Basic authentication</ion-toggle>
+ <ion-toggle ng-show="wizard.useauth" ng-model="wizard.usebasicauth" ng-checked="wizard.usebasicauth" toggle-class="toggle-calm">I use Basic authentication</ion-toggle>
<label class="item item-input item-floating-label" ng-show="wizard.usebasicauth">
<span class="input-label">user name</span>
<input autocapitalize="none" autocomplete="off" type="text" ng-model="wizard.basicuser" placeholder="basic auth username" >
@@ -73,23 +75,12 @@
<br/>
<button class="button button-small icon icon-left ion-chevron-left" wz-previous>Prev</button>
- <button class="button button-small icon icon-right ion-chevron-right" wz-next>Next</button>
+ <button class="button button-small icon icon-right ion-chevron-right" ng-click="exitAuth()">Next</button>
</wz-step>
- <!-- validate url with auth -->
- <wz-step wz-title="3" canexit="exitValidate" canenter="enterResults">
- <h4>Lets try and validate your inputs</h4>
- <p>I am now going to try and log into the ZM portal
- <br/>Tap on Next to start.
- <br/>
-
- </p>
- <button class="button button-small icon icon-left ion-chevron-left" wz-previous>Prev</button>
- <button class="button button-small icon icon-right ion-chevron-right" wz-next>Next</button>
- </wz-step>
- <wz-step wz-title="4" >
+ <wz-step wz-title="3" >
<h4>Results of auto-detection</h4>
<span ng-if="wizard.portalValidText" style="color:{{wizard.portalColor}};"><i ng-class="wizard.portalColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.portalValidText}}<br/></span>