ofri masad has uploaded a new change for review.

Change subject: webadmin: Change CPU shares default value in UI
......................................................................

webadmin: Change CPU shares default value in UI

Added The 'Disabled' option to the CPU shares selection in the VM popup
view. This value will be the default and will set shares to 0.

Change-Id: I7528724ea20cea3c20b706047991ca193275f990
Signed-off-by: Ofri Masad <oma...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
M 
frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
4 files changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/17718/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
index 870deb8..328acb2 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
@@ -1308,7 +1308,7 @@
         
getCpuSharesAmountSelection().setItems(Arrays.asList(CpuSharesAmount.values()));
         
getCpuSharesAmountSelection().getEntityChangedEvent().addListener(this);
         
getCpuSharesAmountSelection().getSelectedItemChangedEvent().addListener(this);
-        getCpuSharesAmountSelection().setSelectedItem(CpuSharesAmount.MEDIUM);
+        
getCpuSharesAmountSelection().setSelectedItem(CpuSharesAmount.DISABLED);
 
         setIsSoundcardEnabled(new NotChangableForVmInPoolEntityModel());
         getIsSoundcardEnabled().setEntity(false);
@@ -2381,7 +2381,7 @@
     }
 
     public static enum CpuSharesAmount {
-        LOW(512), MEDIUM(1024), HIGH(2048), CUSTOM(-1);
+        DISABLED(0), LOW(512), MEDIUM(1024), HIGH(2048), CUSTOM(-1);
 
         private int value;
         private CpuSharesAmount(int value) {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
index 9ae5c52..3738e61 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
@@ -758,9 +758,11 @@
     public void updateCpuSharesAmountChangeability() {
         boolean changeable =
                 getModel().getCpuSharesAmountSelection().getSelectedItem() == 
UnitVmModel.CpuSharesAmount.CUSTOM;
+        boolean none =
+                getModel().getCpuSharesAmountSelection().getSelectedItem() == 
UnitVmModel.CpuSharesAmount.DISABLED;
         getModel().getCpuSharesAmount().setIsChangable(changeable);
         getModel().getCpuSharesAmount()
-                .setEntity(changeable
+                .setEntity(changeable || none
                         ? "" //$NON-NLS-1$
                         : ((UnitVmModel.CpuSharesAmount) 
getModel().getCpuSharesAmountSelection()
                         .getSelectedItem()).getValue());
@@ -978,7 +980,7 @@
         Frontend.RunQuery(VdcQueryType.GetConsoleDevices, new 
IdQueryParameters(vmId), new AsyncQuery(this, new INewAsyncCallback() {
             @Override
             public void onSuccess(Object model, Object returnValue) {
-                List<String> consoleDevices = (List<String>) 
((VdcQueryReturnValue)returnValue).getReturnValue();
+                List<String> consoleDevices = (List<String>) 
((VdcQueryReturnValue) returnValue).getReturnValue();
                 
getModel().getIsConsoleDeviceEnabled().setEntity(!consoleDevices.isEmpty());
             }
         }));
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
index 30b1275..bd345a4 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
@@ -811,6 +811,8 @@
 
     String AuditLogType___USER_UPDATE_VM_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED();
 
+    String UnitVmModel$CpuSharesAmount___DISABLED();
+
     String UnitVmModel$CpuSharesAmount___HIGH();
 
     String UnitVmModel$CpuSharesAmount___MEDIUM();
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
index 2c264e0..1b7393d 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
+++ 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
@@ -403,6 +403,7 @@
 AuditLogType___USER_ADD_VM_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED=A trusted 
Template was created from non-trusted VM
 AuditLogType___USER_UPDATE_VM_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED=Template 
moved from trusted cluster to non-trusted cluster
 AuditLogType___USER_UPDATE_VM_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED=Template 
moved from non-trusted cluster to trusted cluster
+UnitVmModel$CpuSharesAmount___DISABLED=Disabled
 UnitVmModel$CpuSharesAmount___HIGH=High
 UnitVmModel$CpuSharesAmount___MEDIUM=Medium
 UnitVmModel$CpuSharesAmount___LOW=Low


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7528724ea20cea3c20b706047991ca193275f990
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <oma...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to