Kanagaraj M has uploaded a new change for review. Change subject: webadmin: Refactoring Cluster General tab models ......................................................................
webadmin: Refactoring Cluster General tab models The cluster general tab is currently used to show volume information which is not related to cluster policy. So a new ClusterGeneralModel is introduced, it will be used by the Cluster General View and the necessary code refactoring has been done. Change-Id: I9d9271f34820627333c9eb7f38d1406b01b7d156 Signed-off-by: Kanagaraj M <[email protected]> --- A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterPolicyModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/cluster/SubTabClusterGeneralPresenter.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java 7 files changed, 293 insertions(+), 300 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/7530/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java new file mode 100644 index 0000000..f0555b8 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java @@ -0,0 +1,264 @@ +package org.ovirt.engine.ui.uicommonweb.models.clusters; + +import java.util.ArrayList; + +import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.action.VdsGroupOperationParameters; +import org.ovirt.engine.core.common.businessentities.VDSGroup; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeStatus; +import org.ovirt.engine.core.compat.StringHelper; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.Frontend; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.Cloner; +import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicompat.ConstantsManager; + +public class ClusterGeneralModel extends EntityModel { + + public static Integer lowLimitPowerSaving = null; + public static Integer highLimitPowerSaving = null; + public static Integer highLimitEvenlyDistributed = null; + + private Integer noOfVolumesTotal; + private Integer noOfVolumesUp; + private Integer noOfVolumesDown; + + public String getNoOfVolumesTotal() { + return Integer.toString(noOfVolumesTotal); + } + + public void setNoOfVolumesTotal(Integer noOfVolumesTotal) { + this.noOfVolumesTotal = noOfVolumesTotal; + } + + public String getNoOfVolumesUp() { + return Integer.toString(noOfVolumesUp); + } + + public void setNoOfVolumesUp(Integer noOfVolumesUp) { + this.noOfVolumesUp = noOfVolumesUp; + } + + public String getNoOfVolumesDown() { + return Integer.toString(noOfVolumesDown); + } + + public void setNoOfVolumesDown(Integer noOfVolumesDown) { + this.noOfVolumesDown = noOfVolumesDown; + } + + private UICommand privateEditPolicyCommand; + + public UICommand getEditPolicyCommand() + { + return privateEditPolicyCommand; + } + + private void setEditPolicyCommand(UICommand value) + { + privateEditPolicyCommand = value; + } + + @Override + public VDSGroup getEntity() + { + return (VDSGroup) ((super.getEntity() instanceof VDSGroup) ? super.getEntity() : null); + } + + public void setEntity(VDSGroup value) + { + super.setEntity(value); + } + + public ClusterGeneralModel() + { + setTitle(ConstantsManager.getInstance().getConstants().generalTitle()); + setHashName("general"); //$NON-NLS-1$ + + setNoOfVolumesTotal(0); + setNoOfVolumesUp(0); + setNoOfVolumesDown(0); + + setEditPolicyCommand(new UICommand("EditPolicy", this)); //$NON-NLS-1$ + + AsyncQuery _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void OnSuccess(Object model, Object result) + { + ClusterGeneralModel.highLimitEvenlyDistributed = (Integer) result; + } + }; + if (ClusterGeneralModel.highLimitEvenlyDistributed == null) + { + AsyncDataProvider.GetHighUtilizationForEvenDistribution(_asyncQuery); + } + _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void OnSuccess(Object model, Object result) + { + ClusterGeneralModel.lowLimitPowerSaving = (Integer) result; + } + }; + if (ClusterGeneralModel.lowLimitPowerSaving == null) + { + AsyncDataProvider.GetLowUtilizationForPowerSave(_asyncQuery); + } + + _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void OnSuccess(Object model, Object result) + { + ClusterGeneralModel.highLimitPowerSaving = (Integer) result; + } + }; + if (ClusterGeneralModel.highLimitPowerSaving == null) + { + AsyncDataProvider.GetHighUtilizationForPowerSave(_asyncQuery); + } + } + + @Override + protected void OnEntityChanged() + { + super.OnEntityChanged(); + + if (getEntity() != null) + { + UpdateVolumeDetails(); + } + + UpdateActionAvailability(); + } + + public void EditPolicy() + { + if (getWindow() != null) + { + return; + } + + ClusterPolicyModel model = new ClusterPolicyModel(); + + model.setTitle(ConstantsManager.getInstance().getConstants().editPolicyTitle()); + model.setHashName("edit_policy"); //$NON-NLS-1$ + + model.setSelectionAlgorithm(getEntity().getselection_algorithm()); + model.getOverCommitTime().setEntity(getEntity().getcpu_over_commit_duration_minutes()); + model.setOverCommitLowLevel(getEntity().getlow_utilization()); + model.setOverCommitHighLevel(getEntity().gethigh_utilization()); + + model.SaveDefaultValues(); + + setWindow(model); + + UICommand tempVar = new UICommand("OnSavePolicy", this); //$NON-NLS-1$ + tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); + tempVar.setIsDefault(true); + model.getCommands().add(tempVar); + UICommand tempVar2 = new UICommand("Cancel", this); //$NON-NLS-1$ + tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); + tempVar2.setIsCancel(true); + model.getCommands().add(tempVar2); + } + + public void OnSavePolicy() + { + ClusterPolicyModel model = (ClusterPolicyModel) getWindow(); + + if (getEntity() == null) + { + Cancel(); + return; + } + + if (!model.Validate()) + { + return; + } + + VDSGroup cluster = (VDSGroup) Cloner.clone(getEntity()); + cluster.setselection_algorithm(model.getSelectionAlgorithm()); + if (model.getOverCommitTime().getIsAvailable()) + { + cluster.setcpu_over_commit_duration_minutes(Integer.parseInt(model.getOverCommitTime() + .getEntity() + .toString())); + } + cluster.setlow_utilization(model.getOverCommitLowLevel()); + cluster.sethigh_utilization(model.getOverCommitHighLevel()); + + Frontend.RunAction(VdcActionType.UpdateVdsGroup, new VdsGroupOperationParameters(cluster)); + + Cancel(); + } + + public void Cancel() + { + setWindow(null); + } + + private void UpdateActionAvailability() + { + getEditPolicyCommand().setIsExecutionAllowed(getEntity() != null); + } + + private void UpdateVolumeDetails() + { + AsyncQuery _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void OnSuccess(Object model, Object result) + { + ClusterGeneralModel innerGeneralModel = (ClusterGeneralModel) model; + ArrayList<GlusterVolumeEntity> volumeList = (ArrayList<GlusterVolumeEntity>) result; + int volumesUp = 0; + int volumesDown = 0; + for (GlusterVolumeEntity volumeEntity : volumeList) + { + if (volumeEntity.getStatus() == GlusterVolumeStatus.UP) + { + volumesUp++; + } + else + { + volumesDown++; + } + } + setNoOfVolumesTotal(volumeList.size()); + setNoOfVolumesUp(volumesUp); + setNoOfVolumesDown(volumesDown); + } + }; + AsyncDataProvider.GetVolumeList(_asyncQuery, getEntity().getname()); + } + + @Override + public void ExecuteCommand(UICommand command) + { + super.ExecuteCommand(command); + + if (command == getEditPolicyCommand()) + { + EditPolicy(); + } + else if (StringHelper.stringsEqual(command.getName(), "OnSavePolicy")) //$NON-NLS-1$ + { + OnSavePolicy(); + } + else if (StringHelper.stringsEqual(command.getName(), "Cancel")) //$NON-NLS-1$ + { + Cancel(); + } + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java index 6232fe6..ba7a799 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java @@ -179,7 +179,7 @@ super.InitDetailModels(); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); - list.add(new ClusterPolicyModel()); + list.add(new ClusterGeneralModel()); list.add(new ClusterNetworkListModel()); list.add(new ClusterHostListModel()); list.add(new ClusterVmListModel()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterPolicyModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterPolicyModel.java index 3613879..5734f90 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterPolicyModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterPolicyModel.java @@ -1,84 +1,16 @@ package org.ovirt.engine.ui.uicommonweb.models.clusters; -import java.util.ArrayList; - -import org.ovirt.engine.core.common.action.VdcActionType; -import org.ovirt.engine.core.common.action.VdsGroupOperationParameters; -import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VdsSelectionAlgorithm; -import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; -import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeStatus; import org.ovirt.engine.core.compat.PropertyChangedEventArgs; -import org.ovirt.engine.core.compat.StringHelper; -import org.ovirt.engine.ui.frontend.AsyncQuery; -import org.ovirt.engine.ui.frontend.Frontend; -import org.ovirt.engine.ui.frontend.INewAsyncCallback; -import org.ovirt.engine.ui.uicommonweb.Cloner; -import org.ovirt.engine.ui.uicommonweb.UICommand; -import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.validation.IValidation; import org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation; import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; -import org.ovirt.engine.ui.uicompat.ConstantsManager; @SuppressWarnings("unused") public class ClusterPolicyModel extends EntityModel { - public static Integer lowLimitPowerSaving = null; - public static Integer highLimitPowerSaving = null; - public static Integer highLimitEvenlyDistributed = null; - private Integer noOfVolumesTotal; - private Integer noOfVolumesUp; - private Integer noOfVolumesDown; - - public String getNoOfVolumesTotal() { - return Integer.toString(noOfVolumesTotal); - } - - public void setNoOfVolumesTotal(Integer noOfVolumesTotal) { - this.noOfVolumesTotal = noOfVolumesTotal; - } - - public String getNoOfVolumesUp() { - return Integer.toString(noOfVolumesUp); - } - - public void setNoOfVolumesUp(Integer noOfVolumesUp) { - this.noOfVolumesUp = noOfVolumesUp; - } - - public String getNoOfVolumesDown() { - return Integer.toString(noOfVolumesDown); - } - - public void setNoOfVolumesDown(Integer noOfVolumesDown) { - this.noOfVolumesDown = noOfVolumesDown; - } - - private UICommand privateEditCommand; - - public UICommand getEditCommand() - { - return privateEditCommand; - } - - private void setEditCommand(UICommand value) - { - privateEditCommand = value; - } - - @Override - public VDSGroup getEntity() - { - return (VDSGroup) ((super.getEntity() instanceof VDSGroup) ? super.getEntity() : null); - } - - public void setEntity(VDSGroup value) - { - super.setEntity(value); - } private EntityModel privateOverCommitTime; @@ -178,132 +110,21 @@ { if (getSelectionAlgorithm() == VdsSelectionAlgorithm.EvenlyDistribute) { - highLimitEvenlyDistributed = getOverCommitHighLevel(); + ClusterGeneralModel.highLimitEvenlyDistributed = getOverCommitHighLevel(); } else if (getSelectionAlgorithm() == VdsSelectionAlgorithm.PowerSave) { - lowLimitPowerSaving = getOverCommitLowLevel(); - highLimitPowerSaving = getOverCommitHighLevel(); + ClusterGeneralModel.lowLimitPowerSaving = getOverCommitLowLevel(); + ClusterGeneralModel.highLimitPowerSaving = getOverCommitHighLevel(); } } public ClusterPolicyModel() { - setTitle(ConstantsManager.getInstance().getConstants().generalTitle()); - setHashName("general"); //$NON-NLS-1$ - - setNoOfVolumesTotal(0); - setNoOfVolumesUp(0); - setNoOfVolumesDown(0); - - setEditCommand(new UICommand("Edit", this)); //$NON-NLS-1$ setOverCommitTime(new EntityModel()); // Set all properties according to default selected algorithm: SelectionAlgorithmChanged(); - - AsyncQuery _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { - @Override - public void OnSuccess(Object model, Object result) - { - ClusterPolicyModel.highLimitEvenlyDistributed = (Integer) result; - } - }; - if (ClusterPolicyModel.highLimitEvenlyDistributed == null) - { - AsyncDataProvider.GetHighUtilizationForEvenDistribution(_asyncQuery); - } - _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { - @Override - public void OnSuccess(Object model, Object result) - { - ClusterPolicyModel.lowLimitPowerSaving = (Integer) result; - } - }; - if (ClusterPolicyModel.lowLimitPowerSaving == null) - { - AsyncDataProvider.GetLowUtilizationForPowerSave(_asyncQuery); - } - - _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { - @Override - public void OnSuccess(Object model, Object result) - { - ClusterPolicyModel.highLimitPowerSaving = (Integer) result; - } - }; - if (highLimitPowerSaving == null) - { - AsyncDataProvider.GetHighUtilizationForPowerSave(_asyncQuery); - } - } - - public void Edit() - { - if (getWindow() != null) - { - return; - } - - ClusterPolicyModel model = new ClusterPolicyModel(); - - model.setTitle(ConstantsManager.getInstance().getConstants().editPolicyTitle()); - model.setHashName("edit_policy"); //$NON-NLS-1$ - - model.setSelectionAlgorithm(getEntity().getselection_algorithm()); - model.getOverCommitTime().setEntity(getEntity().getcpu_over_commit_duration_minutes()); - model.setOverCommitLowLevel(getEntity().getlow_utilization()); - model.setOverCommitHighLevel(getEntity().gethigh_utilization()); - - model.SaveDefaultValues(); - - setWindow(model); - - UICommand tempVar = new UICommand("OnSave", this); //$NON-NLS-1$ - tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); - tempVar.setIsDefault(true); - model.getCommands().add(tempVar); - UICommand tempVar2 = new UICommand("Cancel", this); //$NON-NLS-1$ - tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); - tempVar2.setIsCancel(true); - model.getCommands().add(tempVar2); - } - - public void OnSave() - { - ClusterPolicyModel model = (ClusterPolicyModel) getWindow(); - - if (getEntity() == null) - { - Cancel(); - return; - } - - if (!model.Validate()) - { - return; - } - - VDSGroup cluster = (VDSGroup) Cloner.clone(getEntity()); - cluster.setselection_algorithm(model.getSelectionAlgorithm()); - if (model.getOverCommitTime().getIsAvailable()) - { - cluster.setcpu_over_commit_duration_minutes(Integer.parseInt(model.getOverCommitTime() - .getEntity() - .toString())); - } - cluster.setlow_utilization(model.getOverCommitLowLevel()); - cluster.sethigh_utilization(model.getOverCommitHighLevel()); - - Frontend.RunAction(VdcActionType.UpdateVdsGroup, new VdsGroupOperationParameters(cluster)); - - Cancel(); } public boolean Validate() @@ -314,80 +135,6 @@ getOverCommitTime().ValidateEntity(new IValidation[] { new NotEmptyValidation(), tempVar }); return getOverCommitTime().getIsValid(); - } - - public void Cancel() - { - setWindow(null); - } - - @Override - protected void OnEntityChanged() - { - super.OnEntityChanged(); - - if (getEntity() != null) - { - UpdateProperties(); - UpdateVolumeDetails(); - } - - UpdateActionAvailability(); - } - - @Override - protected void EntityPropertyChanged(Object sender, PropertyChangedEventArgs e) - { - super.EntityPropertyChanged(sender, e); - - if (e.PropertyName.equals("selection_algorithm")) //$NON-NLS-1$ - { - UpdateProperties(); - } - } - - private void UpdateActionAvailability() - { - getEditCommand().setIsExecutionAllowed(getEntity() != null); - } - - private void UpdateProperties() - { - getOverCommitTime().setIsAvailable(getEntity().getselection_algorithm() != VdsSelectionAlgorithm.None); - getOverCommitTime().setIsChangable(getOverCommitTime().getIsAvailable()); - setHasOverCommitLowLevel(getEntity().getselection_algorithm() == VdsSelectionAlgorithm.PowerSave); - setHasOverCommitHighLevel(getEntity().getselection_algorithm() != VdsSelectionAlgorithm.None); - } - - private void UpdateVolumeDetails() - { - AsyncQuery _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { - @Override - public void OnSuccess(Object model, Object result) - { - ClusterPolicyModel innerGeneralModel = (ClusterPolicyModel) model; - ArrayList<GlusterVolumeEntity> volumeList = (ArrayList<GlusterVolumeEntity>) result; - int volumesUp = 0; - int volumesDown = 0; - for (GlusterVolumeEntity volumeEntity : volumeList) - { - if (volumeEntity.getStatus() == GlusterVolumeStatus.UP) - { - volumesUp++; - } - else - { - volumesDown++; - } - } - setNoOfVolumesTotal(volumeList.size()); - setNoOfVolumesUp(volumesUp); - setNoOfVolumesDown(volumesDown); - } - }; - AsyncDataProvider.GetVolumeList(_asyncQuery, getEntity().getname()); } private void SelectionAlgorithmChanged() @@ -410,7 +157,8 @@ setHasOverCommitLowLevel(false); setHasOverCommitHighLevel(true); setOverCommitLowLevel(0); - setOverCommitHighLevel((highLimitEvenlyDistributed == null ? 0 : highLimitEvenlyDistributed)); + setOverCommitHighLevel((ClusterGeneralModel.highLimitEvenlyDistributed == null ? 0 + : ClusterGeneralModel.highLimitEvenlyDistributed)); break; case PowerSave: @@ -418,31 +166,12 @@ getOverCommitTime().setIsChangable(true); setHasOverCommitLowLevel(true); setHasOverCommitHighLevel(true); - setOverCommitLowLevel((ClusterPolicyModel.lowLimitPowerSaving == null ? 0 - : ClusterPolicyModel.lowLimitPowerSaving)); + setOverCommitLowLevel((ClusterGeneralModel.lowLimitPowerSaving == null ? 0 + : ClusterGeneralModel.lowLimitPowerSaving)); - setOverCommitHighLevel((ClusterPolicyModel.highLimitPowerSaving == null ? 0 - : ClusterPolicyModel.highLimitPowerSaving)); + setOverCommitHighLevel((ClusterGeneralModel.highLimitPowerSaving == null ? 0 + : ClusterGeneralModel.highLimitPowerSaving)); break; - } - } - - @Override - public void ExecuteCommand(UICommand command) - { - super.ExecuteCommand(command); - - if (command == getEditCommand()) - { - Edit(); - } - else if (StringHelper.stringsEqual(command.getName(), "OnSave")) //$NON-NLS-1$ - { - OnSave(); - } - else if (StringHelper.stringsEqual(command.getName(), "Cancel")) //$NON-NLS-1$ - { - Cancel(); } } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java index a259eaf..0c2220f 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ManagedComponents.java @@ -5,6 +5,7 @@ import org.ovirt.engine.core.common.businessentities.AuditLog; import org.ovirt.engine.core.common.businessentities.DbUser; import org.ovirt.engine.core.common.businessentities.Disk; +import org.ovirt.engine.core.common.businessentities.Network; import org.ovirt.engine.core.common.businessentities.Quota; import org.ovirt.engine.core.common.businessentities.QuotaStorage; import org.ovirt.engine.core.common.businessentities.QuotaVdsGroup; @@ -15,7 +16,6 @@ import org.ovirt.engine.core.common.businessentities.VmNetworkInterface; import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.event_subscriber; -import org.ovirt.engine.core.common.businessentities.Network; import org.ovirt.engine.core.common.businessentities.permissions; import org.ovirt.engine.core.common.businessentities.storage_domains; import org.ovirt.engine.core.common.businessentities.storage_pool; @@ -28,10 +28,10 @@ import org.ovirt.engine.ui.common.uicommon.model.MainModelProvider; import org.ovirt.engine.ui.common.uicommon.model.SearchableDetailModelProvider; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterHostListModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterNetworkListModel; -import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterPolicyModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterVmListModel; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; import org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterClusterListModel; @@ -370,7 +370,7 @@ AsyncProvider<SubTabClusterGeneralPresenter> getSubTabClusterGeneralPresenter(); - DetailModelProvider<ClusterListModel, ClusterPolicyModel> getSubTabClusterGeneralModelProvider(); + DetailModelProvider<ClusterListModel, ClusterGeneralModel> getSubTabClusterGeneralModelProvider(); AsyncProvider<SubTabClusterHostPresenter> getSubTabClusterHostPresenter(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java index fe950a3..4406b6b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java @@ -1,9 +1,9 @@ package org.ovirt.engine.ui.webadmin.gin.uicommon; +import org.ovirt.engine.core.common.businessentities.Network; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VM; -import org.ovirt.engine.core.common.businessentities.Network; import org.ovirt.engine.core.common.businessentities.permissions; import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; import org.ovirt.engine.ui.common.presenter.ModelBoundPresenterWidget; @@ -18,10 +18,10 @@ import org.ovirt.engine.ui.uicommonweb.UICommand; import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel; import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterHostListModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterNetworkListModel; -import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterPolicyModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterVmListModel; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; import org.ovirt.engine.ui.webadmin.gin.ClientGinjector; @@ -88,15 +88,15 @@ @Provides @Singleton - public DetailModelProvider<ClusterListModel, ClusterPolicyModel> getClusterPolicyProvider(ClientGinjector ginjector, + public DetailModelProvider<ClusterListModel, ClusterGeneralModel> getClusterPolicyProvider(ClientGinjector ginjector, final Provider<ClusterPolicyPopupPresenterWidget> popupProvider) { - return new DetailTabModelProvider<ClusterListModel, ClusterPolicyModel>(ginjector, + return new DetailTabModelProvider<ClusterListModel, ClusterGeneralModel>(ginjector, ClusterListModel.class, - ClusterPolicyModel.class) { + ClusterGeneralModel.class) { @Override - public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(ClusterPolicyModel source, + public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(ClusterGeneralModel source, UICommand lastExecutedCommand, Model windowModel) { - if (lastExecutedCommand == getModel().getEditCommand()) { + if (lastExecutedCommand == getModel().getEditPolicyCommand()) { return popupProvider.get(); } else { return super.getModelPopup(source, lastExecutedCommand, windowModel); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/cluster/SubTabClusterGeneralPresenter.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/cluster/SubTabClusterGeneralPresenter.java index 711d851..130db41 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/cluster/SubTabClusterGeneralPresenter.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/cluster/SubTabClusterGeneralPresenter.java @@ -4,8 +4,8 @@ import org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter; import org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider; import org.ovirt.engine.ui.common.widget.tab.ModelBoundTabData; +import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel; -import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterPolicyModel; import org.ovirt.engine.ui.webadmin.gin.ClientGinjector; import org.ovirt.engine.ui.webadmin.place.ApplicationPlaces; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.ClusterSelectionChangeEvent; @@ -22,7 +22,7 @@ import com.gwtplatform.mvp.client.proxy.RevealContentEvent; import com.gwtplatform.mvp.client.proxy.TabContentProxyPlace; -public class SubTabClusterGeneralPresenter extends AbstractSubTabPresenter<VDSGroup, ClusterListModel, ClusterPolicyModel, SubTabClusterGeneralPresenter.ViewDef, SubTabClusterGeneralPresenter.ProxyDef> { +public class SubTabClusterGeneralPresenter extends AbstractSubTabPresenter<VDSGroup, ClusterListModel, ClusterGeneralModel, SubTabClusterGeneralPresenter.ViewDef, SubTabClusterGeneralPresenter.ProxyDef> { @ProxyCodeSplit @NameToken(ApplicationPlaces.clusterGeneralSubTabPlace) @@ -40,7 +40,7 @@ @Inject public SubTabClusterGeneralPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, - PlaceManager placeManager, DetailModelProvider<ClusterListModel, ClusterPolicyModel> modelProvider) { + PlaceManager placeManager, DetailModelProvider<ClusterListModel, ClusterGeneralModel> modelProvider) { super(eventBus, view, proxy, placeManager, modelProvider); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java index 1e8f425..23d549b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java @@ -17,7 +17,7 @@ import org.ovirt.engine.ui.common.widget.form.Slider; import org.ovirt.engine.ui.common.widget.label.TextBoxLabel; import org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper; -import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterPolicyModel; +import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGeneralModel; import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel; import org.ovirt.engine.ui.webadmin.ApplicationConstants; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.cluster.SubTabClusterGeneralPresenter; @@ -36,13 +36,13 @@ import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; -public class SubTabClusterGeneralView extends AbstractSubTabFormView<VDSGroup, ClusterListModel, ClusterPolicyModel> - implements SubTabClusterGeneralPresenter.ViewDef, Editor<ClusterPolicyModel> { +public class SubTabClusterGeneralView extends AbstractSubTabFormView<VDSGroup, ClusterListModel, ClusterGeneralModel> + implements SubTabClusterGeneralPresenter.ViewDef, Editor<ClusterGeneralModel> { private static final String MAX_COLOR = "#4E9FDD"; //$NON-NLS-1$ private static final String MIN_COLOR = "#AFBF27"; //$NON-NLS-1$ - interface Driver extends SimpleBeanEditorDriver<ClusterPolicyModel, SubTabClusterGeneralView> { + interface Driver extends SimpleBeanEditorDriver<ClusterGeneralModel, SubTabClusterGeneralView> { Driver driver = GWT.create(Driver.class); } @@ -109,7 +109,7 @@ private final ApplicationConstants constants; @Inject - public SubTabClusterGeneralView(final DetailModelProvider<ClusterListModel, ClusterPolicyModel> modelProvider, + public SubTabClusterGeneralView(final DetailModelProvider<ClusterListModel, ClusterGeneralModel> modelProvider, ApplicationConstants constants) { super(modelProvider); this.constants = constants; @@ -163,7 +163,7 @@ editPolicyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { - getDetailModel().ExecuteCommand(getDetailModel().getEditCommand()); + getDetailModel().ExecuteCommand(getDetailModel().getEditPolicyCommand()); } }); } -- To view, visit http://gerrit.ovirt.org/7530 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d9271f34820627333c9eb7f38d1406b01b7d156 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
