PMC-760: Advanced Search Loader UI

fix CR notes

fix code style

bad equal

fix the error handling

remove catch error line

fix time out

solve conflicts

solve conflicts

PMC-760: Advanced Search Loader UI

fix CR notes

fix code style

bad equal

fix the error handling

remove catch error line

fix time out

solve conflicts with be
This commit is contained in:
Rodrigo Quelca
2019-05-03 14:26:28 -04:00
committed by Paula Quispe
parent a6df306166
commit 817c7836a0
3 changed files with 129 additions and 22 deletions

View File

@@ -23159,6 +23159,36 @@ msgstr "Username"
msgid "Search XML metadata" msgid "Search XML metadata"
msgstr "Search XML metadata" msgstr "Search XML metadata"
# TRANSLATION
# LABEL/ID_SEARCHING
#: LABEL/ID_SEARCHING
msgid "Searching..."
msgstr "Searching..."
# TRANSLATION
# LABEL/ID_SEARCHING_CANCEL_MESSAGE
#: LABEL/ID_SEARCHING_CANCEL_MESSAGE
msgid "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
msgstr "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
# TRANSLATION
# LABEL/ID_SEARCHING_TIME_OUT
#: LABEL/ID_SEARCHING_TIME_OUT
msgid "Your search timed out"
msgstr "Your search timed out"
# TRANSLATION
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR
msgid "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
msgstr "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
# TRANSLATION
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
msgid "An unexpected error occurred while searching for your results. Please contact your administrator."
msgstr "An unexpected error occurred while searching for your results. Please contact your administrator."
# TRANSLATION # TRANSLATION
# LABEL/ID_SECOND # LABEL/ID_SECOND
#: LABEL/ID_SECOND #: LABEL/ID_SECOND

View File

@@ -60747,6 +60747,11 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SEARCH_RESULT','en','Search results','2014-01-15') , ( 'LABEL','ID_SEARCH_RESULT','en','Search results','2014-01-15') ,
( 'LABEL','ID_SEARCH_USER','en','Username','2014-01-15') , ( 'LABEL','ID_SEARCH_USER','en','Username','2014-01-15') ,
( 'LABEL','ID_SEARCH_XML_METADATA','en','Search XML metadata','2014-01-15') , ( 'LABEL','ID_SEARCH_XML_METADATA','en','Search XML metadata','2014-01-15') ,
( 'LABEL','ID_SEARCHING','en','Searching...','2019-05-03') ,
( 'LABEL','ID_SEARCHING_CANCEL_MESSAGE','en','We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time','2019-05-03') ,
( 'LABEL','ID_SEARCHING_TIME_OUT','en','Your search timed out','2019-05-03') ,
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR','en','An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator.','2019-05-03') ,
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT','en','An unexpected error occurred while searching for your results. Please contact your administrator.','2019-05-15') ,
( 'LABEL','ID_SECOND','en','Second','2014-01-15') , ( 'LABEL','ID_SECOND','en','Second','2014-01-15') ,
( 'LABEL','ID_SECONDS','en','Seconds','2014-01-15') , ( 'LABEL','ID_SECONDS','en','Seconds','2014-01-15') ,
( 'LABEL','ID_SECOND_FIGURE','en','Second Graph','2015-03-09') , ( 'LABEL','ID_SECOND_FIGURE','en','Second Graph','2015-03-09') ,

View File

