Repository: usergrid Updated Branches: refs/heads/two-dot-o-dev a11aaa03d -> 912c78ea1
Change create collection with entity to use POST /org/app/collection endpoint. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/ee013e34 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/ee013e34 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/ee013e34 Branch: refs/heads/two-dot-o-dev Commit: ee013e344b25b618335cb3d134093905f268e812 Parents: 7318607 Author: Michael Russo <[email protected]> Authored: Tue Aug 25 14:41:58 2015 -0700 Committer: Michael Russo <[email protected]> Committed: Tue Aug 25 14:41:58 2015 -0700 ---------------------------------------------------------------------- portal/js/data/data-controller.js | 1 - portal/js/global/ug-service.js | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/ee013e34/portal/js/data/data-controller.js ---------------------------------------------------------------------- diff --git a/portal/js/data/data-controller.js b/portal/js/data/data-controller.js index 0221b71..55c74bb 100644 --- a/portal/js/data/data-controller.js +++ b/portal/js/data/data-controller.js @@ -162,7 +162,6 @@ AppServices.Controllers.controller('DataCtrl', ['ug', '$scope', '$rootScope', '$ }else{ ug.createCollectionWithEntity($scope.newCollection.name, $scope.newCollection.entity); ug.getTopCollections(); - $rootScope.$broadcast('alert', 'success', 'Collection created successfully.'); $scope.hideModal(modalId) } }; http://git-wip-us.apache.org/repos/asf/usergrid/blob/ee013e34/portal/js/global/ug-service.js ---------------------------------------------------------------------- diff --git a/portal/js/global/ug-service.js b/portal/js/global/ug-service.js index 46e0dc7..233015b 100644 --- a/portal/js/global/ug-service.js +++ b/portal/js/global/ug-service.js @@ -259,26 +259,31 @@ AppServices.Services.factory('ug', function(configuration, $rootScope, utility, }, createCollectionWithEntity: function(collectionName, entityData) { try{ - entityData=JSON.parse(entityData) - entityData.type=collectionName; + entityData=JSON.parse(entityData); }catch(e){ $rootScope.$broadcast('alert', 'error', 'JSON is not valid'); return; } + var options = { + method: 'POST', + endpoint: collectionName, + body: entityData + } var self = this; - self.client().createEntity(entityData, function(err, entity) { + self.client().request(options, function(err, entity) { if (err) { console.error(err); return $rootScope.$broadcast('alert', 'error', - 'error creating collection'); + 'error creating collection'); } self.getTopCollections(function(err, collections) { if (err) { $rootScope.$broadcast('alert', 'error', - 'error creating collection'); + 'error creating collection'); } else { + $rootScope.$broadcast('alert', 'success', 'Collection created successfully.'); $rootScope.$broadcast('collection-created', - collections); + collections); } }); });
