|
|
|
@@ -110,7 +110,36 @@ |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">模型描述</td> |
|
|
|
<td class="ti-text-form-content" ><div id="edit-td" style="display:flex"><span id="Description" title="" class="iword-elipsis"></span><i id="edit-pencil" data-id="" data-desc="" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div></td> |
|
|
|
<td class="ti-text-form-content" > |
|
|
|
<div id="edit-td" style="display:flex"> |
|
|
|
<span id="Description" title="" class="iword-elipsis"></span> |
|
|
|
<i id="edit-pencil" data-id="" data-desc="" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></i> |
|
|
|
</div> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">代码版本</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="CodeBranch" title=""></span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">启动文件</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="BootFile" title=""></span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">训练数据集</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="DatasetName" title=""></span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">运行参数</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="Parameters" title=""></span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">规格</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="FlavorName" title=""></span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td class="ti-text-form-label text-width80">计算节点</td> |
|
|
|
<td class="ti-text-form-content word-elipsis"><span id="WorkServerNumber" title=""></span></td> |
|
|
|
</tr> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
@@ -155,6 +184,7 @@ function changeInfo(version){ |
|
|
|
let returnArray = [] |
|
|
|
returnArray = transObj(versionData) |
|
|
|
let [initObj,initModelAcc,id] = returnArray |
|
|
|
editorCancel('','') |
|
|
|
renderInfo(initObj,initModelAcc,id) |
|
|
|
}) |
|
|
|
} |
|
|
|
@@ -175,8 +205,15 @@ function loadInfo(){ |
|
|
|
}) |
|
|
|
} |
|
|
|
function transObj(data){ |
|
|
|
let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy} = data[0] |
|
|
|
let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy,CodeBranch,CodeCommitID,TrainTaskInfo} = data[0] |
|
|
|
let modelAcc = JSON.parse(Accuracy) |
|
|
|
TrainTaskInfo = JSON.parse(TrainTaskInfo) |
|
|
|
// Parameters = JSON.parse(Parameters) |
|
|
|
console.log("TrainTaskInfo",TrainTaskInfo) |
|
|
|
let {Parameters} = TrainTaskInfo |
|
|
|
Parameters = JSON.parse(Parameters) |
|
|
|
Parameters = Parameters.parameter.length === 0 ? '--':Parameters.parameter |
|
|
|
console.log(Parameters) |
|
|
|
let size = tranSize(Size) |
|
|
|
let time = transTime(CreatedUnix) |
|
|
|
let initObj = { |
|
|
|
@@ -186,6 +223,14 @@ function transObj(data){ |
|
|
|
Size:size, |
|
|
|
CreateTime:time, |
|
|
|
Description:Description || '--', |
|
|
|
CodeBranch:CodeBranch || '--', |
|
|
|
CodeCommitID:CodeCommitID || '--', |
|
|
|
BootFile:TrainTaskInfo.BootFile || '--', |
|
|
|
DatasetName:TrainTaskInfo.DatasetName || '--', |
|
|
|
Parameters:TrainTaskInfo.Parameters || '--', |
|
|
|
FlavorName:TrainTaskInfo.FlavorName || '--', |
|
|
|
WorkServerNumber:TrainTaskInfo.WorkServerNumber || '--', |
|
|
|
Parameters:Parameters |
|
|
|
} |
|
|
|
let initModelAcc = { |
|
|
|
Accuracy: modelAcc.Accuracy || '--', |
|
|
|
@@ -221,15 +266,16 @@ function tranSize(value){ |
|
|
|
function editorFn(context){ |
|
|
|
let id= context.dataset.id |
|
|
|
let text = context.dataset.desc |
|
|
|
console.log(id,text) |
|
|
|
$('#edit-td').replaceWith("<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' value='' rows='3' maxlength='255' style='width:80%;' id='edit-text'>"+text+"</textarea><i class='check icon' style='color: #50d4ab;' onclick='editorSure(\"" + text + "\",\"" + id + "\")'></i><i class='times icon' style='color: #f66f6a;' onclick='editorCancel(\"" + text + "\",\"" + id + "\")'></i></div>"); |
|
|
|
|
|
|
|
let textValue = text.replace(/enter;/g,'\r\n') |
|
|
|
$('#edit-td').replaceWith(`<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' value='' rows='3' maxlength='255' style='width:80%;white-space: nowrap;' id='edit-text'>${textValue}</textarea><i class='check icon' style='color: #50d4ab;' onclick='editorSure("${text}","${id}")'></i><i class='times icon' style='color: #f66f6a;' onclick='editorCancel("${text}","${id}")'></i></div>`); |
|
|
|
} |
|
|
|
function editorCancel(text,id){ |
|
|
|
$('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${text}" class="iword-elipsis">${text}</span><i id="edit-pencil" data-id="${id}" data-desc="${text}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`) |
|
|
|
let objkey = text.replace(/enter;/g,'\r\n') |
|
|
|
$('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${objkey}" class="iword-elipsis">${objkey}</span><i id="edit-pencil" data-id="${id}" data-desc="${text}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`) |
|
|
|
} |
|
|
|
function editorSure(text,id){ |
|
|
|
let description=$('#textarea-value').val() |
|
|
|
let sourcetext = $('#textarea-value').val().replace(/\n/g,'enter;') |
|
|
|
let data = { |
|
|
|
ID:id, |
|
|
|
Description:description |
|
|
|
@@ -239,16 +285,18 @@ function editorSure(text,id){ |
|
|
|
type:'PUT', |
|
|
|
data:data |
|
|
|
}).done((res)=>{ |
|
|
|
$('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${description}" class="iword-elipsis">${description}</span><i id="edit-pencil" data-id="${id}" data-desc="${description}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`) |
|
|
|
$('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${description}" class="iword-elipsis">${description}</span><i id="edit-pencil" data-id="${id}" data-desc="${sourcetext}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`) |
|
|
|
}) |
|
|
|
} |
|
|
|
function renderInfo(obj,accObj,id){ |
|
|
|
for(let key in obj){ |
|
|
|
if(key==="Description"){ |
|
|
|
let descriptionText=obj[key].replace(/\r\n|\n/g,'enter;') |
|
|
|
$(`#${key}`).text(obj[key]) |
|
|
|
$(`#${key}`).attr("title",obj[key]) |
|
|
|
|
|
|
|
$('#edit-pencil').attr("data-id",id) |
|
|
|
$('#edit-pencil').attr("data-desc",obj[key]) |
|
|
|
$('#edit-pencil').attr("data-desc",descriptionText) |
|
|
|
} |
|
|
|
else if(key==="Label"){ |
|
|
|
$('#Label').empty() |
|
|
|
@@ -263,6 +311,29 @@ function renderInfo(obj,accObj,id){ |
|
|
|
} |
|
|
|
$('#Label').append(html) |
|
|
|
} |
|
|
|
} |
|
|
|
else if(key==="CodeCommitID"){ |
|
|
|
let codeCommit = obj[key].slice(0,10) |
|
|
|
let html = `<a style="margin-left:1rem" class="ui label" title="${codeCommit}">${codeCommit}</a>` |
|
|
|
$('#CodeBranch').append(html) |
|
|
|
|
|
|
|
} |
|
|
|
else if(key==="Parameters"){ |
|
|
|
console.log("obj[key",obj[key]) |
|
|
|
if(obj[key]==='--'){ |
|
|
|
$(`#${key}`).text(obj[key]) |
|
|
|
}else{ |
|
|
|
const parameterArray = obj[key].map(element => { |
|
|
|
let labelValue = `${element.label}=${element.value}` |
|
|
|
return labelValue |
|
|
|
}); |
|
|
|
const parameter = parameterArray.join('; ') |
|
|
|
console.log(parameter) |
|
|
|
$(`#${key}`).text(parameter) |
|
|
|
$(`#${key}`).attr("title",parameter) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
$(`#${key}`).text(obj[key]) |
|
|
|
|