@@ -25,6 +25,9 @@ var textJump;
var ids = ''; var ids = '';
var winReassignInCasesList; var winReassignInCasesList;
var casesNewTab; var casesNewTab;
var mask;
var loadingMessage;
var timeoutMark = false;
function formatAMPM(date, initVal, calendarDate) { function formatAMPM(date, initVal, calendarDate) {
@@ -855,25 +858,30 @@ Ext.onReady ( function() {
this.setBaseParam( this.setBaseParam(
"openApplicationUid", (__OPEN_APPLICATION_UID__ !== null)? __OPEN_APPLICATION_UID__ : "" "openApplicationUid", (__OPEN_APPLICATION_UID__ !== null)? __OPEN_APPLICATION_UID__ : ""
); );
timeoutMark = false;
}, },
load: function(response){ load: function(response){
if (action === "search" && loadingMessage) {
if (response.reader.jsonData.result === false) { loadingMessage.hide();
PMExt.notify('ERROR', response.reader.jsonData.message); timeoutMark = true;
//PMExt.error
} }
}, },
exception: function(dp, type, action, options, response, arg) { exception: function(dp, type, action, options, response, arg) {
responseObject = Ext.util.JSON.decode(response.responseText); if (response && typeof (response.status) !== 'undefined') {
if (typeof(responseObject.error) != 'undefined') { showErrorMessage(response.status);
Ext.Msg.show({ timeoutMark = true;
title: _('ID_ERROR'), } else {
msg: responseObject.error, responseObject = Ext.util.JSON.decode(response.responseText);
fn: function(){parent.parent.location = '../login/login';}, if (typeof(responseObject.error) !== 'undefined') {
animEl: 'elId', Ext.Msg.show({
icon: Ext.MessageBox.ERROR, title: _('ID_ERROR'),
buttons: Ext.MessageBox.OK msg: responseObject.error,
}); fn: function(){parent.parent.location = '../login/login';},
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
}
} }
} }
} }
@@ -1064,7 +1072,6 @@ Ext.onReady ( function() {
handler: function(){ handler: function(){
storeCases.setBaseParam('process', ''); storeCases.setBaseParam('process', '');
suggestProcess.setValue(''); suggestProcess.setValue('');
doSearch();
} }
}; };
@@ -1323,7 +1330,6 @@ Ext.onReady ( function() {
storeCases.setBaseParam( 'user', filterUser); storeCases.setBaseParam( 'user', filterUser);
storeCases.setBaseParam( 'start', 0); storeCases.setBaseParam( 'start', 0);
storeCases.setBaseParam( 'limit', pageSize); storeCases.setBaseParam( 'limit', pageSize);
doSearch();
} }
} }
}); });
@@ -1348,6 +1354,72 @@ Ext.onReady ( function() {
//cls: 'x-form-toolbar-standardButton', //cls: 'x-form-toolbar-standardButton',
handler: doSearch handler: doSearch
}); });
/**
* Show loading Dialog
*/
function showLoadingDialog() {
mask.hide();
var commonSettings = {
title: _('ID_SEARCHING'),
width: 700,
wait: true,
waitConfig: {interval:200}
};
loadingMessage = Ext.Msg.show(commonSettings);
setTimeout(
function() {
if (!timeoutMark) {
loadingMessage.hide();
commonSettings['msg'] = _('ID_SEARCHING_CANCEL_MESSAGE'),
commonSettings['buttons'] = Ext.Msg.CANCEL,
commonSettings['fn'] = function (btn, text) {
if (btn === 'cancel') {
proxyCasesList.getConnection().abort();
};
}
loadingMessage = Ext.Msg.show(commonSettings);
timeoutMark = false;
}
}, 2000);
};
/**
* Show the error code.
* @param {*} errorCode
*/
function showErrorMessage(errorCode) {
var message;
switch (errorCode) {
case 408:
case 504:
message = _('ID_SEARCHING_TIME_OUT');
break;
case 0:
case -1:
message = _('ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT');
break;
default:
message = _('ID_SEARCHING_UNEXPECTED_ERROR', [errorCode]);
}
Ext.Msg.show({
title:_('ID_ERROR'),
msg: message,
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
};
function showTimeoutMessage() {
Ext.Msg.show({
title:_('ID_ERROR'),
msg: _('ID_SEARCHING_TIME_OUT'),
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
};
function doSearch(){ function doSearch(){
//var viewText = Ext.getCmp('casesGrid').getView(); //var viewText = Ext.getCmp('casesGrid').getView();
@@ -1359,14 +1431,16 @@ Ext.onReady ( function() {
storeCases.setBaseParam('dateTo', dateTo.getValue()); storeCases.setBaseParam('dateTo', dateTo.getValue());
storeCases.setBaseParam( 'search', searchText); storeCases.setBaseParam( 'search', searchText);
storeCases.load({params:{ start : 0 , limit : pageSize }}); storeCases.load({params:{ start : 0 , limit : pageSize }});
} if ( action === 'search' ){
showLoadingDialog();
}
};
var resetSearchButton = { var resetSearchButton = {
text:'X', text:'X',
ctCls:"pm_search_x_button_des", ctCls:"pm_search_x_button_des",
handler: function(){ handler: function(){
textSearch.setValue(''); textSearch.setValue('');
doSearch();
} }
} }
@@ -1376,7 +1450,6 @@ Ext.onReady ( function() {
handler: function(){ handler: function(){
suggestUser.setValue(''); suggestUser.setValue('');
storeCases.setBaseParam('user', ''); storeCases.setBaseParam('user', '');
doSearch();
} }
} }
@@ -2219,7 +2292,7 @@ Ext.onReady ( function() {
emptyMsg: _('ID_DISPLAY_EMPTY') emptyMsg: _('ID_DISPLAY_EMPTY')
}) })
} }
var mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')}); mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')});
// create the editor grid // create the editor grid
grid = new Ext.grid.GridPanel({ grid = new Ext.grid.GridPanel({
region: 'center', region: 'center',
@@ -2227,7 +2300,6 @@ Ext.onReady ( function() {
store: storeCases, store: storeCases,
cm: cm, cm: cm,
loadMask: mask, loadMask: mask,
sm: new Ext.grid.RowSelectionModel({ sm: new Ext.grid.RowSelectionModel({
selectSingle: false, selectSingle: false,
listeners:{ listeners:{