summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-05-01 17:55:42 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-05-01 17:55:42 -0400
commitc1ee8e4bef91728e9f6946be3e45fce576489fd7 (patch)
tree055b16e75a82e3b8709cd073454c260a3a1ad56a /www
parentedc5883274e5910a65e35070102c34719a6516ce (diff)
#234 http messages
Former-commit-id: 0709e65ee08bb2e71fd9787c1ed2b7c4b280afd1
Diffstat (limited to 'www')
-rw-r--r--www/js/WizardCtrl.js47
1 files changed, 45 insertions, 2 deletions
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js
index 9f662adf..2ab49d73 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', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicHistory, $state, $ionicPopup, SecuredPopups, $http, $q, zm) {
+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) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
@@ -165,16 +165,29 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
function continueCgi (urls)
{
+ $ionicLoading.show({
+ template: "discovering...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
getFirstMonitor()
.then (function (success){
-
+ $ionicLoading.hide();
var tail = "/nph-zms?mode=single&monitor="+success;
if ($scope.wizard.useauth && $scope.wizard.usezmauth)
{
tail+= "&user="+$scope.wizard.zmuser+"&pass="+$scope.wizard.zmpassword;
}
+
+ $ionicLoading.show({
+ template: "discovering...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
+
findFirstReachableUrl(urls,tail )
.then (function (success) {
+ $ionicLoading.hide();
ZMDataModel.zmLog ("Valid cgi-bin found with: " + success);
$scope.wizard.streamingURL = success;
$scope.wizard.streamingValidText = "cgi-bin detection succeeded: "+$scope.wizard.streamingURL;
@@ -184,6 +197,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
},
function (error) {
+ $ionicLoading.hide();
console.log ("No cgi-bin found: " + error);
$scope.wizard.streamingValidText = "cgi-bin detection failed";
$scope.wizard.streamingColor = "#e74c3c";
@@ -192,6 +206,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
});
},
function (error){
+ $ionicLoading.hide();
$scope.wizard.streamingValidText = "cgi-bin detection failed. No configured monitor found.";
$scope.wizard.streamingColor = "#e74c3c";
d.reject (false);
@@ -348,33 +363,60 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
// logout first for the adventurers amongst us who must
// use it even after logging in
ZMDataModel.zmLog("zmWizard: logging out");
+ $ionicLoading.show({
+ template: "cleaning up...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
logout(u)
.then(function (ans) {
// login now
+ $ionicLoading.hide();
ZMDataModel.zmLog("zmWizard: logging in with " + u + " " + zmu + ":" + zmp);
// The logic will be:
// Login then do an api detect and cgi-detect together
+ $ionicLoading.show({
+ template: "discovering portal...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
login(u, zmu, zmp)
.then(function (success) {
+ $ionicLoading.hide();
ZMDataModel.zmLog("zmWizard: login succeeded");
// API Detection
+ $ionicLoading.show({
+ template: "discovering api...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
detectapi()
.then (function (success) {
+ $ionicLoading.hide();
ZMDataModel.zmLog ("zmWizard: API succeeded");
+
+ $ionicLoading.show({
+ template: "discovering cgi-bin...",
+ noBackdrop: true,
+ duration: zm.httpTimeout
+ });
// CGI detection
detectcgi ()
.then (function (success) {
+ $ionicLoading.hide();
// return true here because we want to progress
return d.resolve(true);
},
function (error) {
+ $ionicLoading.hide();
// return true here because we want to progress
return d.resolve(true);
});
},
function (error) {
+ $ionicLoading.hide();
ZMDataModel.zmLog("zmWizard: api failed");
// return true here because we want to progress
@@ -386,6 +428,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
// if login failed, don't progress in the wizard
function (error) {
+ $ionicLoading.hide();
ZMDataModel.zmLog("zmWizard: login failed");
$scope.wizard.portalValidText = "Portal login was unsuccessful. Please go back and review your settings";
$scope.wizard.portalColor = "#e74c3c";