ControlProxy/backend/yjs/repodetail.yjs
2022-06-25 11:11:03 +08:00

98 lines
3.2 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module RepoDetail{
//宏伟
//如果有指定repo那就是指定repo的DOlist。
//如果没指定repo那就是全部的。
//这是search engine的接口为什么还没接上
//TODO TODO
export function getDoList(arg){
print("GetDOList===========");
var ret = executeContract("SearchEngine","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};
}
//
export function getRepoTopology(arg){
arg = convertArgToJson(arg);
if (arg.doId == null)
return {
"msg":"missing arguments doId", "code":1};
var nodeList = [];
nodeList.push({
"name":"小店区仓库","doId":"bdware.ss.ab/Repo1","previousNode":["bdware.ss/Gateway1","bdware.ss/Gateway2"]}
);
nodeList.push({
"name":"太原内部共享网关","doId":"bdware.ss/Gateway1","previousNode":["bdware/Gateway1", "bdware/Gateway2"]}
);
nodeList.push({
"name":"太原对外开放网关","doId":"bdware.ss/Gateway2", "previousNode":["bdware/Gateway1"]}
);
nodeList.push({
"name":"山西内部共享网关","doId":"bdware/Gateway1"}
);
nodeList.push({
"name":"山西内部共享网关2","doId":"bdware/Gateway2"}
);
return nodeList;
}
//指标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;
}
}