Daniel Erez has posted comments on this change. Change subject: frontend: reduce duplicate code related to run-once capability ......................................................................
Patch Set 9: (2 inline comments) .................................................... File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java Line 711: setWindow(model); Line 712: Line 713: model.init(); Line 714: Line 715: // Display protocols. * Why can't we move lines 716-731 to RunOnce model? It only updates DisplayProtocol's items (vm is now available in the model - needed for setSelectedItem). * Since OnRunOnce method can be moved to RunOnceModel (see comment below), only the cancelCommand creation is needed here (the cancelCommand can be passed to the model instead of the ListModel). Line 716: EntityModel tempVar = new EntityModel(); Line 717: tempVar.setTitle(ConstantsManager.getInstance().getConstants().VNCTitle()); Line 718: tempVar.setEntity(DisplayType.vnc); Line 719: EntityModel vncProtocol = tempVar; Line 739: tempVar4.setIsCancel(true); Line 740: model.getCommands().add(tempVar4); Line 741: } Line 742: Line 743: private void OnRunOnce() * 'selectedItem' is needed just for getting it's entity - the VM (which is already passed to RunOnceModel in the ctr). * this (ListModel) is needed just for calling cancel(). In order to move OnRunOnce method to RunOnceModel, I would simply pass the cancelCommand to RunOnceModel. Then, on RunAction's callback, the cancelCommand could be executed. Line 744: { Line 745: UserPortalItemModel selectedItem = (UserPortalItemModel) getSelectedItem(); Line 746: if (selectedItem == null || selectedItem.getEntity() == null) Line 747: { -- To view, visit http://gerrit.ovirt.org/13207 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6561df71f093e2739e689722ead4f85428c04d06 Gerrit-PatchSet: 9 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches