Alexander Wels has posted comments on this change.

Change subject: webadmin,userportal: Synchronize refresh.
......................................................................


Patch Set 1:

(16 comments)

....................................................
File frontend/webadmin/modules/frontend/pom.xml
Line 165:             <phase>generate-sources</phase>
Line 166:             <goals>
Line 167:               <goal>add-source</goal>
Line 168:             </goals>
Line 169:             <configuration>
Done
Line 170:               <sources>
Line 171:                 
<source>${project.build.directory}/${generatedSourcesDirectory}</source>
Line 172:                 
<source>${project.build.directory}/generated-sources/gwt</source>
Line 173:               </sources>


....................................................
File 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/Frontend.java
Line 270:                     }
Line 271:                 } finally {
Line 272:                     raiseQueryCompleteEvent(queryType, 
callback.getContext());
Line 273:                     if (isEventQuery(queryType, parameters) && 
!((List<?>)result.getReturnValue()).isEmpty()) {
Line 274:                         raiseOperationCompleteEvent(operation);
How would one distinguish between the EventListModel generating the call and 
some other model generating the call? From the frontend perspective both are 
identical. This does raise the question will this generate an endless loop of 
refreshes in the case of Hosts/Events sub tab.
Line 275:                     }
Line 276:                 }
Line 277:             }
Line 278: 


