details: https://code.openbravo.com/erp/devel/pi/rev/2a53c3dbf6a3 changeset: 28080:2a53c3dbf6a3 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue Dec 01 19:25:04 2015 +0100 summary: fixes issue 31634: use refresh button in Alert Management more than once
A new mechanism is created for the grids in Alert Management window which notifies to the view that the data has arrived after a refresh request. The view checks if the refresh has been performed by the four grids before enabling the button again. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js | 6 +++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js | 20 +++++++++- 2 files changed, 25 insertions(+), 1 deletions(-) diffs (62 lines): diff -r 83f6116ba55b -r 2a53c3dbf6a3 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js Tue Dec 01 18:27:51 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js Tue Dec 01 19:25:04 2015 +0100 @@ -37,6 +37,7 @@ showCellContextMenus: true, selectOnEdit: false, dataPageSize: 100, + isRefreshing: false, arrowKeyAction: 'select', @@ -155,6 +156,11 @@ dataArrived: function (startRow, endRow) { this.getGridTotalRows(); + // we notify the data arrival so the view can check if the refresh button can be enabled + if (this.isRefreshing) { + this.isRefreshing = false; + OB.AlertManagement.notifyRefreshEnd(); + } return this.Super('dataArrived', arguments); }, diff -r 83f6116ba55b -r 2a53c3dbf6a3 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js Tue Dec 01 18:27:51 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js Tue Dec 01 19:25:04 2015 +0100 @@ -73,9 +73,11 @@ } }, 'setTranslatedStatus'); + this.refreshButton = isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES); + this.addMember(isc.OBToolbar.create({ view: this, - leftMembers: [isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES)], + leftMembers: [this.refreshButton], rightMembers: [] })); @@ -268,6 +270,22 @@ if (!OB.AlertManagement.sections[alertStatus[i]].expanded) { OB.AlertManagement.grids[alertStatus[i]].getGridTotalRows(); } + if (OB.AlertManagement.grids[alertStatus[i]].isDrawn()) { + OB.AlertManagement.grids[alertStatus[i]].isRefreshing = true; + } + } + }, + + notifyRefreshEnd: function () { + var i, alertStatus = ['New', 'Acknowledged', 'Suppressed', 'Solved']; + for (i = 0; i < 4; i++) { + if (OB.AlertManagement.grids[alertStatus[i]].isRefreshing) { + return; + } + } + if (this.isRefreshing) { + delete this.isRefreshing; + this.refreshButton.setDisabled(false); } } }); ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits