From 046444b87be89c1fdd277c6b74ea99b2a46c1a7f Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Mon, 2 May 2016 06:16:17 -0400 Subject: #234 - reduced wizard to 3 steps, auto populated server name Former-commit-id: c7350db27cb0aa8d217c5599fe37b2424e0f3e3b --- www/js/LoginCtrl.js | 1 + www/js/WizardCtrl.js | 31 ++++++++++++++++++++++--------- www/templates/wizard.html | 43 +++++++++++++++++-------------------------- 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 @@ - +

Portal Authentication

Lets talk about how you have configured authentication If you have enabled authentication, toggle this button

- I use authentication - - I use ZM authentication - - + I use authentication + I use ZM authentication + +
+ + +
- I use Basic authentication + I use Basic authentication
- - -

Lets try and validate your inputs

-

I am now going to try and log into the ZM portal -
Tap on Next to start. -
- -

- - -
- +

Results of auto-detection

 {{wizard.portalValidText}}
-- cgit v1.2.3