[Engine-devel] Got some troubles when I want to modify oVirt GUI

Doron Fediuck dfediuck at redhat.com
Tue Mar 12 14:12:42 UTC 2013



----- Original Message -----
> From: "Itamar Heim" <iheim at redhat.com>
> To: "Vojtech Szocs" <vszocs at redhat.com>
> Cc: engine-devel at ovirt.org
> Sent: Tuesday, March 12, 2013 3:30:57 PM
> Subject: Re: [Engine-devel] Got some troubles when I want to modify oVirt GUI
> 
> On 03/12/2013 12:57 PM, Vojtech Szocs wrote:
> > Hi,
> >
> > first of all, did you consider submitting this as RFE in oVirt
> > bugzilla? Maybe it could be useful to have it in oVirt.
> > (Implementing this via UI plugin would be far too complicated, as
> > UI code is tightly coupled with UiCommon code in case of VM
> > dialog.)>
> 
> my understanding this is a full blown feature, not a plugin.
> 
> Wei D - please note UI is to help the user to not make mistakes, but
> validations must also happen at engine side to cover rest api, etc.
> 

+1.
Also, a detailed wiki page may help both developer and readers
to get a better understanding of how it should look and work.
For example, how do you plan to implement the REST API changes?

Wei D, I know that Gang Wei started:
http://www.ovirt.org/Trusted_compute_pools But as you can see, 
it does not mention your original intention to implement the UI
as a plugin, while as you can see it would be better to have it
as an internal UI addition. Also, as mentioned REST parts are
missing and a more detailed design for the engine is missing here.

Wei D, is there a reason why not top have a detailed page similar
to: http://www.ovirt.org/Features/Watchdog_engine_support ?