Line 623:                 if (callback != null) {
Line 624:                     callback.executed(new 
FrontendMultipleActionAsyncResult(actionType,
Line 625:                             parameters, resultObject, state));
Line 626:                 }
Line 627:                 raiseOperationCompleteEvent(operationList.get(0));
It makes no sense to call this multiple times as all this does is cause the 
active model to refresh. So calling it multiple times will cause the refresh 
multiple times.
Line 628:             }
Line 629: 
Line 630:             @Override
Line 631:             public void onFailure(final 
List<VdcOperation<VdcActionType, VdcActionParametersBase>> operation,


Line 1085:                 && ((SearchParameters) 
parameters).getSearchTypeValue() == SearchType.AuditLog;
Line 1086:     }
Line 1087: 
Line 1088:     private void raiseOperationCompleteEvent(final VdcOperation<?, 
?> operation) {
Line 1089:         VdcOperationCompleteEvent.fire(this, new 
VdcOperationCompleteEvent(operation));
Done
Line 1090:     }
Line 1091: 
Line 1092:     @Override
Line 1093:     public void fireEvent(GwtEvent<?> event) {


....................................................
File 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/communication/VdcOperationComplete.java
Line 3: import com.gwtplatform.dispatch.annotation.GenEvent;
Line 4: import com.gwtplatform.dispatch.annotation.Order;
Line 5: 
Line 6: /**
Line 7:  * Event triggered when a VdcOperationCompletes. The typical use case 
is when a {@code VdcAction} completes
Done
Line 8:  * and needs to inform models to refresh themselves.
Line 9:  */
Line 10: @GenEvent
Line 11: public class VdcOperationComplete {


Line 8:  * and needs to inform models to refresh themselves.
Line 9:  */
Line 10: @GenEvent
Line 11: public class VdcOperationComplete {
Line 12:     @Order(1)
Done
Line 13:     VdcOperation<?, ?> operation;


....................................................
File 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/model/TabModelProvider.java
Line 38
Line 39
Line 40
Line 41
Line 42
Done


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ListModel.java
Line 20: {
Line 21:     /**
Line 22:      * The GWT event bus.
Line 23:      */
Line 24:     private EventBus eventBus;
Because only list models are interested in operation complete events, most 
entities could care less, so I put it at the lowest level that made sense.
Line 25: 
Line 26:     public static EventDefinition selectedItemChangedEventDefinition;
Line 27:     private Event privateSelectedItemChangedEvent;
Line 28: 


Line 371:         this.eventBus = eventBus;
Line 372:     }
Line 373: 
Line 374:     public void unregisterHandlers() {
Line 375: 
Done
Line 376:     }


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
Line 54:     private static Logger logger = 
Logger.getLogger(SearchableListModel.class.getName());
Line 55:     private static final String PAGE_STRING_REGEX = 
"[\\s]+page[\\s]+[1-9]+[0-9]*[\\s]*$"; //$NON-NLS-1$
Line 56:     private static final String PAGE_NUMBER_REGEX = "[1-9]+[0-9]*$"; 
//$NON-NLS-1$
Line 57: 
Line 58:     private HandlerRegistration operationCompleteHandlerRegistration;
Done
Line 59: 
Line 60:     private UICommand privateSearchCommand;
Line 61: 
Line 62:     public UICommand getSearchCommand()


Line 388:                 setIsQueryFirstTime(true);
Line 389:                 syncSearch();
Line 390:                 setIsQueryFirstTime(false);
Line 391:                 getTimer().start();
Line 392:                 if (getEventBus() != null) {
Since I didn't hook up all the models with an event bus it is perfectly 
possible for a SearchableListModel not to have an event bus. Therefore I must 
check if the event bus is not null before setting the handler.
Line 393:                     //Make sure to unregister any existing handler, 
before adding a new one.
Line 394:                     unregisterOperationCompleteHandler();
Line 395:                     //Register to listen for operation complete 
events.
Line 396:                     operationCompleteHandlerRegistration = 
getEventBus().addHandler(VdcOperationCompleteEvent.getType(),


Line 390:                 setIsQueryFirstTime(false);
Line 391:                 getTimer().start();
Line 392:                 if (getEventBus() != null) {
Line 393:                     //Make sure to unregister any existing handler, 
before adding a new one.
Line 394:                     unregisterOperationCompleteHandler();
Done
Line 395:                     //Register to listen for operation complete 
events.
Line 396:                     operationCompleteHandlerRegistration = 
getEventBus().addHandler(VdcOperationCompleteEvent.getType(),
Line 397:                             new VdcOperationCompleteHandler() {
Line 398:                         @Override


Line 392:                 if (getEventBus() != null) {
Line 393:                     //Make sure to unregister any existing handler, 
before adding a new one.
Line 394:                     unregisterOperationCompleteHandler();
Line 395:                     //Register to listen for operation complete 
events.
Line 396:                     operationCompleteHandlerRegistration = 
getEventBus().addHandler(VdcOperationCompleteEvent.getType(),
Done
Line 397:                             new VdcOperationCompleteHandler() {
Line 398:                         @Override
Line 399:                         public void 
onVdcOperationComplete(VdcOperationCompleteEvent event) {
Line 400:                             //This is an operation this model is 
interested in, refresh.


Line 790: 
Line 791:     public void stopRefresh()
Line 792:     {
Line 793:         getTimer().stop();
Line 794:         unregisterOperationCompleteHandler();
Done
Line 795:     }
Line 796: 
Line 797:     @Override
Line 798:     public void unregisterHandlers() {


Line 795:     }
Line 796: 
Line 797:     @Override
Line 798:     public void unregisterHandlers() {
Line 799:         unregisterOperationCompleteHandler();
Done
Line 800:     }
Line 801: 
Line 802:     private void unregisterOperationCompleteHandler() {
Line 803:         if (operationCompleteHandlerRegistration != null) {


Line 798:     public void unregisterHandlers() {
Line 799:         unregisterOperationCompleteHandler();
Line 800:     }
Line 801: 
Line 802:     private void unregisterOperationCompleteHandler() {
Done
Line 803:         if (operationCompleteHandlerRegistration != null) {
Line 804:             operationCompleteHandlerRegistration.removeHandler();
Line 805:         }
Line 806:     }


-- 
To view, visit http://gerrit.ovirt.org/21057
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa59712f8f74426b0ca6a132664167f42fb8d7b2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Einav Cohen <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to