-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
103 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set PYTHONPATH=.;%CD% | ||
|
||
python .\mongodb\dbtool.py -l cloudsoar namespaces.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,5 +80,4 @@ def usage(): | |
|
||
|
||
if __name__ == "__main__": | ||
#main() | ||
LoadJS('cloudsoar', 'repositories.js') | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespaces = function (query, size, skip) { | ||
var data = []; | ||
var cor = db.Namespace.find(query).limit(size).skip(skip); | ||
cor.forEach(function(nspc){ | ||
nspc['repo_num'] = db.Repository.count({'namespace':nspc._id}); | ||
data.push(nspc); | ||
}); | ||
|
||
return {"result":0, "content":data}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
repositories = function (query, size, skip) { | ||
|
||
var extent = function(srcObj, tarObj){ | ||
for(var p in srcObj){ | ||
if(typeof(srcObj[p])=="function"){ | ||
continue; | ||
} | ||
else{ | ||
tarObj[p] = srcObj[p]; | ||
} | ||
} | ||
return tarObj; | ||
} | ||
|
||
var GetTags = function(repo_id){ | ||
|
||
arr = [] | ||
var corsur = db.Tags.find({'repository':repo_id}) | ||
corsur.forEach(function(tag){ | ||
image = db.Image.findOne({"_id":tag.digest}); | ||
if (image) | ||
{ | ||
tag['size'] = image['size']; | ||
tag['user_id'] = image['user_id']; | ||
tag['pull_num'] = image['pull_num']; | ||
} | ||
arr.push(tag); | ||
}); | ||
return arr; | ||
} | ||
|
||
var data = []; | ||
var cor = db.Repository.find(query).limit(size).skip(skip); | ||
cor.forEach(function(repo){ | ||
repo['tags'] = GetTags(repo._id); | ||
data.push(repo); | ||
}); | ||
|
||
return {"result":0, "content":data}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
@echo off | ||
|
||
|
||
set PYTHONPATH=".:%CD%" | ||
set PYTHONPATH=".;%CD%" | ||
|
||
start /b python ServerMain.py | ||
|