> 
> > Regarding UI code changes, the general idea is to implement
> > business logic in UiCommon models (VmListModel, UnitVmModel, etc.)
> > and have UI code bind to these models. It would be best if you
> > just send a patch (diff) instead of specific files, it's really
> > hard to see what changes you made, but based on the files you
> > sent, here are my comments:
> >
> > * Changes in UnitVmModel look good, you basically added two new
> > fields [privateRunVMOnSpecificHost, privateRunVMOnTrustedHost],
> > hooked up their *_EntityChanged methods, and implemented logic for
> > handling field value changes in these methods
> >
> > * Changes in VmListModel look good, you used newly added
> > UnitVmModel fields in onSave [I assume
> > setTrustedHostFlag/setDedicatedVmForVds are new fields for VM
> > entity?], note - you might also want to update
> > UpdateActionAvailability disable migrating VM when
> > RunVMOnTrustedHost=true, etc.
> >
> > * AbstractVmPopupWidget already has specificHost radio button &
> > drop-down on Host dialog tab, and I assume you want to reuse the
> > drop-down (host list) for trustedHost, so just add new radio
> > button there:
> >
> >    AbstractVmPopupWidget.ui.xml line 331
> >
> >    <g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE'>
> >      <g:RadioButton name="specificOrTrustedHostGroup"
> >      ui:field="specificHost"
> >      addStyleNames="{style.radioButtonSpecificHost}" />
> >      <g:RadioButton name="specificOrTrustedHostGroup"
> >      ui:field="trustedHost"
> >      addStyleNames="{style.radioButtonSpecificHost}" />
> >      <g:Label ui:field="specificHostLabel"
> >      text="{constants.specificVmPopup}" />
> >      <e:ListModelListBoxEditor ui:field="defaultHostEditor" />
> >    </g:HorizontalPanel>
> >
> > * In AbstractVmPopupWidget you to bind newly added RadioButton:
> >
> >    @UiField(provided = true)
> >    @Ignore
> >    @WithElementId("trustedHost")
> >    public RadioButton trustedHost;
> >
> >    You create trustedHost widget in constructor, and in
> >    initTabAvailabilityListeners you just add
> >    trustedHost.addValueChangeHandler(...) to have logic when
> >    trustedHost gets selected.
> >
> > Regards,
> > Vojtech
> >
> >
> > ----- Original Message -----
> > From: "Wei D Chen" <wei.d.chen at intel.com>
> > To: engine-devel at ovirt.org
> > Sent: Tuesday, March 12, 2013 9:48:34 AM
> > Subject: [Engine-devel] Got some troubles when I want to modify
> > oVirt GUI
> >
> > Hi,
> >     In order to add new feature to Ovirt, that is user can choose
> >     virtual machine whether on trusted machine or not when it runs
> >     up, we modified the relative files.
> > Our goal is when the user click the trusted button, Run/Migration
> > options are disabled. But unfortunately, we haven’t succeeded in
> > graphic interface.
> > I modified these files, I can’t see Host Tab, can you give me some
> > help? Maybe we need modify more files. We did the following
> > efforts:
> > (1) add a trusted radio button.
> > (2) Modify AbstractVmPopupWidget.ui.xml
> > <g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE'>
> >       <g:RadioButton ui:field="runVMOnTrustedHost"/>
> >       <e:EntityModelRadioButtonEditor width="150px"
> >       ui:field="runVMOnTrustedHostEditor"
> >                    addStyleNames="{style.radioButton}" />
> > </g:HorizontalPanel>
> > (3) Modify AbstractVmPopupWidget.java
> > @UiField(provided = true)
> > @Path(value = "runVMOnTrustedHost.entity")
> >      @WithElementId("runVMOnTrustedHost")
> > public EntityModelRadioButtonEditor runVMOnTrustedHostEditor;
> >
> > initListeners method:
> > object.getIsAutoAssign().getPropertyChangedEvent().addListener(new
> > IEventListener() {
> >              @Override
> >              public void eventRaised(Event ev, Object sender,
> >              EventArgs args) {
> >                  boolean isAutoAssign = (Boolean)
> >                  object.getIsAutoAssign().getEntity();
> >                  boolean runVMOnTrustedHost = (Boolean)
> >                  object.getRunVMOnTrustedHost().getEntity();
> >                  defaultHostEditor.setEnabled(!isAutoAssign &&
> >                  !runVMOnTrustedHost);
> >                  //defaultHostEditor.setEnabled(!isAutoAssign);
> >                  // only this is not bind to the model, so needs to
> >                  listen to the change explicitly
> >                 specificHost.setValue(!isAutoAssign &&
> >                 !runVMOnTrustedHost);
> >                 //specificHost.setValue(!isAutoAssign);
> >              }
> >          });
> > isAutoAssignEditor.addDomHandler(new ClickHandler() {
> >              @Override
> >              public void onClick(ClickEvent event) {
> >                  defaultHostEditor.setEnabled(false);
> >              }
> >          }, ClickEvent.getType());
> >          vm.getIsAutoAssign().getEntityChangedEvent().addListener(new
> >          IEventListener() {
> >              @Override
> >              public void eventRaised(Event ev, Object sender,
> >              EventArgs args) {
> >                  if (!isAutoAssignEditor.asRadioButton().getValue()
> >                  &&
> >                  !runVMOnTrustedHostEditor.asRadioButton().getValue())
> >                  {
> >                      specificHost.setValue(true, true);
> >                  }
> >              }
> >          });
> >          runVMOnTrustedHostEditor.addDomHandler(new ClickHandler()
> >          {
> >              @Override
> >              public void onClick(ClickEvent event) {
> >                  defaultHostEditor.setEnabled(false);
> >              }
> >          }, ClickEvent.getType());
> >          vm.getRunVMOnTrustedHost().getEntityChangedEvent().addListener(new
> >          IEventListener() {
> >              @Override
> >              public void eventRaised(Event ev, Object sender,
> >              EventArgs args) {
> >                  if
> >                  (!runVMOnTrustedHostEditor.asRadioButton().getValue()
> >                  &&
> >                  !isAutoAssignEditor.asRadioButton().getValue())
> >                  {
> >                      specificHost.setValue(true, true);
> >                  }
> >              }
> >          });
> > (4) Modify UnitVmModel.java
> >    private void RunVMOnTrustedHost_EntityChanged(Object sender,
> >    EventArgs args)
> >     {
> >          if ((Boolean) getRunVMOnTrustedHost().getEntity() == true)
> >          {
> >              clearAndDisable(getRunVMOnSpecificHost());
> >              clearAndDisable(getHostCpu());
> >          }
> >          else
> >          {
> >              getRunVMOnSpecificHost().setIsChangable(true);
> >          }
> >          behavior.updateCpuPinningVisibility();
> >   }
> >
> >
> > _______________________________________________
> > Engine-devel mailing list
> > Engine-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/engine-devel
> > _______________________________________________
> > Engine-devel mailing list
> > Engine-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/engine-devel
> >
> 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 



More information about the Devel mailing list