#3947 增加按钮权限

Merged
ychao_1983 merged 4 commits from fix-3923 into V20230322.patch 1 year ago
  1. +1
    -0
      routers/repo/grampus.go
  2. +2
    -1
      templates/repo/grampus/trainjob/show.tmpl
  3. +18
    -7
      web_src/js/features/cloudbrainShow.js

+ 1
- 0
routers/repo/grampus.go View File

@@ -1567,6 +1567,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task)
ctx.Data["displayJobName"] = task.DisplayJobName
ctx.Data["canReschedule"] = cloudbrain.CanDeleteJob(ctx, task)

ctx.Data["ai_center"] = cloudbrainService.GetAiCenterShow(task.AiCenter, ctx)



+ 2
- 1
templates/repo/grampus/trainjob/show.tmpl View File

@@ -94,7 +94,7 @@
{{if eq .ComputeResource "CPU/GPU"}}
<a class="item run_info" data-tab="five{{$k}}" data-version="{{.VersionName}}">{{$.i18n.Tr "repo.cloudbrain.runinfo"}}</a>
{{end}}
<a class="item load-model-file" data-tab="third{{$k}}" data-retry-path="{{$.RepoLink}}/cloudbrain/train-job/{{.JobID}}/model/reschedule" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a>
<a class="item load-model-file" data-tab="third{{$k}}" data-can-reschedule="{{$.canReschedule}}" data-retry-path="{{$.RepoLink}}/cloudbrain/train-job/{{.JobID}}/model/reschedule" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a>
</div>
<div class="ui tab active" data-tab="first{{$k}}">
<div style="padding-top: 10px;">
@@ -587,6 +587,7 @@
});
$('td.ti-text-form-content.spec').text(specStr);
})();
console.log({{.version_list_task}})
var setting = {
check: {
enable: true,


+ 18
- 7
web_src/js/features/cloudbrainShow.js View File

@@ -575,6 +575,7 @@ export default async function initCloudrainSow() {
let init = $(this).data("init") || "";
let path = $(this).data("path");
let retryPath = `/api/v1/repos${$(this).data("retry-path")}`;
const rescheduleFlag = $(this).data("can-reschedule") || "";
$(`#dir_list${version_name}`).empty();
let url = `/api/v1/repos${path}?version_name=${version_name}&parentDir=${parents}`;
$.get(url, (data) => {
@@ -631,13 +632,23 @@ export default async function initCloudrainSow() {
</div>`);
} else if (data.StatusOK == 2) { // 失败 2
$(`#file_breadcrumb${version_name}`).empty();
$(`#dir_list${version_name}`).html(`<div style="height:200px;display:flex;justify-content:center;align-items:center;font-size:14px;color:rgb(16, 16, 16);">
<div style="display:flex;justify-content:center;align-items:center;height:24px;width:24px;margin-right:5px;">
<svg xmlns="http://www.w3.org/2000/svg" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 iKfgJk svg-icon-path-icon fill" viewBox="64 64 896 896" width="16" height="16"><defs data-reactroot=""></defs><g><path d="M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"></path></g></svg>
</div>
<span>${i18n['file_sync_fail']}</span>
<a href="javascript:void(0)" id="retry_result" style='text-decoration: underline;margin-left:0.5rem'>${i18n['retrieve_results']}</a>
</div>`);
if (rescheduleFlag) {
$(`#dir_list${version_name}`).html(`<div style="height:200px;display:flex;justify-content:center;align-items:center;font-size:14px;color:rgb(16, 16, 16);">
<div style="display:flex;justify-content:center;align-items:center;height:24px;width:24px;margin-right:5px;">
<svg xmlns="http://www.w3.org/2000/svg" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 iKfgJk svg-icon-path-icon fill" viewBox="64 64 896 896" width="16" height="16"><defs data-reactroot=""></defs><g><path d="M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"></path></g></svg>
</div>
<span>${i18n['file_sync_fail']}</span>
<a href="javascript:void(0)" id="retry_result" style='text-decoration: underline;margin-left:0.5rem'>${i18n['retrieve_results']}</a>
</div>`);
}
else {
$(`#dir_list${version_name}`).html(`<div style="height:200px;display:flex;justify-content:center;align-items:center;font-size:14px;color:rgb(16, 16, 16);">
<div style="display:flex;justify-content:center;align-items:center;height:24px;width:24px;margin-right:5px;">
<svg xmlns="http://www.w3.org/2000/svg" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 iKfgJk svg-icon-path-icon fill" viewBox="64 64 896 896" width="16" height="16"><defs data-reactroot=""></defs><g><path d="M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"></path></g></svg>
</div>
<span>${i18n['file_sync_fail']}</span>
</div>`);
}
} else if (data.StatusOK == 3) { // 等待同步 3
$(`#file_breadcrumb${version_name}`).empty();
$(`#dir_list${version_name}`).html(`<div style="height:200px;display:flex;justify-content:center;align-items:center;font-size:14px;color:rgb(16, 16, 16);">


Loading…
Cancel
Save