ControlProxy/backend/yjs/repodetail.yjs

88 lines
2.8 KiB
Plaintext
Raw Normal View History

module RepoDetail {
//宏伟
//如果有指定repo那就是指定repo的DOlist。
//如果没指定repo那就是全部的。
//这是search engine的接口为什么还没接上
//TODO TODO
export function getDoList(arg) {
print("GetDOList===========");
2022-06-30 16:46:10 +00:00
var ret = executeContract("Registry","getDoList", arg);
return ret.result;
2022-04-19 01:26:59 +00:00
}
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":
2022-04-19 01:26:59 +00:00
return fakeList(from, to, interval);
}
return {
"msg":"unreconized tag", "code":1
};
2022-04-19 01:26:59 +00:00
}
function fakeList(from, to, interval) {
var ret = [];
for (i = from;
i<to;
i++){
ret.push(Math.floor(Math.random()*200+20));
}
return ret;
2022-04-19 01:26:59 +00:00
}
}