@@ -1,5 +1,6 @@
(function () {
(function () {
function DatasetPreview() {
function DatasetPreview() {
this.ajaxTimeOut = 1000 * 60;
this.datasetData = DATASET_DATA;
this.datasetData = DATASET_DATA;
this.supportImgReg = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i;
this.supportImgReg = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i;
this.supportTxtReg = /(\.txt|\.xml|\.html|\.json|\.py|\.sh|\.md|\.csv|\.log|\.js|\.css|\.ipynb)$/i;
this.supportTxtReg = /(\.txt|\.xml|\.html|\.json|\.py|\.sh|\.md|\.csv|\.log|\.js|\.css|\.ipynb)$/i;
@@ -50,6 +51,11 @@
this.getPathChildren();
this.getPathChildren();
};
};
DatasetPreview.prototype.showGetPathChildrenTimeout = function () {
$('#myCanvas_div .tabpannel.ui.form .query-timeout').show();
$('#filelist').hide();
}
DatasetPreview.prototype.getPathChildrenMore = function () {
DatasetPreview.prototype.getPathChildrenMore = function () {
var self = this;
var self = this;
var lastDir = this.data.filePath[this.data.filePath.length - 1];
var lastDir = this.data.filePath[this.data.filePath.length - 1];
@@ -60,6 +66,7 @@
type: "get",
type: "get",
url: `/api/v1/attachments/get_dir`,
url: `/api/v1/attachments/get_dir`,
dataType: "json",
dataType: "json",
timeout: this.ajaxTimeOut,
data: {
data: {
_csrf: this.datasetData.csrf,
_csrf: this.datasetData.csrf,
uuid: this.datasetData.uuid,
uuid: this.datasetData.uuid,
@@ -94,6 +101,9 @@
error: function (err) {
error: function (err) {
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
console.log(err);
console.log(err);
if (err.statusText == 'timeout') {
self.showGetPathChildrenTimeout();
}
}
}
});
});
}
}
@@ -114,6 +124,7 @@
type: "get",
type: "get",
url: `/api/v1/attachments/get_dir`,
url: `/api/v1/attachments/get_dir`,
dataType: "json",
dataType: "json",
timeout: this.ajaxTimeOut,
data: {
data: {
_csrf: this.datasetData.csrf,
_csrf: this.datasetData.csrf,
uuid: this.datasetData.uuid,
uuid: this.datasetData.uuid,
@@ -141,6 +152,9 @@
error: function (err) {
error: function (err) {
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
$('#myCanvas_div .tabpannel.ui.form').removeClass('loading');
console.log(err);
console.log(err);
if (err.statusText == 'timeout') {
self.showGetPathChildrenTimeout();
}
}
}
});
});
}
}