Browse Source

Merge branch 'V20220815' into issue-zpz-0815

tags/v1.22.8.1^2
zhoupzh 3 years ago
parent
commit
0c5ad16161
6 changed files with 102 additions and 43 deletions
  1. +16
    -17
      routers/search.go
  2. +1
    -1
      templates/repo/cloudbrain/show.tmpl
  3. +28
    -8
      templates/repo/cloudbrain/trainjob/show.tmpl
  4. +28
    -8
      templates/repo/grampus/trainjob/show.tmpl
  5. +28
    -8
      templates/repo/modelarts/trainjob/show.tmpl
  6. +1
    -1
      templates/repo/modelmanage/showinfo.tmpl

+ 16
- 17
routers/search.go View File

@@ -349,25 +349,24 @@ func searchRepo(ctx *context.Context, TableName string, Key string, Page int, Pa


func setForkRepoOrder(esresult *SearchRes, SortBy string) { func setForkRepoOrder(esresult *SearchRes, SortBy string) {
if SortBy == "default" || SortBy == "" { if SortBy == "default" || SortBy == "" {
return
}
forkidMap := make(map[string]int, 0)
for index, re := range esresult.Result {
if re["fork_id"] != nil {
fork_id := re["fork_id"].(string)
if _, ok := forkidMap[fork_id]; !ok {
forkidMap[fork_id] = index
forkidMap := make(map[string]int, 0)
for index, re := range esresult.Result {
if re["fork_id"] != nil {
fork_id := re["fork_id"].(string)
if _, ok := forkidMap[fork_id]; !ok {
forkidMap[fork_id] = index
}
} }
} }
}
for key, value := range forkidMap {
for index, re := range esresult.Result {
if re["id"].(string) == key {
if value < index { //swap
tmp := esresult.Result[index]
esresult.Result[index] = esresult.Result[value]
esresult.Result[value] = tmp
break
for key, value := range forkidMap {
for index, re := range esresult.Result {
if re["id"].(string) == key {
if value < index { //swap
tmp := esresult.Result[index]
esresult.Result[index] = esresult.Result[value]
esresult.Result[value] = tmp
break
}
} }
} }
} }


+ 1
- 1
templates/repo/cloudbrain/show.tmpl View File

@@ -413,7 +413,7 @@
<div class="text-span text-span-w" <div class="text-span text-span-w"
id="{{.VersionName}}-BenchmarkTypeName"> id="{{.VersionName}}-BenchmarkTypeName">
{{range $m ,$n := $.datasetDownload}} {{range $m ,$n := $.datasetDownload}}
<a href="{{.RepositoryLink}}">{{.DatasetName}}</a>
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a>
{{end}} {{end}}
</div> </div>
</td> </td>


+ 28
- 8
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -702,7 +702,7 @@
hideMenu(); hideMenu();
} }
} }
let dirKey="isOnlyDir--:&";
function loadSelectedModelFile(trainJob){ function loadSelectedModelFile(trainJob){
console.log("trainJob=" + trainJob); console.log("trainJob=" + trainJob);
$('#choice_file').dropdown('clear') $('#choice_file').dropdown('clear')
@@ -717,7 +717,7 @@
var zNodes=[]; var zNodes=[];
var nodesMap={}; var nodesMap={};
for (let i=0;i<n_length;i++){ for (let i=0;i<n_length;i++){
parentNodeMap = nodesMap;
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/"); var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){ for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){ if(fileSplits[j] == ""){
@@ -726,7 +726,22 @@
if(parentNodeMap[fileSplits[j]] == null){ if(parentNodeMap[fileSplits[j]] == null){
parentNodeMap[fileSplits[j]] = {}; parentNodeMap[fileSplits[j]] = {};
} }
parentNodeMap = parentNodeMap[fileSplits[j]]
parentNodeMap = parentNodeMap[fileSplits[j]];
}
}
for (let i=0;i<n_length;i++){
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){
if(data[i].FileName[data[i].FileName.length -1] =="/"){
if(Object.keys(parentNodeMap).length ==0){
parentNodeMap[dirKey]="true";
}
}
break;
}
parentNodeMap = parentNodeMap[fileSplits[j]];
} }
} }
convertToNode(zNodes,nodesMap); convertToNode(zNodes,nodesMap);
@@ -746,12 +761,17 @@
node["name"] = keyList[i]; node["name"] = keyList[i];
nodeList.push(node); nodeList.push(node);
if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){ if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
if(nodesMap[keyList[i]][dirKey] != null){
node["open"] = false;
node["isParent"] = true;
}else{
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
}
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
} }
} }


+ 28
- 8
templates/repo/grampus/trainjob/show.tmpl View File

