usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [11/71] [abbrv] updating portal with latest code base
Date Thu, 20 Feb 2014 16:20:59 GMT
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/app.js
----------------------------------------------------------------------
diff --git a/portal/js/app.js b/portal/js/app.js
index 80f9cca..b097f12 100644
--- a/portal/js/app.js
+++ b/portal/js/app.js
@@ -51,7 +51,6 @@ AppServices.Services = angular.module('appservices.services', []);
 AppServices.Controllers = angular.module('appservices.controllers', []);
 AppServices.Filters = angular.module('appservices.filters', []);
 AppServices.Directives = angular.module('appservices.directives', []);
-AppServices.Performance = angular.module('appservices.performance', []);
 AppServices.Push = angular.module('appservices.push', []);
 
 angular.module('appservices',
@@ -59,8 +58,6 @@ angular.module('appservices',
       'ngResource',
       'ngSanitize',
       'ui.bootstrap',
-      'angulartics',
-      'angulartics.google.analytics',
       'appservices.filters',
       'appservices.services',
       'appservices.directives',
@@ -68,58 +65,53 @@ angular.module('appservices',
       'appservices.controllers',
       'appservices.performance',
       'appservices.push'
-    ]).config(['$routeProvider',
-                                          '$locationProvider',
-                                          '$sceDelegateProvider','$analyticsProvider', function
($routeProvider,
-                                                                            $locationProvider,
-                                                                            $sceDelegateProvider,
$analyticsProvider) {
-    $routeProvider
-      .when('/org-overview', {templateUrl: 'org-overview/org-overview.html', controller:
'OrgOverviewCtrl'})
-      .when('/login', {templateUrl: 'login/login.html', controller: 'LoginCtrl'})
-      .when('/login/loading', {templateUrl: 'login/loading.html', controller: 'LoginCtrl'})
-      .when('/app-overview/summary', {templateUrl: 'app-overview/app-overview.html', controller:
'AppOverviewCtrl'})
-      .when('/getting-started/setup', {templateUrl: 'app-overview/getting-started.html',
controller: 'GettingStartedCtrl'})
-      .when('/forgot-password', {templateUrl: 'login/forgot-password.html', controller: 'ForgotPasswordCtrl'})
-      .when('/register', {templateUrl: 'login/register.html', controller: 'RegisterCtrl'})
-      .when('/users', {templateUrl: 'users/users.html', controller: 'UsersCtrl'})
-      .when('/users/profile', {templateUrl: 'users/users-profile.html', controller: 'UsersProfileCtrl'})
-      .when('/users/groups', {templateUrl: 'users/users-groups.html', controller: 'UsersGroupsCtrl'})
-      .when('/users/activities', {templateUrl: 'users/users-activities.html', controller:
'UsersActivitiesCtrl'})
-      .when('/users/graph', {templateUrl: 'users/users-graph.html', controller: 'UsersGraphCtrl'})
-      .when('/users/roles', {templateUrl: 'users/users-roles.html', controller: 'UsersRolesCtrl'})
-      .when('/groups', {templateUrl: 'groups/groups.html', controller: 'GroupsCtrl'})
-      .when('/groups/details', {templateUrl: 'groups/groups-details.html', controller: 'GroupsDetailsCtrl'})
-      .when('/groups/members', {templateUrl: 'groups/groups-members.html', controller: 'GroupsMembersCtrl'})
-      .when('/groups/activities', {templateUrl: 'groups/groups-activities.html', controller:
'GroupsActivitiesCtrl'})
-      .when('/groups/roles', {templateUrl: 'groups/groups-roles.html', controller: 'GroupsRolesCtrl'})
-      .when('/roles', {templateUrl: 'roles/roles.html', controller: 'RolesCtrl'})
-      .when('/roles/settings', {templateUrl: 'roles/roles-settings.html', controller: 'RolesSettingsCtrl'})
-      .when('/roles/users', {templateUrl: 'roles/roles-users.html', controller: 'RolesUsersCtrl'})
-      .when('/roles/groups', {templateUrl: 'roles/roles-groups.html', controller: 'RolesGroupsCtrl'})
-      .when('/data', {templateUrl: 'data/data.html', controller: 'DataCtrl'})
-      .when('/data/entity', {templateUrl: 'data/entity.html', controller: 'EntityCtrl'})
-      .when('/data/shell', {templateUrl: 'data/shell.html', controller: 'ShellCtrl'})
-      .when('/profile/organizations', {templateUrl: 'profile/organizations.html', controller:
'OrgCtrl'})
-      .when('/profile/profile', {templateUrl: 'profile/profile.html', controller: 'ProfileCtrl'})
-      .when('/profile', {templateUrl: 'profile/account.html', controller: 'AccountCtrl'})
-      .when('/activities', {templateUrl: 'activities/activities.html', controller: 'ActivitiesCtrl'})
-      .when('/shell', {templateUrl: 'shell/shell.html', controller: 'ShellCtrl'})
-      .when('/logout',{templateUrl: 'login/logout.html',controller:'LogoutCtrl'})
-      .otherwise({redirectTo: '/org-overview'});
+    ]).config(['$routeProvider', '$locationProvider','$sceDelegateProvider',
+        function ($routeProvider,$locationProvider,$sceDelegateProvider) {
+            $routeProvider
+                .when('/org-overview', {templateUrl: 'org-overview/org-overview.html', controller:
'OrgOverviewCtrl'})
+                .when('/login', {templateUrl: 'login/login.html', controller: 'LoginCtrl'})
+                .when('/login/loading', {templateUrl: 'login/loading.html', controller: 'LoginCtrl'})
+                .when('/app-overview/summary', {templateUrl: 'app-overview/app-overview.html',
controller: 'AppOverviewCtrl'})
+                .when('/getting-started/setup', {templateUrl: 'app-overview/getting-started.html',
controller: 'GettingStartedCtrl'})
+                .when('/forgot-password', {templateUrl: 'login/forgot-password.html', controller:
'ForgotPasswordCtrl'})
+                .when('/register', {templateUrl: 'login/register.html', controller: 'RegisterCtrl'})
+                .when('/users', {templateUrl: 'users/users.html', controller: 'UsersCtrl'})
+                .when('/users/profile', {templateUrl: 'users/users-profile.html', controller:
'UsersProfileCtrl'})
+                .when('/users/groups', {templateUrl: 'users/users-groups.html', controller:
'UsersGroupsCtrl'})
+                .when('/users/activities', {templateUrl: 'users/users-activities.html', controller:
'UsersActivitiesCtrl'})
+                .when('/users/graph', {templateUrl: 'users/users-graph.html', controller:
'UsersGraphCtrl'})
+                .when('/users/roles', {templateUrl: 'users/users-roles.html', controller:
'UsersRolesCtrl'})
+                .when('/groups', {templateUrl: 'groups/groups.html', controller: 'GroupsCtrl'})
+                .when('/groups/details', {templateUrl: 'groups/groups-details.html', controller:
'GroupsDetailsCtrl'})
+                .when('/groups/members', {templateUrl: 'groups/groups-members.html', controller:
'GroupsMembersCtrl'})
+                .when('/groups/activities', {templateUrl: 'groups/groups-activities.html',
controller: 'GroupsActivitiesCtrl'})
+                .when('/groups/roles', {templateUrl: 'groups/groups-roles.html', controller:
'GroupsRolesCtrl'})
+                .when('/roles', {templateUrl: 'roles/roles.html', controller: 'RolesCtrl'})
+                .when('/roles/settings', {templateUrl: 'roles/roles-settings.html', controller:
'RolesSettingsCtrl'})
+                .when('/roles/users', {templateUrl: 'roles/roles-users.html', controller:
'RolesUsersCtrl'})
+                .when('/roles/groups', {templateUrl: 'roles/roles-groups.html', controller:
'RolesGroupsCtrl'})
+                .when('/data', {templateUrl: 'data/data.html', controller: 'DataCtrl'})
+                .when('/data/entity', {templateUrl: 'data/entity.html', controller: 'EntityCtrl'})
+                .when('/data/shell', {templateUrl: 'data/shell.html', controller: 'ShellCtrl'})
+                .when('/profile/organizations', {templateUrl: 'profile/organizations.html',
controller: 'OrgCtrl'})
+                .when('/profile/profile', {templateUrl: 'profile/profile.html', controller:
'ProfileCtrl'})
+                .when('/profile', {templateUrl: 'profile/account.html', controller: 'AccountCtrl'})
+                .when('/activities', {templateUrl: 'activities/activities.html', controller:
'ActivitiesCtrl'})
+                .when('/shell', {templateUrl: 'shell/shell.html', controller: 'ShellCtrl'})
+                .when('/logout', {templateUrl: 'login/logout.html', controller: 'LogoutCtrl'})
+                .otherwise({redirectTo: '/org-overview'});
 
-    $locationProvider
-      .html5Mode(false)
-      .hashPrefix('!');
+            $locationProvider
+                .html5Mode(false)
+                .hashPrefix('!');
 
-    $sceDelegateProvider.resourceUrlWhitelist([
-      // Allow same origin resource loads.
-      'self',
-      // Allow loading from our assets domain.  Notice the difference between * and **.
-      'http://apigee-internal-prod.jupiter.apigee.net/**',
-      'http://apigee-internal-prod.mars.apigee.net/**',
-      'https://appservices.apigee.com/**',
-      'https://api.usergrid.com/**'
-    ]);
-
-      $analyticsProvider.virtualPageviews(false);
-  }]);
+            $sceDelegateProvider.resourceUrlWhitelist([
+                // Allow same origin resource loads.
+                'self',
+                // Allow loading from our assets domain.  Notice the difference between *
and **.
+                'http://apigee-internal-prod.jupiter.apigee.net/**',
+                'http://apigee-internal-prod.mars.apigee.net/**',
+                'https://appservices.apigee.com/**',
+                'https://api.usergrid.com/**'
+            ]);
+        }]);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/charts/chart-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/charts/chart-controller.js b/portal/js/charts/chart-controller.js
index a5122d1..66368d5 100644
--- a/portal/js/charts/chart-controller.js
+++ b/portal/js/charts/chart-controller.js
@@ -1,6 +1,6 @@
 'use strict'
 
