diff --git a/client/bower.json b/client/bower.json index f656683..4ccb628 100644 --- a/client/bower.json +++ b/client/bower.json @@ -20,6 +20,8 @@ "angular-leaflet-directive": "~0.7.7", "leaflet": "~0.7.2", "codemirror": "~3.19.0", - "angular-ui-codemirror": "~0.1.1" + "angular-ui-codemirror": "~0.1.1", + "spin.js": "~2.0.1", + "angular-spinner": "~0.4.0" } } diff --git a/client/coffee/controllers/collectionsCtrl.coffee b/client/coffee/controllers/collectionsCtrl.coffee index 47446be..b23342f 100644 --- a/client/coffee/controllers/collectionsCtrl.coffee +++ b/client/coffee/controllers/collectionsCtrl.coffee @@ -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 ) diff --git a/client/coffee/controllers/databasesCtrl.coffee b/client/coffee/controllers/databasesCtrl.coffee index 4d17a9e..cb58493 100644 --- a/client/coffee/controllers/databasesCtrl.coffee +++ b/client/coffee/controllers/databasesCtrl.coffee @@ -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 ) diff --git a/client/coffee/controllers/documentCtrl.coffee b/client/coffee/controllers/documentCtrl.coffee index e440996..581c5ac 100644 --- a/client/coffee/controllers/documentCtrl.coffee +++ b/client/coffee/controllers/documentCtrl.coffee @@ -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) -> diff --git a/client/coffee/controllers/fieldCtrl.coffee b/client/coffee/controllers/fieldCtrl.coffee index 3de3058..76bd1e5 100644 --- a/client/coffee/controllers/fieldCtrl.coffee +++ b/client/coffee/controllers/fieldCtrl.coffee @@ -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) diff --git a/client/coffee/controllers/geojsonmapCtrl.coffee b/client/coffee/controllers/geojsonmapCtrl.coffee index 9bbf1d3..83db7f6 100644 --- a/client/coffee/controllers/geojsonmapCtrl.coffee +++ b/client/coffee/controllers/geojsonmapCtrl.coffee @@ -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) diff --git a/client/coffee/controllers/keyStatCtrl.coffee b/client/coffee/controllers/keyStatCtrl.coffee index f455c7b..acc60e3 100644 --- a/client/coffee/controllers/keyStatCtrl.coffee +++ b/client/coffee/controllers/keyStatCtrl.coffee @@ -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 }) ) diff --git a/client/coffee/controllers/serversCtrl.coffee b/client/coffee/controllers/serversCtrl.coffee index 34f0a7f..81a80b8 100644 --- a/client/coffee/controllers/serversCtrl.coffee +++ b/client/coffee/controllers/serversCtrl.coffee @@ -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 ) diff --git a/client/coffee/controllers/topBarCtrl.coffee b/client/coffee/controllers/topBarCtrl.coffee index 65ba991..0c9c94d 100644 --- a/client/coffee/controllers/topBarCtrl.coffee +++ b/client/coffee/controllers/topBarCtrl.coffee @@ -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 ]) \ No newline at end of file diff --git a/client/coffee/services.coffee b/client/coffee/services.coffee new file mode 100644 index 0000000..2bddd3c --- /dev/null +++ b/client/coffee/services.coffee @@ -0,0 +1,14 @@ +root = this + +root.services.factory('util', ['$http', '$rootScope', ($http, $rootScope)-> + service = + get: (params...) -> + $rootScope.$broadcast("loading") + return $http.get(params...). + finally( () -> + $rootScope.$broadcast("loadingFinished") + ) + + return service + +]); \ No newline at end of file diff --git a/client/coffee/vultureApp.coffee b/client/coffee/vultureApp.coffee index e8542f0..9b5b9c7 100644 --- a/client/coffee/vultureApp.coffee +++ b/client/coffee/vultureApp.coffee @@ -4,6 +4,7 @@ root = this; angular.module('vulture', [ 'ngRoute' 'ui.codemirror' + 'angularSpinner' 'leaflet-directive' 'vulture.filters' 'vulture.services' diff --git a/client/index.html b/client/index.html index 6ca2e58..046eb7e 100644 --- a/client/index.html +++ b/client/index.html @@ -21,19 +21,25 @@ -
-
-

- Vulture

+
+
+
+

+ Vulture + + + +

+
-
-
-
- +
+
+ +
@@ -47,12 +53,15 @@ + + + diff --git a/params.yml b/params.yml index 938d8ee..c64fa44 100644 --- a/params.yml +++ b/params.yml @@ -10,7 +10,7 @@ Port: 8000 # The address where the service will run. If you wish to run it on your computer, you # should use `localhost`. If you wish to share the service on your local network, you # should use `0.0.0.0` -ServingAddress: localhost +ServingAddress: 0.0.0.0 # The list of mongo servers. Each server is an object with a field *name* that will # be shown in the web user interface and a *url* field that points to the mongo server