From 41d036e38f27978ca693f72569a056e65f144800 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 4 Aug 2022 15:40:32 +0800 Subject: [PATCH] fix issue --- templates/repo/cloudbrain/new.tmpl | 1 + templates/repo/debugjob/index.tmpl | 10 + web_src/js/components/MinioUploader.vue | 640 ++++++++++++++---------- web_src/js/features/cloudrbanin.js | 88 ++-- 4 files changed, 438 insertions(+), 301 deletions(-) diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index 9552c80c0..ea093b5b3 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -287,6 +287,7 @@ {{template "base/footer" .}} - \ No newline at end of file + diff --git a/web_src/js/features/cloudrbanin.js b/web_src/js/features/cloudrbanin.js index c3f7278aa..9adacc2a7 100644 --- a/web_src/js/features/cloudrbanin.js +++ b/web_src/js/features/cloudrbanin.js @@ -347,7 +347,6 @@ export default async function initCloudrain() { e.stopPropagation(); }); - function refreshStatus(version_name, ID, repoPath) { const url = `/api/v1/repos/${repoPath}/${ID}/?version_name${version_name}`; $.get(url, (data) => { @@ -405,49 +404,58 @@ export default async function initCloudrain() { const jobName = this.dataset.jobname; getModelInfo(repoPath, modelName, versionName, jobName); }); + function debugAgainPost(ID, debugUrl, redirect_to) { + $.ajax({ + type: "POST", + url: debugUrl + "restart?redirect_to=" + redirect_to, + data: $("#debugAgainForm-" + ID).serialize(), + success: function (res) { + if (res["WechatRedirectUrl"]) { + window.location.href = res["WechatRedirectUrl"]; + } else if (res.result_code === "0") { + if (res.id !== ID) { + location.reload(); + } else { + $("#" + ID + "-icon") + .removeClass() + .addClass(res.status); + $("#" + ID + "-text").text(res.status); + $("#ai-debug-" + ID) + .removeClass("blue") + .addClass("disabled"); + $("#ai-delete-" + ID) + .removeClass("blue") + .addClass("disabled"); + $("#ai-debug-" + ID) + .text(debug_button) + .css("margin", "0 1rem"); + } + } else { + $(".alert") + .html(res.error_msg) + .removeClass("alert-success") + .addClass("alert-danger") + .show() + .delay(2000) + .fadeOut(); + } + }, + error: function (res) { + console.log(res); + }, + }); + } function debugAgain(ID, debugUrl, redirect_to) { if ($("#" + ID + "-text").text() === "RUNNING") { window.open(debugUrl + "debug"); } else { - $.ajax({ - type: "POST", - url: debugUrl + "restart?redirect_to=" + redirect_to, - data: $("#debugAgainForm-" + ID).serialize(), - success: function (res) { - if (res["WechatRedirectUrl"]) { - window.location.href = res["WechatRedirectUrl"]; - } else if (res.result_code === "0") { - if (res.id !== ID) { - location.reload(); - } else { - $("#" + ID + "-icon") - .removeClass() - .addClass(res.status); - $("#" + ID + "-text").text(res.status); - $("#ai-debug-" + ID) - .removeClass("blue") - .addClass("disabled"); - $("#ai-delete-" + ID) - .removeClass("blue") - .addClass("disabled"); - $("#ai-debug-" + ID) - .text(debug_button) - .css("margin", "0 1rem"); - } - } else { - $(".alert") - .html(res.error_msg) - .removeClass("alert-success") - .addClass("alert-danger") - .show() - .delay(2000) - .fadeOut(); - } - }, - error: function (res) { - console.log(res); - }, - }); + $(".ui.mini.modal.debug-again") + .modal({ + onApprove: function () { + console.log("-----------"); + }, + }) + .modal("show"); } } $(".ui.basic.ai_debug").click(function () {