@@ -691,7 +691,7 @@
hideMenu(); hideMenu();
} }
} }
let dirKey="isOnlyDir--:&";
function loadSelectedModelFile(trainJob){ function loadSelectedModelFile(trainJob){
console.log("trainJob=" + trainJob); console.log("trainJob=" + trainJob);
$('#choice_file').dropdown('clear') $('#choice_file').dropdown('clear')
@@ -714,7 +714,7 @@
var zNodes=[]; var zNodes=[];
var nodesMap={}; var nodesMap={};
for (let i=0;i<n_length;i++){ for (let i=0;i<n_length;i++){
parentNodeMap = nodesMap;
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/"); var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){ for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){ if(fileSplits[j] == ""){
@@ -723,7 +723,22 @@
if(parentNodeMap[fileSplits[j]] == null){ if(parentNodeMap[fileSplits[j]] == null){
parentNodeMap[fileSplits[j]] = {}; parentNodeMap[fileSplits[j]] = {};
} }
parentNodeMap = parentNodeMap[fileSplits[j]]
parentNodeMap = parentNodeMap[fileSplits[j]];
}
}
for (let i=0;i<n_length;i++){
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){
if(data[i].FileName[data[i].FileName.length -1] =="/"){
if(Object.keys(parentNodeMap).length ==0){
parentNodeMap[dirKey]="true";
}
}
break;
}
parentNodeMap = parentNodeMap[fileSplits[j]];
} }
} }
convertToNode(zNodes,nodesMap); convertToNode(zNodes,nodesMap);
@@ -743,12 +758,17 @@
node["name"] = keyList[i]; node["name"] = keyList[i];
nodeList.push(node); nodeList.push(node);
if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){ if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
if(nodesMap[keyList[i]][dirKey] != null){
node["open"] = false;
node["isParent"] = true;
}else{
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
}
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
} }
} }


+ 28
- 8
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -729,7 +729,7 @@
hideMenu(); hideMenu();
} }
} }
let dirKey="isOnlyDir--:&";
function loadSelectedModelFile(trainJob){ function loadSelectedModelFile(trainJob){
console.log("trainJob=" + trainJob); console.log("trainJob=" + trainJob);
$('#choice_file').dropdown('clear') $('#choice_file').dropdown('clear')
@@ -744,7 +744,7 @@
var zNodes=[]; var zNodes=[];
var nodesMap={}; var nodesMap={};
for (let i=0;i<n_length;i++){ for (let i=0;i<n_length;i++){
parentNodeMap = nodesMap;
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/"); var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){ for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){ if(fileSplits[j] == ""){
@@ -753,7 +753,22 @@
if(parentNodeMap[fileSplits[j]] == null){ if(parentNodeMap[fileSplits[j]] == null){
parentNodeMap[fileSplits[j]] = {}; parentNodeMap[fileSplits[j]] = {};
} }
parentNodeMap = parentNodeMap[fileSplits[j]]
parentNodeMap = parentNodeMap[fileSplits[j]];
}
}
for (let i=0;i<n_length;i++){
var parentNodeMap = nodesMap;
var fileSplits = data[i].FileName.split("/");
for(let j=0;j < fileSplits.length;j++){
if(fileSplits[j] == ""){
if(data[i].FileName[data[i].FileName.length -1] =="/"){
if(Object.keys(parentNodeMap).length ==0){
parentNodeMap[dirKey]="true";
}
}
break;
}
parentNodeMap = parentNodeMap[fileSplits[j]];
} }
} }
convertToNode(zNodes,nodesMap); convertToNode(zNodes,nodesMap);
@@ -773,12 +788,17 @@
node["name"] = keyList[i]; node["name"] = keyList[i];
nodeList.push(node); nodeList.push(node);
if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){ if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
if(nodesMap[keyList[i]][dirKey] != null){
node["open"] = false;
node["isParent"] = true;
}else{
node["children"]=[];
if(isFirst){
node["open"] = true;
isFirst= false;
}
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
convertToNode(node["children"],nodesMap[keyList[i]]);
} }
} }
} }


+ 1
- 1
templates/repo/modelmanage/showinfo.tmpl View File

@@ -127,7 +127,7 @@
<tr> <tr>
<td class="ti-text-form-label text-width80">训练任务</td> <td class="ti-text-form-label text-width80">训练任务</td>
<td class="ti-text-form-content word-elipsis"> <td class="ti-text-form-content word-elipsis">
<a id="DisplayJobNameHref" class="title" style="font-size: 14px;">
<a id="DisplayJobNameHref" class="title" style="font-size: 14px;" target="_blank">
<span id="DisplayJobName" class="fitted" style="width: 90%;vertical-align: middle;"></span> <span id="DisplayJobName" class="fitted" style="width: 90%;vertical-align: middle;"></span>
</a> </a>
</td> </td>


Loading…
Cancel
Save