Merged in feature/PMC-758-A (pull request #6897)

PMC-760: Advanced Search Loader UI

Approved-by: Rodrigo Quelca <rockoinfo@yahoo.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2019-05-16 17:54:34 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 129 additions and 22 deletions

View File

@@ -23159,6 +23159,36 @@ msgstr "Username"
msgid "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
# 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_USER','en','Username','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_SECONDS','en','Seconds','2014-01-15') ,
( 'LABEL','ID_SECOND_FIGURE','en','Second Graph','2015-03-09') ,

View File

@@ -25,6 +25,9 @@ var textJump;
var ids = '';
var winReassignInCasesList;
var casesNewTab;
var mask;
var loadingMessage;
var timeoutMark = false;
function formatAMPM(date, initVal, calendarDate) {
@@ -855,25 +858,30 @@ Ext.onReady ( function() {
this.setBaseParam(
"openApplicationUid", (__OPEN_APPLICATION_UID__ !== null)? __OPEN_APPLICATION_UID__ : ""
);
timeoutMark = false;
},
load: function(response){
if (response.reader.jsonData.result === false) {
PMExt.notify('ERROR', response.reader.jsonData.message);
//PMExt.error
if (action === "search" && loadingMessage) {
loadingMessage.hide();
timeoutMark = true;
}
},
exception: function(dp, type, action, options, response, arg) {
responseObject = Ext.util.JSON.decode(response.responseText);
if (typeof(responseObject.error) != 'undefined') {
Ext.Msg.show({
title: _('ID_ERROR'),
msg: responseObject.error,
fn: function(){parent.parent.location = '../login/login';},
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
exception: function(dp, type, action, options, response, arg) {
if (response && typeof (response.status) !== 'undefined') {
showErrorMessage(response.status);
timeoutMark = true;
} else {
responseObject = Ext.util.JSON.decode(response.responseText);
if (typeof(responseObject.error) !== 'undefined') {
Ext.Msg.show({
title: _('ID_ERROR'),
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(){
storeCases.setBaseParam('process', '');
suggestProcess.setValue('');
doSearch();
}
};
@@ -1323,7 +1330,6 @@ Ext.onReady ( function() {
storeCases.setBaseParam( 'user', filterUser);
storeCases.setBaseParam( 'start', 0);
storeCases.setBaseParam( 'limit', pageSize);
doSearch();
}
}
});
@@ -1348,6 +1354,72 @@ Ext.onReady ( function() {
//cls: 'x-form-toolbar-standardButton',
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(){
//var viewText = Ext.getCmp('casesGrid').getView();
@@ -1359,14 +1431,16 @@ Ext.onReady ( function() {
storeCases.setBaseParam('dateTo', dateTo.getValue());
storeCases.setBaseParam( 'search', searchText);
storeCases.load({params:{ start : 0 , limit : pageSize }});
}
if ( action === 'search' ){
showLoadingDialog();
}
};
var resetSearchButton = {
text:'X',
ctCls:"pm_search_x_button_des",
handler: function(){
textSearch.setValue('');
doSearch();
}
}
@@ -1376,7 +1450,6 @@ Ext.onReady ( function() {
handler: function(){
suggestUser.setValue('');
storeCases.setBaseParam('user', '');
doSearch();
}
}
@@ -2219,7 +2292,7 @@ Ext.onReady ( function() {
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
grid = new Ext.grid.GridPanel({
region: 'center',
@@ -2227,7 +2300,6 @@ Ext.onReady ( function() {
store: storeCases,
cm: cm,
loadMask: mask,
sm: new Ext.grid.RowSelectionModel({
selectSingle: false,
listeners:{