added loader!

This commit is contained in:
didier.amyot committed 2014-05-21 13:03:22 -04:00
1 parent 37209f6779
commit cd28c44c00
13 files changed
+64 -29

No files matched your search

@@ -1,11 +1,12 @@
root = this;
root.controllers.controller('collectionsCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
root.controllers.controller('collectionsCtrl', ['$scope', '$routeParams', '$rootScope', 'util', ($scope, $routeParams, $rootScope, util) ->
$scope.server = $routeParams.server
$scope.database = $routeParams.database
$scope.collections = []
$http.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/collections").then((res) ->
$rootScope.$broadcast("loading")
util.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/collections").then((res) ->
$scope.collections = res.data
)
@@ -1,10 +1,10 @@
root = this;
root.controllers.controller('databasesCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
root.controllers.controller('databasesCtrl', ['$scope', '$routeParams', 'util', ($scope, $routeParams, util) ->
$scope.server = $routeParams.server
$scope.databases = []
$http.get("/api/#{ $routeParams.server }/databases").then((res) ->
util.get("/api/#{ $routeParams.server }/databases").then((res) ->
$scope.databases = res.data
)
@@ -62,7 +62,7 @@ testmongoJsToMongoJSON = () ->
testmongoJsToMongoJSON()
root.controllers.controller('documentCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
root.controllers.controller('documentCtrl', ['$scope', '$routeParams', 'util', ($scope, $routeParams, util) ->
$scope.idx = $routeParams.idx
$scope.doc = {}
$scope.idx = Number($routeParams.idx) or 1
@@ -83,7 +83,7 @@ root.controllers.controller('documentCtrl', ['$scope', '$routeParams', '$http',
else if $routeParams.id
url = "#{ url }/_id/#{$routeParams.id}"
$http.get(url).then((res) ->
util.get(url).then((res) ->
$scope.doc = res.data.document
$scope.meta = res.data.meta
).catch( (res) ->
+2 -2
View File
@@ -1,7 +1,7 @@
root = this;
root.controllers.controller('fieldCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
root.controllers.controller('fieldCtrl', ['$scope', '$routeParams', 'util', ($scope, $routeParams, util) ->
$scope.idx = $routeParams.idx
$scope.field = $routeParams.field
$scope.fields = []
@@ -17,7 +17,7 @@ root.controllers.controller('fieldCtrl', ['$scope', '$routeParams', '$http', ($s
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
url = "#{ url }/_id/#{$routeParams.id}"
$http.get(url).then((res) ->
util.get(url).then((res) ->
$scope.doc = res.data.document
$scope.value = $scope.doc[$scope.field]
$scope.fields = _.keys($scope.doc)
@@ -42,7 +42,7 @@ transformListOfGeoJsonToGeometryCollection = (resData, routeParams) ->
return ret
root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$location', '$http', ($scope, $routeParams, $location, $http) ->
root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$location', 'util', ($scope, $routeParams, $location, util) ->
$scope.geojson = {}
$scope.geojsonData = {}
$scope.idx = Number($routeParams.idx)
@@ -75,7 +75,7 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$locat
$scope.initSingleDocument = ()->
url = getSingleDataUrl($routeParams)
$http.get(url).then (res) ->
util.get(url).then (res) ->
geojson = res.data.document[$routeParams.key]
if not geojson.properties
geojson.properties = {}
@@ -88,7 +88,7 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$locat
$scope.initAllDocuments = () ->
url = getAllDataUrl($routeParams)
$http.get(url).then (res) ->
util.get(url).then (res) ->
$scope.meta = res.data.meta
$scope.geojsonData =
data: transformListOfGeoJsonToGeometryCollection(res.data, $routeParams)
+2 -2
View File
@@ -6,14 +6,14 @@ humanValueOfStatisticalAbreviation =
var: "variance"
root.controllers.controller('keyStatCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
root.controllers.controller('keyStatCtrl', ['$scope', '$routeParams', 'util', ($scope, $routeParams, util) ->
$scope.name = "didier!"
$scope.stats = []
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
url = "#{ url }/stats/#{$routeParams.key}"
$http.get(url).then((res) ->
util.get(url).then((res) ->
for key, val of res.data
$scope.stats.push({name: humanValueOfStatisticalAbreviation[key], value: val })
)
+2 -2
View File
@@ -1,9 +1,9 @@
root = this;
root.controllers.controller('serversCtrl', ['$scope', '$http', ($scope, $http) ->
root.controllers.controller('serversCtrl', ['$scope', 'util', ($scope, util) ->
$scope.servers = []
$http.get("/api/servers").then((res) ->
util.get("/api/servers").then((res) ->
$scope.servers = res.data
)
@@ -5,6 +5,9 @@ joinArray = (a, b)->
return a
root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $location) ->
$scope.loading = false
$scope.$on('$routeChangeSuccess', (next, current) ->
$scope.path = _.filter($location.path().split("/"), (s) -> s)
if $scope.path[5] == "query"
@@ -23,4 +26,9 @@ root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $loca
ret += "/#{ $scope.path[4] }"
return ret
)
$scope.$on "loading", ()->
$scope.loading = true
$scope.$on "loadingFinished", ()->
$scope.loading = false
])