forked from iod/ControlProxy
88 lines
2.8 KiB
Plaintext
Executable File
88 lines
2.8 KiB
Plaintext
Executable File
module RepoDetail {
|
||
//宏伟
|
||
//如果有指定repo,那就是指定repo的DOlist。
|
||
//如果没指定repo,那就是全部的。
|
||
//这是search engine的接口,为什么还没接上??
|
||
//TODO TODO
|
||
export function getDoList(arg) {
|
||
print("GetDOList===========");
|
||
var ret = executeContract("Registry","getDoList", arg);
|
||
return ret.result;
|
||
}
|
||
export function getDoList2(arg) {
|
||
arg = convertArgToJson(arg);
|
||
//if (arg.doId == null)
|
||
// return {
|
||
// "msg":"missing arguments doId", "code":1, params: arg
|
||
// };
|
||
//if (arg.count>1000)
|
||
// return {
|
||
// "msg":"request to much!", "code":1
|
||
// };
|
||
var ret = [];
|
||
if (arg.count==undefined) arg.count = 10;
|
||
if (arg.offset==undefined) arg.offset = 0;
|
||
for (var i = arg.offset;
|
||
i<arg.offset/1.0+arg.count/1.0;
|
||
i++){
|
||
var fakeDo = {
|
||
};
|
||
fakeDo.doId = "bdware.ss/Repo1/abc"+i;
|
||
fakeDo.originalData = {
|
||
doid:fakeDo.doId, info:"ddddd", tag: ["aaa", "bbb", "ccc"]
|
||
}
|
||
fakeDo.enableIndex = true
|
||
ret.push(fakeDo);
|
||
}
|
||
return {
|
||
data: ret, total: 100
|
||
};
|
||
}
|
||
//TODO check arguments
|
||
export function getRepoTopology(arg) {
|
||
return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopologyByDoId(arg, 2);
|
||
}
|
||
//指标1 获取某个repo的DO数量。
|
||
//使用search.yjs里的getDoCount
|
||
//指标2 获取某个repo的操作次数。使用search.yjs中的
|
||
//countRecordByDate
|
||
//参数格式为:
|
||
//{"repoId":"xxx.xxx/xxx","startTime":1641454745128, "endTime":1641454746128,"interval":5000, "eventPrefix":["abc"]}"
|
||
//比如,查询总搜索次数,参数格式为:eventPrefix:["doip_search"]
|
||
//查询调用统计,参数格式为eventPrefix:[""],然后interval/startTime/fromTime传对了就行。
|
||
//索引统计,暂时还没有。
|
||
export function getStaticIndex(arg) {
|
||
arg = convertArgToJson(arg);
|
||
if (arg.from==undefined)
|
||
return {
|
||
"msg":"missing arguments: from", "code":1
|
||
};
|
||
if (arg.to==undefined)
|
||
return {
|
||
"msg":"missing arguments: to", "code":1
|
||
};
|
||
if (arg.interval==undefined)
|
||
return {
|
||
"msg":"missing arguments: interval", "code":1
|
||
};
|
||
switch(arg.tag){
|
||
case "search":
|
||
case "index":
|
||
case "call":
|
||
return fakeList(from, to, interval);
|
||
}
|
||
return {
|
||
"msg":"unreconized tag", "code":1
|
||
};
|
||
}
|
||
function fakeList(from, to, interval) {
|
||
var ret = [];
|
||
for (i = from;
|
||
i<to;
|
||
i++){
|
||
ret.push(Math.floor(Math.random()*200+20));
|
||
}
|
||
return ret;
|
||
}
|
||
}
|