@@ -271,6 +271,15 @@ func AllCommitsCount(repoPath string) (int64, error) { | |||||
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64) | return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64) | ||||
} | } | ||||
func HEADCommitsCount(repoPath string) (int64, error) { | |||||
stdout, err := NewCommand("rev-list", "HEAD", "--count").RunInDir(repoPath) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64) | |||||
} | |||||
func commitsCount(repoPath, revision, relpath string) (int64, error) { | func commitsCount(repoPath, revision, relpath string) (int64, error) { | ||||
cmd := NewCommand("rev-list", "--count") | cmd := NewCommand("rev-list", "--count") | ||||
cmd.AddArguments(revision) | cmd.AddArguments(revision) | ||||
@@ -52,6 +52,10 @@ func (repo *Repository) GetAllCommitsCount() (int64, error) { | |||||
return AllCommitsCount(repo.Path) | return AllCommitsCount(repo.Path) | ||||
} | } | ||||
func (repo *Repository) GetHeadCommitsCount() (int64, error) { | |||||
return HEADCommitsCount(repo.Path) | |||||
} | |||||
func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, error) { | func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, error) { | ||||
l := list.New() | l := list.New() | ||||
if len(logs) == 0 { | if len(logs) == 0 { | ||||
@@ -126,7 +126,7 @@ func GetUserKPIStats(repoPath string) (map[string]*UserKPIStats, error) { | |||||
func SetRepoKPIStats(repoPath string, fromTime time.Time, stats *RepoKPIStats, newContributers map[string]struct{}) error { | func SetRepoKPIStats(repoPath string, fromTime time.Time, stats *RepoKPIStats, newContributers map[string]struct{}) error { | ||||
since := fromTime.Format(time.RFC3339) | since := fromTime.Format(time.RFC3339) | ||||
args := []string{"log", "--numstat", "--no-merges", "--branches=*", "--pretty=format:---%n%h%n%an%n%ae%n", "--date=iso", fmt.Sprintf("--since='%s'", since)} | |||||
args := []string{"log", "--numstat", "--no-merges", "HEAD", "--pretty=format:---%n%h%n%an%n%ae%n", "--date=iso", fmt.Sprintf("--since='%s'", since)} | |||||
stdout, err := NewCommand(args...).RunInDirBytes(repoPath) | stdout, err := NewCommand(args...).RunInDirBytes(repoPath) | ||||
if err != nil { | if err != nil { | ||||
@@ -212,7 +212,7 @@ func SetRepoKPIStats(repoPath string, fromTime time.Time, stats *RepoKPIStats, n | |||||
func GetContributorsDetail(repoPath string, fromTime time.Time) ([]Contributor, error) { | func GetContributorsDetail(repoPath string, fromTime time.Time) ([]Contributor, error) { | ||||
since := fromTime.Format(time.RFC3339) | since := fromTime.Format(time.RFC3339) | ||||
cmd := NewCommand("shortlog", "-sne", "--all", fmt.Sprintf("--since='%s'", since)) | |||||
cmd := NewCommand("shortlog", "-sne", "HEAD", fmt.Sprintf("--since='%s'", since)) | |||||
stdout, err := cmd.RunInDir(repoPath) | stdout, err := cmd.RunInDir(repoPath) | ||||
if err != nil { | if err != nil { | ||||
return nil, err | return nil, err | ||||
@@ -539,7 +539,7 @@ func updateRepoCommitCnt(ctx *macaron.Context, repo *models.Repository) error { | |||||
} | } | ||||
defer gitRepo.Close() | defer gitRepo.Close() | ||||
count, err := gitRepo.GetAllCommitsCount() | |||||
count, err := gitRepo.GetHeadCommitsCount() | |||||
if err != nil { | if err != nil { | ||||
log.Error("GetAllCommitsCount failed:%v", err.Error(), ctx.Data["MsgID"]) | log.Error("GetAllCommitsCount failed:%v", err.Error(), ctx.Data["MsgID"]) | ||||
return err | return err | ||||
@@ -92,6 +92,7 @@ func DebugJobIndex(ctx *context.Context) { | |||||
ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
ctx.Data["Tasks"] = ciTasks | ctx.Data["Tasks"] = ciTasks | ||||
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ||||
ctx.Data["RepoIsEmpty"] = repo.IsEmpty | |||||
ctx.HTML(200, tplDebugJobIndex) | ctx.HTML(200, tplDebugJobIndex) | ||||
} | } | ||||
@@ -331,6 +332,7 @@ func TrainJobIndex(ctx *context.Context) { | |||||
ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
ctx.Data["Tasks"] = tasks | ctx.Data["Tasks"] = tasks | ||||
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) | ||||
ctx.Data["RepoIsEmpty"] = repo.IsEmpty | |||||
ctx.HTML(200, tplModelArtsTrainJobIndex) | ctx.HTML(200, tplModelArtsTrainJobIndex) | ||||
} | } | ||||
@@ -258,7 +258,7 @@ | |||||
<button class="ui green button" > | <button class="ui green button" > | ||||
{{.i18n.Tr "repo.cloudbrain.new"}} | {{.i18n.Tr "repo.cloudbrain.new"}} | ||||
</button> | </button> | ||||
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||||
<a class="ui button" href="{{.RepoLink}}/debugjob??debugListType=CPU/GPU">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</form> | </form> | ||||
@@ -272,8 +272,8 @@ | |||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> | <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> | ||||
<script> | <script> | ||||
let url_href = window.location.pathname.split('create')[0] | |||||
$(".ui.button").attr('href',url_href) | |||||
// let url_href = window.location.pathname.split('create')[0] | |||||
// $(".ui.button").attr('href',url_href) | |||||
let form = document.getElementById('form_id'); | let form = document.getElementById('form_id'); | ||||
@@ -11,7 +11,7 @@ | |||||
{{.i18n.Tr "repo.cloudbrain"}} | {{.i18n.Tr "repo.cloudbrain"}} | ||||
</a> | </a> | ||||
<div class="divider"> / </div> | <div class="divider"> / </div> | ||||
<a class="section" href="{{.RepoLink}}/debugjob?debugListType=CPU/GPU"> | |||||
<a class="section backTodeBug" href="{{.RepoLink}}/debugjob?debugListType=CPU/GPU"> | |||||
{{$.i18n.Tr "repo.modelarts.notebook"}} | {{$.i18n.Tr "repo.modelarts.notebook"}} | ||||
</a> | </a> | ||||
<div class="divider"> / </div> | <div class="divider"> / </div> | ||||
@@ -98,3 +98,4 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{{template "base/footer" .}} | {{template "base/footer" .}} | ||||
@@ -239,10 +239,12 @@ | |||||
<div class="ui icon header bgtask-header-pic"></div> | <div class="ui icon header bgtask-header-pic"></div> | ||||
<div class="bgtask-content-header">未创建过调试任务</div> | <div class="bgtask-content-header">未创建过调试任务</div> | ||||
<div class="bgtask-content"> | <div class="bgtask-content"> | ||||
{{if $.RepoIsEmpty}} | |||||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本</a>;</div> | <div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本</a>;</div> | ||||
{{end}} | |||||
<div class="bgtask-content-txt">运行时长:最长不超过4个小时,超过4个小时将自动停止;</div> | <div class="bgtask-content-txt">运行时长:最长不超过4个小时,超过4个小时将自动停止;</div> | ||||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境。</div> | |||||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程</a></div> | |||||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;</div> | |||||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org.cn/zeizei/OpenI_Learning">小白训练营课程。</a></div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{{else}} | {{else}} | ||||
@@ -464,6 +466,7 @@ | |||||
let url={{.RepoLink}} | let url={{.RepoLink}} | ||||
let getParam=location.search.split('?debugListType=').pop() | let getParam=location.search.split('?debugListType=').pop() | ||||
let dropdownValue = getParam==='all'||getParam==='' ? '全部' : getParam | let dropdownValue = getParam==='all'||getParam==='' ? '全部' : getParam | ||||
localStorage.setItem('all',location.href) | |||||
function stop(obj) { | function stop(obj) { | ||||
if (obj.style.color != "rgb(204, 204, 204)") { | if (obj.style.color != "rgb(204, 204, 204)") { | ||||
obj.target = '_blank' | obj.target = '_blank' | ||||
@@ -618,4 +621,5 @@ | |||||
} | } | ||||
}) | }) | ||||
} | } | ||||
</script> | </script> |
@@ -92,7 +92,7 @@ | |||||
<button class="ui green button"> | <button class="ui green button"> | ||||
{{.i18n.Tr "repo.cloudbrain.new"}} | {{.i18n.Tr "repo.cloudbrain.new"}} | ||||
</button> | </button> | ||||
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||||
<a class="ui button" href="{{.RepoLink}}/debugjob??debugListType=CPU/GPU">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</form> | </form> | ||||
@@ -11,7 +11,7 @@ | |||||
{{.i18n.Tr "repo.cloudbrain"}} | {{.i18n.Tr "repo.cloudbrain"}} | ||||
</a> | </a> | ||||
<div class="divider"> / </div> | <div class="divider"> / </div> | ||||
<a class="section" href="{{.RepoLink}}/debugjob?debugListType=NPU"> | |||||
<a class="section backTodeBug" href="{{.RepoLink}}/debugjob?debugListType=NPU"> | |||||
{{$.i18n.Tr "repo.modelarts.notebook"}} | {{$.i18n.Tr "repo.modelarts.notebook"}} | ||||
</a> | </a> | ||||
<div class="divider"> / </div> | <div class="divider"> / </div> | ||||
@@ -49,9 +49,11 @@ | |||||
<div class="ui icon header bgtask-header-pic"></div> | <div class="ui icon header bgtask-header-pic"></div> | ||||
<div class="bgtask-content-header">未创建过训练任务</div> | <div class="bgtask-content-header">未创建过训练任务</div> | ||||
<div class="bgtask-content"> | <div class="bgtask-content"> | ||||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本</a>;</div> | |||||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境。</div> | |||||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程</a></div> | |||||
{{if $.RepoIsEmpty}} | |||||
<div class="bgtask-content-txt">代码版本:您还没有初始化代码仓库,请先<a href="{{.RepoLink}}">创建代码版本;</a></div> | |||||
{{end}} | |||||
<div class="bgtask-content-txt">数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;</div> | |||||
<div class="bgtask-content-txt">使用说明:可以参考启智AI协作平台<a href="https://git.openi.org/zeizei/OpenI_Learning">小白训练营课程。</a></div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{{else}} | {{else}} | ||||
@@ -147,6 +147,7 @@ | |||||
<span> | <span> | ||||
<i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | ||||
</span> | </span> | ||||
<a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a> | |||||
</div> | </div> | ||||
<div class="required unite min_title inline field"> | <div class="required unite min_title inline field"> | ||||
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | ||||
@@ -159,6 +160,7 @@ | |||||
<option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option> | <option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option> | ||||
{{end}} | {{end}} | ||||
</select> | </select> | ||||
<span class="tooltips">数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。</span> | |||||
</div> | </div> | ||||
<div class="inline unite min_title field"> | <div class="inline unite min_title field"> | ||||
@@ -267,7 +269,6 @@ | |||||
sever_num.val(parseInt(sever_num.val())+1) | sever_num.val(parseInt(sever_num.val())+1) | ||||
} | } | ||||
}) | }) | ||||
// 参数增加、删除、修改、保存 | // 参数增加、删除、修改、保存 | ||||
function Add_parameter(i){ | function Add_parameter(i){ | ||||
value = '<div class="two fields width85" id= "para'+ i +'">' + | value = '<div class="two fields width85" id= "para'+ i +'">' + | ||||
@@ -159,6 +159,7 @@ | |||||
<span> | <span> | ||||
<i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | ||||
</span> | </span> | ||||
<a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a> | |||||
</div> | </div> | ||||
<div class="required unite min_title inline field"> | <div class="required unite min_title inline field"> | ||||
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.dataset"}}</label> | ||||
@@ -173,6 +174,7 @@ | |||||
{{end}} | {{end}} | ||||
{{end}} | {{end}} | ||||
</select> | </select> | ||||
<span class="tooltips">数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。</span> | |||||
</div> | </div> | ||||
<div class="inline unite min_title field"> | <div class="inline unite min_title field"> | ||||
@@ -162,6 +162,7 @@ | |||||
$("#job-name").empty() | $("#job-name").empty() | ||||
createModelName() | createModelName() | ||||
loadTrainList() | loadTrainList() | ||||
}, | }, | ||||
onHide:function(){ | onHide:function(){ | ||||
document.getElementById("formId").reset(); | document.getElementById("formId").reset(); | ||||
@@ -179,6 +180,7 @@ | |||||
$('#choice_model').dropdown({ | $('#choice_model').dropdown({ | ||||
onChange:function(value){ | onChange:function(value){ | ||||
$(".ui.dropdown.selection.search.width70").addClass("loading") | $(".ui.dropdown.selection.search.width70").addClass("loading") | ||||
$('#choice_version').dropdown('clear') | |||||
$("#job-version").empty() | $("#job-version").empty() | ||||
loadTrainVersion(value) | loadTrainVersion(value) | ||||
} | } | ||||
@@ -208,11 +210,17 @@ | |||||
train_html += '</div>' | train_html += '</div>' | ||||
} | } | ||||
$("#job-name").append(train_html) | $("#job-name").append(train_html) | ||||
$(".ui.dropdown.selection.search.width83").removeClass("loading") | |||||
$(".ui.dropdown.selection.search.width83").removeClass("loading") | |||||
$('#choice_model .default.text').text(data[0].JobName) | |||||
$('#choice_model input[name="JobId"]').val(data[0].JobID) | |||||
loadTrainVersion() | |||||
}) | }) | ||||
} | } | ||||
function loadTrainVersion(value){ | function loadTrainVersion(value){ | ||||
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${value}`, (data) => { | |||||
let JobID = !value ?$('#choice_model input[name="JobId"]').val(): value | |||||
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { | |||||
const n_length = data.length | const n_length = data.length | ||||
let train_html='' | let train_html='' | ||||
for (let i=0;i<n_length;i++){ | for (let i=0;i<n_length;i++){ | ||||
@@ -221,6 +229,8 @@ | |||||
} | } | ||||
$("#job-version").append(train_html) | $("#job-version").append(train_html) | ||||
$(".ui.dropdown.selection.search.width70").removeClass("loading") | $(".ui.dropdown.selection.search.width70").removeClass("loading") | ||||
$('#choice_version .default.text').text(data[0].VersionName) | |||||
$('#choice_version input[name="VersionName"]').val(data[0].VersionName) | |||||
}) | }) | ||||
} | } | ||||
</script> | </script> | ||||
@@ -162,6 +162,9 @@ function loadInfo(){ | |||||
$.get(`${url}show_model_info_api?name=${ID}`,(data)=>{ | $.get(`${url}show_model_info_api?name=${ID}`,(data)=>{ | ||||
let html = '' | let html = '' | ||||
for (let i=0;i<data.length;i++){ | for (let i=0;i<data.length;i++){ | ||||
if(!data[i].IsCanOper){ | |||||
$("#edit-pencil").css("display","none") | |||||
} | |||||
html += `<option value="${data[i].Version}">${data[i].Version}</option>` | html += `<option value="${data[i].Version}">${data[i].Version}</option>` | ||||
} | } | ||||
$('#dropdown').append(html) | $('#dropdown').append(html) | ||||
@@ -218,7 +221,7 @@ function tranSize(value){ | |||||
function editorFn(context){ | function editorFn(context){ | ||||
let id= context.dataset.id | let id= context.dataset.id | ||||
let text = context.dataset.desc | let text = context.dataset.desc | ||||
$('#edit-td').replaceWith("<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' rows='3' maxlength='255' style='width:80%;' id='edit-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>"); | |||||
$('#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>"); | |||||
} | } | ||||
function editorCancel(text,id){ | function editorCancel(text,id){ | ||||
@@ -247,12 +250,17 @@ function renderInfo(obj,accObj,id){ | |||||
$('#edit-pencil').attr("data-desc",obj[key]) | $('#edit-pencil').attr("data-desc",obj[key]) | ||||
} | } | ||||
else if(key==="Label"){ | else if(key==="Label"){ | ||||
let labelArray = obj[key].split(' ') | |||||
let html='' | |||||
for(let i=0;i<labelArray.length;i++){ | |||||
html += `<a class="ui label">${labelArray[i]}</a>` | |||||
$('#Label').empty() | |||||
if(obj[key]==='--'){ | |||||
$('#Label').text(obj[key]) | |||||
}else{ | |||||
let labelArray = obj[key].trim().split(' ') | |||||
let html='' | |||||
for(let i=0;i<labelArray.length;i++){ | |||||
html += `<a class="ui label">${labelArray[i]}</a>` | |||||
} | |||||
$('#Label').append(html) | |||||
} | } | ||||
$('#Label').append(html) | |||||
} | } | ||||
else{ | else{ | ||||
$(`#${key}`).text(obj[key]) | $(`#${key}`).text(obj[key]) | ||||
@@ -1,7 +1,7 @@ | |||||
<template> | <template> | ||||
<div> | <div> | ||||
<div class="ui container" id="header"> | <div class="ui container" id="header"> | ||||
<el-row style="margin-top:15px;" v-loading.fullscreen.lock="fullscreenLoading"> | |||||
<el-row style="margin-top:15px;"> | |||||
<el-table | <el-table | ||||
ref="table" | ref="table" | ||||
:data="tableData" | :data="tableData" | ||||
@@ -9,7 +9,7 @@ | |||||
row-key="ID" | row-key="ID" | ||||
lazy | lazy | ||||
:load="load" | :load="load" | ||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" | |||||
:tree-props="{children: 'Children', hasChildren: 'hasChildren'}" | |||||
:header-cell-style="tableHeaderStyle" | :header-cell-style="tableHeaderStyle" | ||||
> | > | ||||
<el-table-column | <el-table-column | ||||
@@ -146,7 +146,6 @@ export default { | |||||
totalNum:0, | totalNum:0, | ||||
params:{page:0,pageSize:10}, | params:{page:0,pageSize:10}, | ||||
tableData: [], | tableData: [], | ||||
fullscreenLoading: false, | |||||
url:'', | url:'', | ||||
isLoading:true, | isLoading:true, | ||||
loadNodeMap:new Map(), | loadNodeMap:new Map(), | ||||
@@ -155,7 +154,7 @@ export default { | |||||
}, | }, | ||||
methods: { | methods: { | ||||
load(tree, treeNode, resolve) { | load(tree, treeNode, resolve) { | ||||
this.loadNodeMap.set(tree.cName, tree.ID) | |||||
this.loadNodeMap.set(tree.cName, {tree,treeNode,resolve}) | |||||
this.$axios.get(this.url+'show_model_child_api',{params:{ | this.$axios.get(this.url+'show_model_child_api',{params:{ | ||||
name:tree.cName | name:tree.cName | ||||
}}).then((res)=>{ | }}).then((res)=>{ | ||||
@@ -246,9 +245,10 @@ export default { | |||||
submit(){ | submit(){ | ||||
let context = this | let context = this | ||||
let flag= this.check() | let flag= this.check() | ||||
console.log(flag,context) | |||||
if(flag){ | if(flag){ | ||||
let data = $("#formId").serialize() | let data = $("#formId").serialize() | ||||
let cName = $("input[name='Name']").val() | |||||
let row = {cName:cName} | |||||
$("#mask").css({"display":"block","z-index":"9999"}) | $("#mask").css({"display":"block","z-index":"9999"}) | ||||
$.ajax({ | $.ajax({ | ||||
url:url_href, | url:url_href, | ||||
@@ -256,6 +256,7 @@ export default { | |||||
data:data, | data:data, | ||||
success:function(res){ | success:function(res){ | ||||
context.getModelList() | context.getModelList() | ||||
context.loadrefresh(row) | |||||
$('.ui.modal.second').modal('hide') | $('.ui.modal.second').modal('hide') | ||||
}, | }, | ||||
error: function(xhr){ | error: function(xhr){ | ||||
@@ -272,9 +273,21 @@ export default { | |||||
return false | return false | ||||
} | } | ||||
}, | }, | ||||
loadrefresh(row){ | |||||
if(!this.loadNodeMap.get(row.cName)){ | |||||
return | |||||
}else{ | |||||
let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName) | |||||
this.$set( | |||||
this.$refs.table.store.states.lazyTreeNodeMap, | |||||
tree.ID, | |||||
[]) | |||||
this.load(tree,treeNode,resolve) | |||||
} | |||||
}, | |||||
deleteModel(id,name){ | deleteModel(id,name){ | ||||
let tree={cName:name} | |||||
let row={cName:name} | |||||
let _this = this | let _this = this | ||||
let flag=1 | let flag=1 | ||||
$('.ui.basic.modal.first') | $('.ui.basic.modal.first') | ||||
@@ -288,7 +301,7 @@ export default { | |||||
ID:id | ID:id | ||||
}}).then((res)=>{ | }}).then((res)=>{ | ||||
_this.getModelList() | _this.getModelList() | ||||
_this.loadrefresh(tree) | |||||
_this.loadrefresh(row) | |||||
}) | }) | ||||
flag = true | flag = true | ||||
}, | }, | ||||
@@ -302,29 +315,8 @@ export default { | |||||
}) | }) | ||||
.modal('show') | .modal('show') | ||||
}, | }, | ||||
loadrefresh(tree){ | |||||
this.$axios.get(this.url+'show_model_child_api',{params:{ | |||||
name:tree.cName | |||||
}}).then((res)=>{ | |||||
let TrainTaskInfo | |||||
let tableData | |||||
tableData= res.data | |||||
for(let i=0;i<tableData.length;i++){ | |||||
TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo) | |||||
tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0] | |||||
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource | |||||
tableData[i].cName=tableData[i].Name | |||||
tableData[i].Name='' | |||||
tableData[i].VersionCount = '' | |||||
tableData[i].Children = true | |||||
} | |||||
let id = this.loadNodeMap.get(tree.cName) | |||||
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, id, tableData) | |||||
}) | |||||
}, | |||||
getModelList(){ | getModelList(){ | ||||
this.fullscreenLoading = false | |||||
this.$axios.get(location.href+'_api',{ | this.$axios.get(location.href+'_api',{ | ||||
params:this.params | params:this.params | ||||
}).then((res)=>{ | }).then((res)=>{ | ||||
@@ -340,7 +332,6 @@ export default { | |||||
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true | this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true | ||||
} | } | ||||
this.totalNum = res.data.count | this.totalNum = res.data.count | ||||
this.fullscreenLoading = false | |||||
}) | }) | ||||
}, | }, | ||||
@@ -4130,4 +4130,7 @@ function initDropDown() { | |||||
$('.question.circle.icon').hover(function(){ | $('.question.circle.icon').hover(function(){ | ||||
$(this).popup('show') | $(this).popup('show') | ||||
$('.ui.popup.mini.top.center').css({"border-color":'rgba(50, 145, 248, 100)',"color":"rgba(3, 102, 214, 100)","border-radius":"5px","border-shadow":"none"}) | $('.ui.popup.mini.top.center').css({"border-color":'rgba(50, 145, 248, 100)',"color":"rgba(3, 102, 214, 100)","border-radius":"5px","border-shadow":"none"}) | ||||
}); | |||||
}); | |||||
//云脑详情页面跳转回上一个页面 | |||||
$(".section.backTodeBug").attr("href",localStorage.getItem('all')) |
@@ -549,8 +549,8 @@ display: block; | |||||
cursor: pointer; | cursor: pointer; | ||||
pointer-events: none; | pointer-events: none; | ||||
} | } | ||||
.letf2{ | |||||
margin-left: -2px; | |||||
.left2{ | |||||
margin-left: -2px !important; | |||||
} | } | ||||
.width70{ | .width70{ | ||||
width: 70% !important; | width: 70% !important; | ||||
@@ -578,3 +578,10 @@ display: block; | |||||
.mglf{ | .mglf{ | ||||
margin-left:0.5em !important; | margin-left:0.5em !important; | ||||
} | } | ||||
.tooltips{ | |||||
display: inline-block; | |||||
margin-left: 5.5rem; | |||||
font-size: 12px; | |||||
margin-top: 0.7rem; | |||||
color: #888888; | |||||
} |