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