Alona Kaplan has uploaded a new change for review. Change subject: webadmin: Add "Link State" to VM Interface dialog. ......................................................................
webadmin: Add "Link State" to VM Interface dialog. Change-Id: I65601980469d5215e2884bf43be7f10884c4386f Signed-off-by: Alona Kaplan <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationResources.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml A frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_linked.png A frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_unlinked.png M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java 8 files changed, 168 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/9449/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index 47c2742..a6c9d46 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -736,6 +736,15 @@ @DefaultStringValue("Unplugged") String unpluggedNetworkIntefacePopup(); + @DefaultStringValue("Link State") + String linkStateNetworkIntefacePopup(); + + @DefaultStringValue("Up") + String linkedNetworkIntefacePopup(); + + @DefaultStringValue("Down") + String unlinkedNetworkIntefacePopup(); + // Pool popup @DefaultStringValue("Do not migrate VM") String dontMigrageVmPoolPopup(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationResources.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationResources.java index 2af2b56..d273201 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationResources.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationResources.java @@ -206,4 +206,10 @@ @Source("images/network/icn_un_plugged.png") ImageResource unpluggedNetworkImage(); + @Source("images/network/icn_network_linked.png") + ImageResource linkedNetworkImage(); + + @Source("images/network/icn_network_unlinked.png") + ImageResource unlinkedNetworkImage(); + } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java index 5d184ce..373e66c 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.java @@ -53,6 +53,10 @@ String cardStatusEditorContent(); String cardStatusRadioContent(); + + String linkStateEditorContent(); + + String linkStateRadioContent(); } @UiField @@ -111,6 +115,21 @@ @Path(value = "unplugged_IsSelected.entity") public EntityModelRadioButtonEditor unpluggedEditor; + @UiField + protected HorizontalPanel linkStateSelectionPanel; + + @UiField + @Ignore + public ListModelListBoxEditor<Object> linkStateEditor; + + @UiField(provided = true) + @Path(value = "linked_IsSelected.entity") + public EntityModelRadioButtonEditor linkedEditor; + + @UiField(provided = true) + @Path(value = "unlinked_IsSelected.entity") + public EntityModelRadioButtonEditor unlinkedEditor; + public static CommonApplicationTemplates templates = GWT.create(CommonApplicationTemplates.class); public static CommonApplicationResources resources = GWT.create(CommonApplicationResources.class); @@ -148,6 +167,16 @@ .setHTML(templates.imageTextCardStatus(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.unpluggedNetworkImage()) .getHTML()), constants.unpluggedNetworkIntefacePopup())); + + linkStateEditor.setLabel(constants.linkStateNetworkIntefacePopup()); + linkedEditor.asRadioButton() + .setHTML(templates.imageTextCardStatus(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.linkedNetworkImage()) + .getHTML()), + constants.linkedNetworkIntefacePopup())); + unlinkedEditor.asRadioButton() + .setHTML(templates.imageTextCardStatus(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.unlinkedNetworkImage()) + .getHTML()), + constants.unlinkedNetworkIntefacePopup())); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -163,6 +192,9 @@ pluggedEditor = new EntityModelRadioButtonEditor("cardStatus"); //$NON-NLS-1$ unpluggedEditor = new EntityModelRadioButtonEditor("cardStatus"); //$NON-NLS-1$ + + linkedEditor = new EntityModelRadioButtonEditor("linkState"); //$NON-NLS-1$ + unlinkedEditor = new EntityModelRadioButtonEditor("linkState"); //$NON-NLS-1$ } @Override @@ -193,6 +225,18 @@ cardStatusSelectionPanel.setVisible(isCardStatusAvailable); } }); + + iface.getLinked().getPropertyChangedEvent().addListener(new IEventListener() { + @Override + public void eventRaised(Event ev, Object sender, EventArgs args) { + boolean isLinkStateChangable = iface.getLinked().getIsChangable(); + linkedEditor.setEnabled(isLinkStateChangable); + unlinkedEditor.setEnabled(isLinkStateChangable); + + boolean isLinkStateAvailable = iface.getLinked().getIsAvailable(); + linkStateSelectionPanel.setVisible(isLinkStateAvailable); + } + }); } private void hideMacWhenNotEnabled(VmInterfaceModel iface) { @@ -213,5 +257,9 @@ cardStatusEditor.addContentWidgetStyleName(style.cardStatusEditorContent()); pluggedEditor.addContentWidgetStyleName(style.cardStatusRadioContent()); unpluggedEditor.addContentWidgetStyleName(style.cardStatusRadioContent()); + + linkStateEditor.addContentWidgetStyleName(style.linkStateEditorContent()); + linkedEditor.addContentWidgetStyleName(style.linkStateRadioContent()); + unlinkedEditor.addContentWidgetStyleName(style.linkStateRadioContent()); } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml index c64fed0..556aae5 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/networkinterface/NetworkInterfacePopupWidget.ui.xml @@ -24,6 +24,19 @@ padding-top: 3px; width: 100%; } + + .linkStateEditor { + padding-right: 14px; + } + + .linkStateEditorContent { + display: none; + } + + .linkStateRadioContent { + padding-top: 3px; + width: 100%; + } .expanderContent { padding-left: 10px; @@ -39,6 +52,11 @@ <g:FlowPanel> <e:EntityModelTextBoxEditor ui:field="nameEditor" /> <e:ListModelListBoxEditor ui:field="networkEditor" /> + <g:HorizontalPanel ui:field="linkStateSelectionPanel"> + <e:ListModelListBoxEditor ui:field="linkStateEditor" addStyleNames="{style.linkStateEditor}" /> + <e:EntityModelRadioButtonEditor ui:field="linkedEditor"/> + <e:EntityModelRadioButtonEditor ui:field="unlinkedEditor"/> + </g:HorizontalPanel> <e:ListModelListBoxEditor ui:field="nicTypeEditor" /> <g:HorizontalPanel> <g:CheckBox ui:field="enableManualMacCheckbox" diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_linked.png b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_linked.png new file mode 100644 index 0000000..a3a1caf --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_linked.png Binary files differ diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_unlinked.png b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_unlinked.png new file mode 100644 index 0000000..baa5958 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/images/network/icn_network_unlinked.png Binary files differ diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java index 5da95cc..af34fd1 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java @@ -42,6 +42,8 @@ private boolean isHotPlugSupported; + private boolean isLinkStateChangeable; + private UICommand privateNewCommand; public UICommand getNewCommand() @@ -177,6 +179,12 @@ model.getPlugged().setIsChangable(isHotPlugSupported); model.getPlugged().setEntity(true); + if (isLinkStateChangeable) { + model.getLinked().setEntity(true); + } else { + model.getLinked().setIsAvailable(false); + } + Version v31 = new Version(3, 1); boolean isLessThan31 = vm.getvds_group_compatibility_version().compareTo(v31) < 0; @@ -272,6 +280,12 @@ model.getMAC().setEntity(nic.getMacAddress()); model.getPlugged().setIsAvailable(false); + if (isLinkStateChangeable) { + model.getLinked().setEntity(nic.isLinked()); + } else { + model.getLinked().setIsAvailable(false); + } + Version v31 = new Version(3, 1); boolean isLessThan31 = vm.getvds_group_compatibility_version().compareTo(v31) < 0; @@ -352,6 +366,7 @@ nic.setName((String) model.getName().getEntity()); nic.setNetworkName(((Network) model.getNetwork().getSelectedItem()).getname()); nic.setPortMirroring((Boolean) model.getPortMirroring().getEntity()); + nic.setLinked(false); if (model.getNicType().getSelectedItem() == null) { nic.setType(null); @@ -367,6 +382,8 @@ { nic.setActive((Boolean) model.getPlugged().getEntity()); } + + nic.setLinked((Boolean) model.getLinked().getEntity()); model.StartProgress(null); @@ -569,7 +586,7 @@ UpdateActionAvailability(); } - protected void updateIsHotPlugAvailable() + protected void updateConfigValues() { if (getEntity() == null) { @@ -582,11 +599,15 @@ isHotPlugSupported = (Boolean) AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.HotPlugEnabled, clusterCompatibilityVersion.toString()); + + isLinkStateChangeable = + (Boolean) AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.LinkStateChangeable, + clusterCompatibilityVersion.toString()); } @Override public void setEntity(Object value) { super.setEntity(value); - updateIsHotPlugAvailable(); + updateConfigValues(); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java index cf9070a..97f0637 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java @@ -52,6 +52,42 @@ privateNetwork = value; } + private EntityModel linked; + + public EntityModel getLinked() + { + return linked; + } + + private void setLinked(EntityModel value) + { + linked = value; + } + + private EntityModel linked_IsSelected; + + public EntityModel getLinked_IsSelected() + { + return linked_IsSelected; + } + + public void setLinked_IsSelected(EntityModel value) + { + linked_IsSelected = value; + } + + private EntityModel unlinked_IsSelected; + + public EntityModel getUnlinked_IsSelected() + { + return unlinked_IsSelected; + } + + public void setUnlinked_IsSelected(EntityModel value) + { + unlinked_IsSelected = value; + } + private ListModel privateNicType; public ListModel getNicType() @@ -141,6 +177,15 @@ setUnplugged_IsSelected(new EntityModel()); getUnplugged_IsSelected().getEntityChangedEvent().addListener(this); + + setLinked(new EntityModel()); + getLinked().getEntityChangedEvent().addListener(this); + + setLinked_IsSelected(new EntityModel()); + getLinked_IsSelected().getEntityChangedEvent().addListener(this); + + setUnlinked_IsSelected(new EntityModel()); + getUnlinked_IsSelected().getEntityChangedEvent().addListener(this); } @Override @@ -171,6 +216,25 @@ getPlugged().setEntity(false); } } + + else if (sender == getLinked()) + { + boolean linked = (Boolean) getLinked().getEntity(); + getLinked_IsSelected().setEntity(linked); + getUnlinked_IsSelected().setEntity(!linked); + } + else if (sender == getLinked_IsSelected()) + { + if ((Boolean) getLinked_IsSelected().getEntity()) { + getLinked().setEntity(true); + } + } + else if (sender == getUnlinked_IsSelected()) + { + if ((Boolean) getUnlinked_IsSelected().getEntity()) { + getLinked().setEntity(false); + } + } } private void MAC_PropertyChanged(PropertyChangedEventArgs e) -- To view, visit http://gerrit.ovirt.org/9449 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I65601980469d5215e2884bf43be7f10884c4386f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
