#4863 #4852 合入

Merged
chenshihai merged 2 commits from zouap_dev into V20231102 5 months ago
  1. +1
    -0
      options/locale/locale_en-US.ini
  2. +1
    -0
      options/locale/locale_zh-CN.ini
  3. +14
    -0
      public/self/dataset_preview.js
  4. +9
    -0
      templates/repo/datasets/dirs/dir_preview.tmpl

+ 1
- 0
options/locale/locale_en-US.ini View File

@@ -869,6 +869,7 @@ file_list=File list
file_not_support_preview=File does not support preview
please_select_file_preview=Please select a file for preview
see_more=See more
query_timeout_tips=The server is processing it. Drink a glass of water and come back to take a look~

show_dataset= Dataset
edit_dataset= Edit Dataset


+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -869,6 +869,7 @@ file_list=文件列表
file_not_support_preview=文件暂不支持预览
please_select_file_preview=请选择文件进行预览
see_more=查看更多
query_timeout_tips=服务器正在处理,喝杯水回来再看看~

reference_dataset_fail=关联数据集失败,请稍后再试。
cancel_reference_dataset_fail=取消关联数据集失败,请稍后再试。


+ 14
- 0
public/self/dataset_preview.js View File

@@ -1,5 +1,6 @@
(function () {
function DatasetPreview() {
this.ajaxTimeOut = 1000 * 60;
this.datasetData = DATASET_DATA;
this.supportImgReg = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i;
this.supportTxtReg = /(\.txt|\.xml|\.html|\.json|\.py|\.sh|\.md|\.csv|\.log|\.js|\.css|\.ipynb)$/i;
@@ -50,6 +51,11 @@
this.getPathChildren();
};

DatasetPreview.prototype.showGetPathChildrenTimeout = function () {
$('#myCanvas_div .tabpannel.ui.form .query-timeout').show();
$('#filelist').hide();
}

DatasetPreview.prototype.getPathChildrenMore = function () {
var self = this;
var lastDir = this.data.filePath[this.data.filePath.length - 1];
@@ -60,6 +66,7 @@
type: "get",
url: `/api/v1/attachments/get_dir`,
dataType: "json",
timeout: this.ajaxTimeOut,
data: {
_csrf: this.datasetData.csrf,
uuid: this.datasetData.uuid,
@@ -94,6 +101,9 @@
error: function (err) {
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
console.log(err);
if (err.statusText == 'timeout') {
self.showGetPathChildrenTimeout();
}
}
});
}
@@ -114,6 +124,7 @@
type: "get",
url: `/api/v1/attachments/get_dir`,
dataType: "json",
timeout: this.ajaxTimeOut,
data: {
_csrf: this.datasetData.csrf,
uuid: this.datasetData.uuid,
@@ -141,6 +152,9 @@
error: function (err) {
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
console.log(err);
if (err.statusText == 'timeout') {
self.showGetPathChildrenTimeout();
}
}
});
}


+ 9
- 0
templates/repo/datasets/dirs/dir_preview.tmpl View File

@@ -50,6 +50,14 @@
#filelist .file-item.active {
color: #0366d6;
}
.query-timeout {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 20px;
text-align: center;
}
</style>

<div id="uuid_div" style="display: none">
@@ -63,6 +71,7 @@
</ul>
<div class="tabpannel ui form" style="max-height:600px;height:calc(100% - 44px);">
<div class="ui list" id="filelist"></div>
<div class="query-timeout" style="display:none;">{{.i18n.Tr "dataset.query_timeout_tips"}}</div>
</div>
<div class="hide tabpannel">
<div style="margin-top: 1em;" id="labellist"></div>


Loading…
Cancel
Save