now it looks fantastic. Nothing under!
This commit is contained in:
1 parent
a72347d1e3
commit
59813e906e
15 files changed
+130
-16
No files matched your search
@@ -65,14 +65,17 @@ testmongoJsToMongoJSON()
|
||||
root.controllers.controller('documentCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
|
||||
$scope.idx = $routeParams.idx
|
||||
$scope.doc = {}
|
||||
$scope.idx = Number($routeParams.idx)
|
||||
$scope.idx = Number($routeParams.idx) or 1
|
||||
$scope.meta = {}
|
||||
$scope.newQuery = $routeParams.query or ""
|
||||
|
||||
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
|
||||
if $routeParams.query
|
||||
url = "#{url}/query/#{$routeParams.query}"
|
||||
url = "#{ url }/idx/#{$routeParams.idx - 1}"
|
||||
if $routeParams.idx
|
||||
url = "#{ url }/idx/#{$routeParams.idx - 1}"
|
||||
else if $routeParams.id
|
||||
url = "#{ url }/_id/#{$routeParams.id}"
|
||||
|
||||
$http.get(url).then((res) ->
|
||||
$scope.doc = res.data.document
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
root = this;
|
||||
|
||||
|
||||
root.controllers.controller('fieldCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
|
||||
$scope.idx = $routeParams.idx
|
||||
$scope.field = $routeParams.field
|
||||
$scope.fields = []
|
||||
$scope._ = _
|
||||
$scope.value = ""
|
||||
$scope.doc = {}
|
||||
$scope.meta = {}
|
||||
|
||||
$scope.fieldUrl = (fieldName) ->
|
||||
rt = $routeParams
|
||||
return "#/#{ rt.server }/#{ rt.database }/#{ rt.collection }/_id/#{rt.id}/field/#{fieldName}"
|
||||
|
||||
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
|
||||
url = "#{ url }/_id/#{$routeParams.id}"
|
||||
|
||||
$http.get(url).then((res) ->
|
||||
$scope.doc = res.data.document
|
||||
$scope.value = $scope.doc[$scope.field]
|
||||
$scope.fields = _.keys($scope.doc)
|
||||
$scope.meta = res.data.meta
|
||||
)
|
||||
|
||||
])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
root = this;
|
||||
|
||||
|
||||
root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
|
||||
root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$location', '$http', ($scope, $routeParams, $location, $http) ->
|
||||
$scope.geojson = {}
|
||||
$scope.geojsonData = {}
|
||||
$scope.idx = Number($routeParams.idx)
|
||||
@@ -10,7 +10,7 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http'
|
||||
lng: -72.6169
|
||||
zoom: 7
|
||||
|
||||
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
|
||||
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
|
||||
if $routeParams.query
|
||||
url = "#{url}/query/#{$routeParams.query}"
|
||||
url = "#{ url }/idx/#{$routeParams.idx - 1}"
|
||||
@@ -18,10 +18,11 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http'
|
||||
$scope.geojson = res.data.document[$routeParams.key]
|
||||
if not $scope.geojson.properties
|
||||
$scope.geojson.properties = {}
|
||||
$scope.geojson.properties["_vulture_url_link"] = ""
|
||||
url = "/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/_id/#{ res.data.document._id }"
|
||||
$scope.geojson.properties["_vulture_url_link"] = url
|
||||
$scope.meta = res.data.meta
|
||||
$scope.geojsonData =
|
||||
data: $scope.geojson
|
||||
data: $scope.geojson
|
||||
style: undefined
|
||||
resetStyleOnMouseout: true
|
||||
)
|
||||
@@ -42,8 +43,7 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http'
|
||||
$scope.idx > 1
|
||||
|
||||
$scope.$on "leafletDirectiveMap.geojsonClick", (ev, featureSelected, leafletEvent) ->
|
||||
a = 90
|
||||
b = 89
|
||||
$location.url(featureSelected.properties._vulture_url_link);
|
||||
|
||||
])
|
||||
|
||||
@@ -11,7 +11,7 @@ root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $loca
|
||||
$scope.path = joinArray($scope.path[0...6], $scope.path[7...-1])
|
||||
$scope.getHistoryUrl = (idx) ->
|
||||
ret = "#/" + ($scope.path[i] for i in [0...idx]).join("/")
|
||||
if _.indexOf(["idx", "geojson", "query"], $scope.path[idx]) != -1
|
||||
if _.indexOf(["idx", "geojson", "query", "_id", "field"], $scope.path[idx]) != -1
|
||||
return ""
|
||||
if idx == 0
|
||||
ret += "servers"
|
||||
|
||||
@@ -23,8 +23,10 @@ directive = () ->
|
||||
restrict: 'E',
|
||||
scope:
|
||||
keyName: "="
|
||||
value: "="
|
||||
indexes: "="
|
||||
controller:["$scope", "$routeParams", ($scope, $routeParams) ->
|
||||
$scope.canMakeHistogram = _.isNumber($scope.value)
|
||||
$scope.hasIndexDesc = hasIndexDesc($scope.keyName, $scope.indexes)
|
||||
$scope.hasIndexAsc = hasIndexAsc($scope.keyName, $scope.indexes)
|
||||
$scope.has2DIndex = has2dIndex($scope.keyName, $scope.indexes)
|
||||
|
||||
@@ -7,7 +7,30 @@ directive = () ->
|
||||
restrict: 'E',
|
||||
scope:
|
||||
value: "="
|
||||
controller:["$scope", ($scope) ->
|
||||
docId: "="
|
||||
key: "="
|
||||
expended: "="
|
||||
controller:["$scope", "$routeParams", ($scope, $routeParams) ->
|
||||
$scope.isSmallString = (str)->
|
||||
if not _.isString(str)
|
||||
return false
|
||||
rgx = str.match(/\n/g) or []
|
||||
return str.length < 1000 and rgx.length < 20
|
||||
|
||||
$scope.isSmallObject = (obj) ->
|
||||
return $scope.isSmallString(JSON.stringify(obj, null, 4))
|
||||
|
||||
$scope.getSmallPrefix = (str) ->
|
||||
if _.isString(str)
|
||||
return str.substr(0, 500) + "..."
|
||||
return ""
|
||||
$scope.url = ()->
|
||||
rp = $routeParams
|
||||
s = $scope
|
||||
return "#/#{rp.server}/#{rp.database}/#{rp.collection}/_id/#{s.docId}/field/#{s.key}"
|
||||
|
||||
$scope.valueLength = if _.isObject($scope.value) then _.keys($scope.value).length else $scope.value.length
|
||||
|
||||
$scope.isString = _.isString($scope.value)
|
||||
$scope.isNumber = _.isNumber($scope.value)
|
||||
$scope.isObject = _.isObject($scope.value)
|
||||
|
||||
@@ -14,4 +14,11 @@ root.filters.filter 'niceJSON', () ->
|
||||
|
||||
root.filters.filter 'replaceReturnByBreak', () ->
|
||||
return (text) ->
|
||||
return text.replace(new RegExp("\n","g"), "<br>")
|
||||
return text.replace(new RegExp("\n","g"), "<br>")
|
||||
|
||||
root.filters.filter 'onlyNthLines', () ->
|
||||
return (text, n) ->
|
||||
if not _.isString(text)
|
||||
return ""
|
||||
s = text.split("\n")
|
||||
return s[0...n].join("\n")
|
||||
@@ -14,6 +14,8 @@ config(['$routeProvider', ($routeProvider) ->
|
||||
$routeProvider.when('/about', {templateUrl: 'partials/about.html', controller: 'aboutCtrl'})
|
||||
$routeProvider.when('/:server/databases', {templateUrl: 'partials/databases.html', controller: 'databasesCtrl'})
|
||||
$routeProvider.when('/:server/:database/collections', {templateUrl: 'partials/collections.html', controller: 'collectionsCtrl'})
|
||||
$routeProvider.when('/:server/:database/:collection/_id/:id', {templateUrl: 'partials/document.html', controller: 'documentCtrl'})
|
||||
$routeProvider.when('/:server/:database/:collection/_id/:id/field/:field', {templateUrl: 'partials/field.html', controller: 'fieldCtrl'})
|
||||
$routeProvider.when('/:server/:database/:collection/idx/:idx', {templateUrl: 'partials/document.html', controller: 'documentCtrl'})
|
||||
$routeProvider.when('/:server/:database/:collection/idx/:idx/query/:query', {templateUrl: 'partials/document.html', controller: 'documentCtrl'})
|
||||
$routeProvider.when('/:server/:database/:collection/idx/:idx/geojson/:key', {templateUrl: 'partials/geojsonmap.html', controller: 'geojsonmapCtrl'})
|
||||
|
||||
Reference in new issue
Block a user