Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ehr/resources/web/ehr/panel/DataEntryPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Ext4.define('EHR.panel.DataEntryPanel', {
}, this);
}
}

// Show the indicator here rather than relying solely on 'validationstart', which only fires when the in-flight
// request count transitions 0 -> 1. That transition can happen during initial load (where the indicator is
// suppressed) and won't fire again for validations queued behind those requests, leaving the buttons disabled
// with no indicator. Initial-load validation doesn't fire 'beforevalidation', so this stays quiet during load.
this.onValidationStart();
},

onValidationStart: function(){
Expand Down Expand Up @@ -148,6 +154,11 @@ Ext4.define('EHR.panel.DataEntryPanel', {
return;
}

// A validate cycle can send no requests (nothing produced commands), in which case 'validationcomplete' never
// fires. Clear the indicator whenever buttons are recalculated with no requests in flight.
this.validationInProgress = false;
this.setValidationIndicatorVisible(false);

var maxSeverity = sc.getMaxErrorSeverity();

if(EHR.debug && maxSeverity)
Expand Down Expand Up @@ -368,6 +379,16 @@ Ext4.define('EHR.panel.DataEntryPanel', {

this.add(toAdd);
this.hasStoreCollectionLoaded = true;

// Load-time validation requests start before the form renders, so 'validationstart' has already fired (and
// was suppressed) and 'beforevalidation' never fires for them. If they are still in flight once the form is
// visible, show the indicator directly; 'validationcomplete' will hide it when they drain.
// Ext4.defer(function(){
// if (this.storeCollection && this.storeCollection.validationRequestsInFlight > 0){
// this.validationInProgress = true;
// this.setValidationIndicatorVisible(true);
// }
// }, this.storeCollection.clientDataChangeBuffer * 2, this);
},

updateMinWidth: function(minWidth){
Expand Down