Browse Source

fix issue

pull/2740/head
zhoupzh 2 years ago
parent
commit
744d89fca5
3 changed files with 49 additions and 31 deletions
  1. +7
    -31
      templates/repo/modelarts/trainjob/show.tmpl
  2. +29
    -0
      web_src/js/features/cloudbrainShow.js
  3. +13
    -0
      web_src/js/features/cloudrbanin.js

+ 7
- 31
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -274,10 +274,14 @@


{{if .CanDel}}
<a class="ti-action-menu-item" onclick="deleteVersion({{.VersionName}})"
<a class='ti-action-menu-item delete-show-version {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING" "RUNNING" "KILLING" "INIT"}}disabled {{end}}'
id="{{.VersionName}}-delete"
data-jobid="{{.JobID}}"
data-repopath="{{$.RepoRelPath}}/modelarts/train-job"
data-version = "{{.VersionName}}"
style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a>
{{else}}
<a class="ti-action-menu-item disabled" onclick="deleteVersion({{.VersionName}})"
<a class="ti-action-menu-item disabled"
style="color: #FF4D4F;">{{$.i18n.Tr "repo.delete"}}</a>
{{end}}
</div>
@@ -896,35 +900,7 @@
$('#name').val(modelName)
$('#version').val("0.0.1")
}
function deleteVersion(version_name) {
stopBubbling(arguments.callee.caller.arguments[0])
let flag = 1;
$('.ui.basic.modal').modal({
onDeny: function () {
flag = false
},
onApprove: function () {
$.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/del_version`, { version_name: version_name }, (data) => {
if (data.VersionListCount === 0) {
location.href = `/${userName}/${repoPath}/modelarts/train-job`
} else {
$('#accordion' + version_name).remove()
}

}).fail(function (err) {
console.log(err);
});
flag = true
},
onHidden: function () {
if (flag == false) {
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}
}
})
.modal('show')

}




+ 29
- 0
web_src/js/features/cloudbrainShow.js View File

@@ -213,6 +213,35 @@ export default async function initCloudrainSow() {
});
e.stopPropagation();
});
$(".delete-show-version").click(function (e) {
const ID = this.dataset.jobid;
const repoPath = this.dataset.repopath;
const version_name = this.dataset.version;
const url = `/api/v1/repos/${repoPath}/${ID}/del_version`;
$(".ui.basic.modal")
.modal({
onApprove: function () {
$.post(url, { version_name: version_name }, (data) => {
console.log(data);
if (data.StatusOK === 0) {
if (data.VersionListCount === 0) {
location.href = `/${repoPath}`;
} else {
$("#accordion" + version_name).remove();
}
refreshStatusShow(version_name, ID, repoPath);
} else {
return;
}
}).fail(function (err) {
console.log(err);
});
},
})
.modal("show");

e.stopPropagation();
});
function refreshStatusShow(version_name, ID, repoPath) {
$.get(
`/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`,


+ 13
- 0
web_src/js/features/cloudrbanin.js View File

@@ -182,6 +182,15 @@ export default async function initCloudrain() {
"CREATE_FAILED",
"STOPPED",
];
let deleteArray = [
"KILLED",
"FAILED",
"START_FAILED",
"COMPLETED",
"SUCCEEDED",
"CREATE_FAILED",
"STOPPED",
];
$.get(
`/api/v1/repos/${repoPath}/${jobID}?version_name=${versionname}`,
(data) => {
@@ -194,6 +203,10 @@ export default async function initCloudrain() {
if (stopArray.includes(data.JobStatus)) {
$("#" + versionname + "-stop").addClass("disabled");
}
if (deleteArray.includes(data.JobStatus)) {
$(`#${versionname}-delete`).removeClass("disabled");
$(`#${versionname}-delete`).addClass("blue");
}
if (data.JobStatus === "COMPLETED") {
$("#" + versionname + "-create-model")
.removeClass("disabled")


Loading…
Cancel
Save