feat: API化に伴い、エラーハンドリングを修正
This commit is contained in:
parent
a9a968312c
commit
d64be94d8d
@ -225,7 +225,7 @@
|
||||
success: function(data) {
|
||||
try {
|
||||
if (data.status === 'batch_processing') {
|
||||
location.href='/logout/?reason=batchProcessing';
|
||||
location.href='/logout/?reason=batch_processing';
|
||||
return
|
||||
}
|
||||
|
||||
@ -290,15 +290,16 @@
|
||||
}
|
||||
console.log(bioHiddenForm[elem.name].value)
|
||||
}
|
||||
// <! --ページネーションの作成-- >
|
||||
|
||||
// 生物由来データの検索&ページネーションの作成
|
||||
function searchBioList() {
|
||||
const messageArea = $('#message_area')
|
||||
messageArea.text('')
|
||||
const loading = new Loading();
|
||||
messageArea.hide()
|
||||
const loading = new Loading()
|
||||
const searchParams = createSearchParams()
|
||||
$('.pagination').pagination({
|
||||
dataSource: '/bio/BioSearchListAjax',
|
||||
dataSource: '/bio/search',
|
||||
locator: 'data',
|
||||
totalNumberLocator: function(response) {
|
||||
// you can return totalNumber by analyzing response content
|
||||
@ -321,14 +322,32 @@
|
||||
}
|
||||
},
|
||||
formatAjaxError: function(jqXHR, textStatus, errorThrown) {
|
||||
loading.stop();
|
||||
$(`#ErrorModal_Unexpected`).modal('toggle');
|
||||
loading.stop()
|
||||
const responseJson = jqXHR.responseJSON
|
||||
|
||||
if (!responseJson) {
|
||||
$(`#ErrorModal_Unexpected`).modal('toggle')
|
||||
return
|
||||
}
|
||||
|
||||
const status = responseJson?.status
|
||||
if (status === 'batch_processing') {
|
||||
location.href='/logout/?reason=batch_processing';
|
||||
return
|
||||
}
|
||||
|
||||
if (status === 'session_expired') {
|
||||
location.href='/logout/?reason=session_expired';
|
||||
return
|
||||
}
|
||||
|
||||
},
|
||||
callback: function(data, pagination) {
|
||||
$('#result_data').html('')
|
||||
if (pagination.totalNumber === 0) {
|
||||
loading.stop();
|
||||
loading.stop()
|
||||
messageArea.text('対象のデータが存在しません')
|
||||
messageArea.show()
|
||||
$('.pagination').pagination('hide')
|
||||
$('#outExcel').attr('disabled', 'disabled')
|
||||
$('#outCSV').attr('disabled', 'disabled')
|
||||
@ -336,16 +355,18 @@
|
||||
}
|
||||
|
||||
if (pagination.totalNumber > bioDataOverflowMaxLength()) {
|
||||
loading.stop();
|
||||
loading.stop()
|
||||
messageArea.text('検索結果が最大件数を超えました。検索条件を見直しして下さい。')
|
||||
messageArea.show()
|
||||
$('.pagination').pagination('hide')
|
||||
$('#outExcel').attr('disabled', 'disabled')
|
||||
$('#outCSV').attr('disabled', 'disabled')
|
||||
return
|
||||
}
|
||||
messageArea.hide()
|
||||
$('.pagination').pagination('show')
|
||||
$('#result_data').html(pagination_content(data))
|
||||
loading.stop();
|
||||
loading.stop()
|
||||
$('#outExcel').removeAttr('disabled')
|
||||
$('#outCSV').removeAttr('disabled')
|
||||
$('.paginationjs-pages > ul > li').not('.disabled,.active').each(function(index, val) {
|
||||
@ -362,8 +383,8 @@
|
||||
})
|
||||
})
|
||||
// ページ送りしたときにヘッダがずれるのを修正
|
||||
FixedMidashi.remove();
|
||||
FixedMidashi.create();
|
||||
FixedMidashi.remove()
|
||||
FixedMidashi.create()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user