Browse Source

#2964 调整下载结果页签提示

tags/v1.22.11.1^2
chenshihai 3 years ago
parent
commit
cef17ba1eb
3 changed files with 63 additions and 24 deletions
  1. +56
    -24
      web_src/js/features/cloudbrainShow.js
  2. +6
    -0
      web_src/js/features/i18nVue.js
  3. +1
    -0
      web_src/js/index.js

+ 56
- 24
web_src/js/features/cloudbrainShow.js View File

@@ -293,34 +293,66 @@ export default async function initCloudrainSow() {
let filename = $(this).data("filename");
let init = $(this).data("init") || "";
let path = $(this).data("path");
$(`#dir_list${version_name}`).empty();
let url = `/api/v1/repos${path}?version_name=${version_name}&parentDir=${parents}`;
$.get(url, (data) => {
$(`#dir_list${version_name}`).empty();
if (data.Dirs) {
renderDir(path, data, version_name, downloadFlag, gpuFlag);
}
if (init === "init") {
$(`input[name=model${version_name}]`).val("");
$(`input[name=modelback${version_name}]`).val(version_name);
$(`#file_breadcrumb${version_name}`).empty();
let htmlBread = "";
if (version_name) {
htmlBread += `<div class='active section'>${version_name}</div>`;
if (data.StatusOK == 0) { // 成功
if (data.Dirs) {
renderDir(path, data, version_name, downloadFlag, gpuFlag);
}
if (init === "init") {
$(`input[name=model${version_name}]`).val("");
$(`input[name=modelback${version_name}]`).val(version_name);
$(`#file_breadcrumb${version_name}`).empty();
let htmlBread = "";
if (version_name) {
htmlBread += `<div class='active section'>${version_name}</div>`;
} else {
htmlBread += `<div class='active section'>result</div>`;
}
htmlBread += "<div class='divider'> / </div>";
$(`#file_breadcrumb${version_name}`).append(htmlBread);
} else {
htmlBread += `<div class='active section'>result</div>`;
renderBrend(
path,
version_name,
parents,
filename,
init,
downloadFlag,
gpuFlag
);
}
htmlBread += "<div class='divider'> / </div>";
$(`#file_breadcrumb${version_name}`).append(htmlBread);
} else {
renderBrend(
path,
version_name,
parents,
filename,
init,
downloadFlag,
gpuFlag
);
} else if (data.StatusOK == 1) { // 处理中
$(`#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);">
<style>
@-webkit-keyframes spinning {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
</style>
<div style="display:flex;justify-content:center;align-items:center;height:24px;width:24px;margin-right:5px;animation-duration:3s;animation-iteration-count:infinite;animation-name:spinning;animation-timing-function:linear;animation-fill-mode:backwards;">
<svg xmlns="http://www.w3.org/2000/svg" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 iKfgJk svg-icon-path-icon fill" viewBox="0 0 48 48" width="16" height="16"><defs data-reactroot=""></defs><g><g><rect width="48" height="48" fill="white" fill-opacity="0.01" stroke-linejoin="round" stroke-width="4" stroke="none" fill-rule="evenodd"></rect><g transform="translate(7.000000, 3.500000)"><path d="M0,0.5 L34,0.5" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" stroke="#333" fill="none" fill-rule="evenodd"></path><path d="M0,40.5 L34,40.5" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" stroke="#333" fill="none" fill-rule="evenodd"></path><path d="M30,20.4999965 C27.3333333,33.8388874 23,40.5055541 17,40.4999965 C11,40.494439 6.66666667,33.8277723 4,20.4999965 L30,20.4999965 Z" fill="none" fill-rule="nonzero" transform="translate(17.000000, 30.499998) rotate(180.000000) translate(-17.000000, -30.499998) " stroke-linejoin="round" stroke-width="4" stroke="#333"></path><path d="M30,0.5 C27.3333333,13.8388909 23,20.5055575 17,20.5 C11,20.4944425 6.66666667,13.8277758 4,0.5 L30,0.5 Z" fill="none" fill-rule="nonzero" stroke-linejoin="round" stroke-width="4" stroke="#333"></path></g></g></g></svg>
</div>
<span>${i18n['file_sync_ing']}</span>
</div>`);
} else if (data.StatusOK == 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>
</div>`);
} else if (data.StatusOK == 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);">
<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="0 0 24 24" width="16" height="16"><defs data-reactroot=""></defs><g><circle cx="15.5" cy="9.5" r="1.5"></circle><circle cx="8.5" cy="9.5" r="1.5"></circle><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-6c-2.33 0-4.32 1.45-5.12 3.5h1.67c.69-1.19 1.97-2 3.45-2s2.75.81 3.45 2h1.67c-.8-2.05-2.79-3.5-5.12-3.5z"></path></g></svg>
</div>
<span>${i18n['no_file_to_download']}</span>
</div>`);
}
}).fail(function (err) {
console.log(err, version_name);


+ 6
- 0
web_src/js/features/i18nVue.js View File

@@ -101,6 +101,9 @@ export const i18nVue = {
model_wait:"模型加载中",
model_success:"模型加载成功",
model_failed:"模型加载失败",
file_sync_ing:"文件同步中,请稍侯",
file_sync_fail:"文件同步失败",
no_file_to_download:"没有文件可以下载",
},
US: {
computer_vision: "computer vision",
@@ -208,5 +211,8 @@ export const i18nVue = {
model_wait:"Loading",
model_success:"Success",
model_failed:"Failed",
file_sync_ing:"File synchronization in progress, please wait",
file_sync_fail:"File synchronization failed",
no_file_to_download:"No files can be downloaded",
},
};

+ 1
- 0
web_src/js/index.js View File

@@ -60,6 +60,7 @@ Vue.prototype.$Cookies = Cookies;
Vue.prototype.qs = qs;
Vue.prototype.$message = Message;
Vue.prototype.$locale = i18nVue;
window.i18n = i18nVue[document.querySelector('html').getAttribute('lang') == 'zh-CN' ? 'CN' : 'US'];
const { AppSubUrl, StaticUrlPrefix, csrf } = window.config;

Object.defineProperty(Vue.prototype, "$echarts", {


Loading…
Cancel
Save