-AppServices.Controllers.controller('ChartCtrl', ['data', '$scope', '$location', function
(data, $scope, $location) {
+AppServices.Controllers.controller('ChartCtrl', [ '$scope', '$location', function ( $scope,
$location) {
 
 
 }]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/data/data.html
----------------------------------------------------------------------
diff --git a/portal/js/data/data.html b/portal/js/data/data.html
index 2a0158c..6b7a42f 100644
--- a/portal/js/data/data.html
+++ b/portal/js/data/data.html
@@ -19,15 +19,8 @@
     </fieldset>
   </bsmodal>
 
-  <section class="row-fluid">
-
-    <div class="span12">
-      <div class="page-filters">
-        <h1 class="title" class="pull-left"><i class="pictogram title">&#128254;</i>
Collections</h1>
-      </div>
-    </div>
+  <page-title title=" Collections" icon="&#128254;"></page-title>
 
-  </section>
   <section class="row-fluid">
     <div class="span3 user-col">
         <a class="btn btn-primary" id="new-collection-link" ng-click="showModal('newCollection')">New
Collection</a>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/page-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/global/page-controller.js b/portal/js/global/page-controller.js
index e7cf78f..8e789d0 100644
--- a/portal/js/global/page-controller.js
+++ b/portal/js/global/page-controller.js
@@ -1,7 +1,7 @@
 'use strict'
 
 AppServices.Controllers.controller('PageCtrl',
-  [ 'data',
+  [
     'ug',
     'utility',
     '$scope',
@@ -10,8 +10,7 @@ AppServices.Controllers.controller('PageCtrl',
     '$routeParams',
     '$q',
     '$route',
-    '$log',
-    '$analytics', function (data,
+    '$log', function (
                      ug,
                      utility,
                      $scope,
@@ -38,6 +37,7 @@ AppServices.Controllers.controller('PageCtrl',
     $rootScope.sdkActive = false;
     $rootScope.demoData = false;
     $scope.queryStringApplied = false;
+    $rootScope.autoUpdateTimer = Usergrid.config ? Usergrid.config.autoUpdateTimer : 61;
     $rootScope.loaded = $rootScope.activeUI = false;
     for (var key in Usergrid.regex) {
       $scope[key] = Usergrid.regex[key];
@@ -134,10 +134,9 @@ AppServices.Controllers.controller('PageCtrl',
        $location.search('uuid', null);
      }
 
-     $scope.deferredLogin = $q.defer();
      //use a promise so we can update afterwards in other UI areas
      //next try to quick login
-     ug.checkAuthentication();
+     ug.checkAuthentication(true);
   };
 
 
@@ -264,6 +263,18 @@ AppServices.Controllers.controller('PageCtrl',
       return list &&  (list.some(function(item){return item.checked;}));
     };
 
+    $scope.sendHelp = function (modalId) {
+      ug.jsonpRaw('apigeeuihelpemail', '', {useremail: $rootScope.userEmail}).then(
+        function () {
+          $rootScope.$broadcast('alert', 'success', 'Email sent. Our team will be in touch
with you shortly.');
+        },
+        function () {
+          $rootScope.$broadcast('alert', 'error', 'Problem Sending Email. Try sending an
email to mobile@apigee.com.');
+        }
+      );
+      $scope.hideModal(modalId);
+    };
+
     $scope.$on('users-typeahead-received', function(event, users) {
       $scope.usersTypeaheadValues = users;
       if(!$scope.$$phase) {
@@ -284,6 +295,8 @@ AppServices.Controllers.controller('PageCtrl',
     });
 
     $scope.$on('checkAuthentication-success', function () {
+      sessionStorage.setItem('authenticateAttempts', 0);
+
       //all is well - repopulate objects
       $scope.loaded = true;
       $rootScope.activeUI = true;
@@ -300,10 +313,8 @@ AppServices.Controllers.controller('PageCtrl',
         }, 1000)
       }
 
-      $scope.deferredLogin && $scope.deferredLogin.resolve();
       $rootScope.$broadcast('app-initialized');
 
-      //boolean defines is top level ui menus/buttons should be active/shown
     });
 
     $scope.$on('checkAuthentication-error', function (args,err, missingData,email) {
@@ -325,6 +336,7 @@ AppServices.Controllers.controller('PageCtrl',
     });
 
     $scope.$on('reAuthenticate-success', function (args,err, data, user, organizations, applications)
{
+      sessionStorage.setItem('authenticateAttempts', 0);
 
       //the user is authenticated
       $rootScope.$broadcast('loginSuccesful', user, organizations, applications);
@@ -336,10 +348,17 @@ AppServices.Controllers.controller('PageCtrl',
       })
     });
 
+    var authenticateAttempts = parseInt( sessionStorage.getItem('authenticateAttempts') 
|| 0);
     $scope.$on('reAuthenticate-error', function () {
       //user is not authenticated, send to SSO if enabled
       if ($scope.use_sso) {
         //go to sso
+        if(authenticateAttempts++>5){
+          $rootScope.$broadcast('alert', 'error', 'There is an issue with authentication.
Please contact support.');
+          return;
+        }
+        console.error('Failed to login via sso '+authenticateAttempts);
+        sessionStorage.setItem('authenticateAttempts', authenticateAttempts);
         window.location = $rootScope.urls().LOGIN_URL + '?callback=' +  encodeURIComponent($location.absUrl().split('?')[0]);
       } else {
         //go to login page
@@ -369,6 +388,9 @@ AppServices.Controllers.controller('PageCtrl',
     $scope.$on('app-settings-received',function(evt,data){
     });
 
+    $scope.$on('request-times-slow', function (evt, averageRequestTimes) {
+      $rootScope.$broadcast('alert', 'info', 'We are experiencing performance issues on our
server.  Please click Get Help for support if this continues.');
+    });
 
     //verify on every route change
     $scope.$on('$routeChangeSuccess', function () {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/page-service.js
----------------------------------------------------------------------
diff --git a/portal/js/global/page-service.js b/portal/js/global/page-service.js
deleted file mode 100644
index d1d08de..0000000
--- a/portal/js/global/page-service.js
+++ /dev/null
@@ -1,214 +0,0 @@
-AppServices.Services.factory('data', function (configuration, $q, $http, $resource, $rootScope,
$log, $analytics) {
-
-  function reportError(data,config){
-    try {
-      $analytics.eventTrack('error', {
-        category: 'App Services', label: data + ':' + config.url + ':' + (sessionStorage['apigee_uuid']
|| 'na')
-      });
-    } catch (e) {
-      console.log(e)
-    }
-  };
-  var getAccessToken = function(){
-    return sessionStorage.getItem('accessToken');
-  };
-
-  return {
-
-    /**
-     * Retrieves page data
-     * @param {string} id the name of the single page item to get (a key in the JSON) can
be null.
-     * @param {string} url location of the file/endpoint.
-     * @return {Promise} Resolves to JSON.
-     */
-    get: function (id, url) {
-      var items, deferred;
-
-      deferred = $q.defer();
-
-      $http.get((url || configuration.ITEMS_URL)).
-          success(function (data, status, headers, config) {
-            var result;
-            if (id) {
-              angular.forEach(data, function (obj, index) {
-                if (obj.id === id) {
-                  result = obj;
-                }
-              });
-            } else {
-              result = data;
-            }
-            deferred.resolve(result);
-          }).
-          error(function (data, status, headers, config) {
-            $log.error(data, status, headers, config);
-            reportError(data,config);
-            deferred.reject(data);
-          });
-
-      return deferred.promise;
-    },
-
-//    getLocal: function (url) {
-//      var retdata;
-//      $http.get(url).
-//          success(function (data, status, headers, config) {
-//            retdata = data;
-//          }).
-//          error(function (data, status, headers, config) {
-//          $log.error(data, status, headers, config);
-//          });
-//
-//      return retdata;
-//    },
-
-    /**
-     * Retrieves page data via jsonp
-     * @param {string} url the location of the JSON/RESTful endpoint.
-     * @param {string} successCallback function called on success.
-     */
-//    jsonp: function (url,successCallback) {
-//      var self = this;
-//      $http.jsonp(url).
-//          success(function(data, status, headers, config) {
-//            successCallback(data,status,headers,config);
-//          }).
-//          error(function(data, status, headers, config) {
-//            console.log("ERROR: Could not get data. " + url);
-//          });
-//    },
-
-    jsonp: function (objectType,criteriaId,params,successCallback) {
-      if(!params){
-        params = {};
-      }
-
-      params.demoApp = $rootScope.demoData;
-      params.access_token = getAccessToken();
-      params.callback = 'JSON_CALLBACK';
-
-
-      $rootScope.$broadcast("ajax_loading", objectType);
-
-      $http.jsonp($rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/apm/' + objectType + '/' + criteriaId,{params:params,headers:{}}).
-        success(function(data, status, headers, config) {
-          successCallback(data,status,headers,config);
-
-          $rootScope.$broadcast("ajax_finished", objectType);
-
-
-        }).
-        error(function(data, status, headers, config) {
-          $log.error("ERROR: Could not get jsonp data. " + $rootScope.urls().DATA_URL + objectType
+ '/' + criteriaId);
-          reportError(data,config);
-        });
-    },
-
-    jsonp_simple: function (objectType,appId,params) {
-      if(!params){
-        params = {};
-      }
-
-      params.access_token = getAccessToken();
-      params.callback = 'JSON_CALLBACK';
-
-
-      var deferred = $q.defer();
-
-      $http.jsonp($rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/apm/' + objectType + "/" + appId,{params:params}).
-        success(function(data, status, headers, config) {
-          deferred.resolve(data);
-        }).
-        error(function(data, status, headers, config) {
-          $log.error("ERROR: Could not get jsonp data. " + $rootScope.urls().DATA_URL  +
'/' + $rootScope.currentOrg + '/' + $rootScope.currentApp + '/apm/' + objectType + "/" + appId);
-          reportError(data,config);
-          deferred.reject(data);
-        });
-
-      return deferred.promise;
-    },
-
-    jsonp_raw: function (objectType,appId,params) {
-      if(!params){
-        params = {};
-      }
-
-      params.access_token = getAccessToken();
-      params.callback = 'JSON_CALLBACK';
-
-
-      var deferred = $q.defer();
-
-      $http.jsonp($rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/' + objectType,{params:params}).
-        success(function(data, status, headers, config) {
-          deferred.resolve(data);
-        }).
-        error(function(data, status, headers, config) {
-          $log.error("ERROR: Could not get jsonp data. " + $rootScope.urls().DATA_URL + objectType
+ '/' + appId);
-          reportError(data,config);
-          deferred.reject(data);
-        });
-
-      return deferred.promise;
-    },
-
-    resource: function(params,isArray) {
-      //temporary url for REST endpoints
-
-      return $resource($rootScope.urls().DATA_URL + '/:orgname/:appname/:username/:endpoint',
-          {
-
-          },
-          {
-            get: {
-              method:'JSONP',
-              isArray: isArray,
-              params: params
-            },
-            login: {
-              method:'GET',
-              url: $rootScope.urls().DATA_URL + '/management/token',
-              isArray: false,
-              params: params
-            },
-            save: {
-              url: $rootScope.urls().DATA_URL + '/' + params.orgname + '/' + params.appname,
-              method:'PUT',
-              isArray: false,
-              params: params
-            }
-          });
-    },
-
-    post: function(url,callback,payload,headers){
-
-      var accessToken = getAccessToken();
-
-      if(payload){
-        payload.access_token = accessToken;
-      }else{
-        payload = {access_token:accessToken}
-      }
-
-      if(!headers){
-        headers = {Bearer:accessToken};
-      }
-
-      $http({method: 'POST', url: url, data: payload, headers: headers}).
-        success(function(data, status, headers, config) {
-          callback(data)
-        }).
-        error(function(data, status, headers, config) {
-          reportError(data,config);
-          callback(data)
-        });
-
-    }
-
-
-
-  }
-
-
-});
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/page-title.html
----------------------------------------------------------------------
diff --git a/portal/js/global/page-title.html b/portal/js/global/page-title.html
new file mode 100644
index 0000000..bc68348
--- /dev/null
+++ b/portal/js/global/page-title.html
@@ -0,0 +1,17 @@
+<section class="row-fluid">
+    <div class="span12">
+        <div class="page-filters">
+            <h1 class="title pull-left" id="pageTitle"><i class="pictogram title"
style="padding-right: 5px;">{{icon}}</i>{{title}} <a class="super-help" href="#"
ng-click="showHelp()"  >(need help?)</a></h1>
+        </div>
+    </div>
+    <bsmodal id="need-help"
+             title="Need Help?"
+             close="hideModal"
+             closelabel="Cancel"
+             extrabutton="sendHelp"
+             extrabuttonlabel="Get Help"
+             ng-cloak>
+        <p>Do you want to contact support? Support will get in touch with you as soon
as possible.</p>
+    </bsmodal>
+</section>
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/page-title.js
----------------------------------------------------------------------
diff --git a/portal/js/global/page-title.js b/portal/js/global/page-title.js
new file mode 100644
index 0000000..93148d7
--- /dev/null
+++ b/portal/js/global/page-title.js
@@ -0,0 +1,31 @@
+'use strict';
+
+AppServices.Directives.directive('pageTitle', ["$rootScope","data", function ($rootScope,data)
{
+  return{
+    restrict: 'ECA',
+    scope: {
+
+    },
+    transclude: true,
+    templateUrl: 'global/page-title.html',
+    replace: true,
+    link: function linkFn(scope, lElement, attrs, parentCtrl) {
+      scope.title = attrs.title;
+      scope.icon = attrs.icon;
+      scope.showHelp = function () {
+        $('#need-help').modal('show');
+      };
+      scope.sendHelp = function () {
+        data.jsonp_raw('apigeeuihelpemail', '', {useremail: $rootScope.userEmail}).then(
+          function () {
+            $rootScope.$broadcast('alert', 'success', 'Email sent. Our team will be in touch
with you shortly.');
+          },
+          function () {
+            $rootScope.$broadcast('alert', 'error', 'Problem Sending Email. Try sending an
email to mobile@apigee.com.');
+          }
+        );
+        $('#need-help').modal('hide');
+      };
+    }
+  }
+}]);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/ug-service.js
----------------------------------------------------------------------
diff --git a/portal/js/global/ug-service.js b/portal/js/global/ug-service.js
index ba9d762..6b620f2 100644
--- a/portal/js/global/ug-service.js
+++ b/portal/js/global/ug-service.js
@@ -1,6 +1,16 @@
 'use strict';
 
-AppServices.Services.factory('ug', function (configuration, $rootScope,utility) {
+AppServices.Services.factory('ug', function (configuration, $rootScope,utility, $q, $http,
$resource, $log) {
+
+  var requestTimes = [],
+    running = false,
+    currentRequests = {};
+  function reportError(data,config){
+
+  };
+  var getAccessToken = function(){
+    return sessionStorage.getItem('accessToken');
+  };
 
   return {
     get:function(prop,isObject){
@@ -263,10 +273,10 @@ AppServices.Services.factory('ug', function (configuration, $rootScope,utility)
       var self = this;
       this.usersCollection.addEntity(options, function(err, data){
         if (err) {
-          if (data) {
+          if (typeof data === 'string') {
             $rootScope.$broadcast("alert", "error", "error: " + data);
           } else {
-            $rootScope.$broadcast("alert", "error", "error creating user");
+            $rootScope.$broadcast("alert", "error", "error creating user. the email address
might already exist.");
           }
         } else {
           $rootScope.$broadcast('users-create-success', self.usersCollection);
@@ -672,17 +682,19 @@ AppServices.Services.factory('ug', function (configuration, $rootScope,utility)
       var provider = 'apple';
 
       var formData = new FormData();
-      formData.append("p12Certificate", file);
-
-      formData.append('name', name);
-      formData.append('provider', provider);
-      formData.append('environment', environment);
-      formData.append('certificatePassword', certificatePassword);
+        formData.append("p12Certificate", file);
 
+        formData.append('name', name);
+        formData.append('provider', provider);
+        formData.append('environment', environment);
+        formData.append('certificatePassword', certificatePassword || "");
+      //var body = {'p12Certificate':file, "name":name,'environment':environment,"provider":provider};
+      //if(certificatePassword){
+        //    body.certificatePassword = certificatePassword;
+      //}
       var options = {
         method:'POST',
         endpoint:'notifiers',
-        body:'{"apiKey":APIkey,"name":name,"provider":"google"}',
         formData:formData
       };
       this.client().request(options, function (err, data) {
@@ -982,6 +994,182 @@ AppServices.Services.factory('ug', function (configuration, $rootScope,utility)
           $rootScope.$broadcast('user-leave-org-success', $rootScope.organizations);
         }
       });
+    },
+    /**
+     * Retrieves page data
+     * @param {string} id the name of the single page item to get (a key in the JSON) can
be null.
+     * @param {string} url location of the file/endpoint.
+     * @return {Promise} Resolves to JSON.
+     */
+    httpGet: function (id, url) {
+      var items, deferred;
+
+      deferred = $q.defer();
+
+      $http.get((url || configuration.ITEMS_URL)).
+        success(function (data, status, headers, config) {
+          var result;
+          if (id) {
+            angular.forEach(data, function (obj, index) {
+              if (obj.id === id) {
+                result = obj;
+              }
+            });
+          } else {
+            result = data;
+          }
+          deferred.resolve(result);
+        }).
+        error(function (data, status, headers, config) {
+          $log.error(data, status, headers, config);
+          reportError(data,config);
+          deferred.reject(data);
+        });
+
+      return deferred.promise;
+    },
+
+    /**
+     * Retrieves page data via jsonp
+     * @param {string} url the location of the JSON/RESTful endpoint.
+     * @param {string} successCallback function called on success.
+     */
+
+    jsonp: function (objectType,criteriaId,params,successCallback) {
+      if(!params){
+        params = {};
+      }
+      params.demoApp = $rootScope.demoData;
+      params.access_token = getAccessToken();
+      params.callback = 'JSON_CALLBACK';
+      var uri = $rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/apm/' + objectType + '/' + criteriaId;
+      return this.jsonpRaw(objectType,criteriaId,params,uri,successCallback);
+    },
+
+    jsonpSimple: function (objectType,appId,params) {
+      var uri = $rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/apm/' + objectType + "/" + appId;
+      return this.jsonpRaw(objectType,appId,params,uri);
+    },
+    calculateAverageRequestTimes: function(){
+      if(!running){
+        var self = this;
+        running = true;
+        setTimeout(function(){
+          running=false;
+          var length = requestTimes.length < 10 ? requestTimes.length  : 10;
+          var sum = requestTimes.slice(0, length).reduce(function(a, b) { return a + b });
+          var avg = sum / length;
+          self.averageRequestTimes = avg/1000;
+          if(self.averageRequestTimes > 5){
+            $rootScope.$broadcast('request-times-slow',self.averageRequestTimes);
+          }
+        },3000);
+      }
+    },
+    jsonpRaw: function (objectType,appId,params,uri,successCallback) {
+      if(typeof successCallback !== 'function'){
+        successCallback = null;
+      }
+      uri = uri || ($rootScope.urls().DATA_URL  + '/' + $rootScope.currentOrg + '/' + $rootScope.currentApp
+ '/' + objectType);
+
+      if(!params){
+        params = {};
+      }
+
+      var start = new Date().getTime(),
+        self = this;
+
+      params.access_token = getAccessToken();
+      params.callback = 'JSON_CALLBACK';
+
+      var deferred = $q.defer();
+
+      var diff = function(){
+        currentRequests[uri]--;
+        requestTimes.splice(0,0 ,new Date().getTime() - start);
+        self.calculateAverageRequestTimes();
+      };
+
+      successCallback && $rootScope.$broadcast("ajax_loading", objectType);
+      var reqCount = currentRequests[uri] || 0; 
+      if(self.averageRequestTimes > 5 && reqCount>1){
+        setTimeout(function(){
+          deferred.reject(new Error('query in progress'));
+        },50);
+        return deferred;
+      }
+      currentRequests[uri] = (currentRequests[uri] || 0) + 1;
+
+      $http.jsonp(uri,{params:params}).
+        success(function(data, status, headers, config) {
+          diff();
+          if(successCallback){
+            successCallback(data, status, headers, config);
+            $rootScope.$broadcast("ajax_finished", objectType);
+          }
+          deferred.resolve(data);
+        }).
+        error(function(data, status, headers, config) {
+          diff();
+          $log.error("ERROR: Could not get jsonp data. " +uri);
+          reportError(data,config);
+          deferred.reject(data);
+        });
+
+      return deferred.promise;
+    },
+
+    resource: function(params,isArray) {
+      //temporary url for REST endpoints
+
+      return $resource($rootScope.urls().DATA_URL + '/:orgname/:appname/:username/:endpoint',
+        {
+
+        },
+        {
+          get: {
+            method:'JSONP',
+            isArray: isArray,
+            params: params
+          },
+          login: {
+            method:'GET',
+            url: $rootScope.urls().DATA_URL + '/management/token',
+            isArray: false,
+            params: params
+          },
+          save: {
+            url: $rootScope.urls().DATA_URL + '/' + params.orgname + '/' + params.appname,
+            method:'PUT',
+            isArray: false,
+            params: params
+          }
+        });
+    },
+
+    httpPost: function(url,callback,payload,headers){
+
+      var accessToken = getAccessToken();
+
+      if(payload){
+        payload.access_token = accessToken;
+      }else{
+        payload = {access_token:accessToken}
+      }
+
+      if(!headers){
+        headers = {Bearer:accessToken};
+      }
+
+      $http({method: 'POST', url: url, data: payload, headers: headers}).
+        success(function(data, status, headers, config) {
+          callback(data)
+        }).
+        error(function(data, status, headers, config) {
+          reportError(data,config);
+          callback(data)
+        });
+
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/global/utility-service.js
----------------------------------------------------------------------
diff --git a/portal/js/global/utility-service.js b/portal/js/global/utility-service.js
index 254f5d2..5cc2694 100755
--- a/portal/js/global/utility-service.js
+++ b/portal/js/global/utility-service.js
@@ -15,10 +15,10 @@ AppServices.Services.factory('utility', function (configuration, $q, $http,
$res
         if (email.length) {
           return 'https://secure.gravatar.com/avatar/' + MD5(email) + '?s=' + size ;
         } else {
-          return 'https://apigee.com/usergrid/images/user_profile.png';
+          return 'https://apigee.com/usergrid/img/user_profile.png';
         }
       } catch(e) {
-        return 'https://apigee.com/usergrid/images/user_profile.png';
+        return 'https://apigee.com/usergrid/img/user_profile.png';
       }
     },
     get_qs_params: function() {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/groups/groups-details-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/groups/groups-details-controller.js b/portal/js/groups/groups-details-controller.js
index e9164ac..6d8b81d 100644
--- a/portal/js/groups/groups-details-controller.js
+++ b/portal/js/groups/groups-details-controller.js
@@ -5,7 +5,7 @@ AppServices.Controllers.controller('GroupsDetailsCtrl', ['ug', '$scope', '$rootS
 
     var selectedGroup = $rootScope.selectedGroup.clone();
     $scope.detailsSelected = 'active';
-    $scope.json = selectedGroup._json;
+    $scope.json = selectedGroup._json || selectedGroup._data.stringifyJSON();
     $scope.group = selectedGroup._data;
     $scope.group.path =  $scope.group.path.indexOf('/')!=0 ? '/'+$scope.group.path : $scope.group.path;
     $scope.group.title = $scope.group.title;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a5a98884/portal/js/groups/groups.html
----------------------------------------------------------------------
diff --git a/portal/js/groups/groups.html b/portal/js/groups/groups.html
index 4f81b18..b0c28e2 100644
--- a/portal/js/groups/groups.html
+++ b/portal/js/groups/groups.html
@@ -1,17 +1,6 @@
 <div class="content-page">
 
-  <section class="row-fluid">
-
-    <div class="span12">
-      <div class="page-filters">
-        <h1 class="title" class="pull-left"><i class="pictogram title">&#128101;</i>
Groups</h1>
-      </div>
-    </div>
-
-  </section>
-
-
-
+  <page-title title=" Groups" icon="&#128101;"></page-title>
   <bsmodal id="newGroup"
            title="New Group"
            close="hideModal"


Mime
View raw message