Shubhendu Tripathi has uploaded a new change for review. Change subject: webadmin: UI to set the volume snapshot configurations ......................................................................
webadmin: UI to set the volume snapshot configurations Introduced UI to set gluster volume snapshot configration parameters. Change-Id: I08b5e592b818266106bc1891c3aa2f3ba3541d36 Signed-off-by: Shubhendu Tripathi <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterClusterSnapshotConfigModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotConfigModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeSnapshotOptionModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.ui.xml A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java 20 files changed, 1,091 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/39352/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml index 94ec7c1..074e28f 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml @@ -343,7 +343,8 @@ <include name="common/businessentities/gluster/BrickProfileDetails.java"/> <include name="common/businessentities/gluster/GlusterVolumeSnapshotEntity.java"/> <include name="common/businessentities/gluster/GlusterSnapshotStatus.java"/> - <!-- Scheduling --> + <include name="common/businessentities/gluster/GlusterVolumeSnapshotConfig.java"/> + <!-- Scheduling --> <include name="common/scheduling/*.java"/> <include name="common/scheduling/parameters/*.java"/> <!-- Numa --> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java index 68bf03b..546418a 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Linq.java @@ -38,6 +38,7 @@ import org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator; import org.ovirt.engine.core.common.businessentities.comparators.NameableComparator; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkInterface; @@ -135,6 +136,15 @@ } } + public static class GlusterVolumeSnapshotConfigComparator implements Comparator<GlusterVolumeSnapshotConfig>, Serializable { + private static final long serialVersionUID = 2L; + + @Override + public int compare(GlusterVolumeSnapshotConfig param0, GlusterVolumeSnapshotConfig param1) { + return param0.getParamName().compareTo(param1.getParamName()); + } + } + public static class DiskImageByLastModifiedComparer implements Comparator<DiskImage>, Serializable { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java index 7ba7841..58bd427 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java @@ -1676,6 +1676,11 @@ Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeProfileInfo, parameters, aQuery); } + public static void getGlusterSnapshotConfig(AsyncQuery aQuery, Guid clusterId, Guid volumeId) { + aQuery.setHandleFailure(true); + Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeSnapshotConfig, new GlusterVolumeQueriesParameters(clusterId, volumeId), aQuery); + } + public static void getGlusterRemoveBricksStatus(AsyncQuery aQuery, Guid clusterId, Guid volumeId, diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java index 849278d..13c3d30 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java @@ -322,6 +322,10 @@ new_volume("new_volume", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> New"), //$NON-NLS-1$ //$NON-NLS-2$ + configure_volume_snapshot("configure_volume_snapshot", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshot -> Options"), //$NON-NLS-1$ //$NON-NLS-2$ + + configure_volume_snapshot_confirmation("configure_volume_snapshot_confirmation", HelpTagType.WEBADMIN, "Configure volume snapshot: confirmation dialog that appears when changing the volume snapshot configuration parameters."), //$NON-NLS-1$ //$NON-NLS-2$ + parameters("parameters", HelpTagType.UNKNOWN), //$NON-NLS-1$ permissions("permissions", HelpTagType.UNKNOWN), //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterClusterSnapshotConfigModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterClusterSnapshotConfigModel.java new file mode 100644 index 0000000..070b2a9 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterClusterSnapshotConfigModel.java @@ -0,0 +1,133 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.ovirt.engine.core.common.businessentities.VDSGroup; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig; +import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; +import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.Linq; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicompat.ConstantsManager; +import org.ovirt.engine.ui.uicompat.Event; +import org.ovirt.engine.ui.uicompat.EventArgs; +import org.ovirt.engine.ui.uicompat.IEventListener; + +public class GlusterClusterSnapshotConfigModel extends Model { + private EntityModel<String> dataCenter; + private ListModel<VDSGroup> clusters; + private ListModel<EntityModel<GlusterVolumeSnapshotConfig>> clusterConfigOptions; + private Map<String, String> existingClusterConfigs = new HashMap<String, String>(); + + public EntityModel<String> getDataCenter() { + return this.dataCenter; + } + + public void setDataCenter(EntityModel<String> dataCenter) { + this.dataCenter = dataCenter; + } + + public ListModel<VDSGroup> getClusters() { + return this.clusters; + } + + public void setClusters(ListModel<VDSGroup> clusters) { + this.clusters = clusters; + } + + public ListModel<EntityModel<GlusterVolumeSnapshotConfig>> getClusterConfigOptions() { + return clusterConfigOptions; + } + + public void setClusterConfigOptions(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> clusterConfigOptions) { + this.clusterConfigOptions = clusterConfigOptions; + } + + public String getExistingClusterConfigValue(String cfgName) { + return existingClusterConfigs.get(cfgName); + } + + public GlusterClusterSnapshotConfigModel() { + init(); + } + + private void init() { + setDataCenter(new EntityModel<String>()); + setClusters(new ListModel<VDSGroup>()); + getClusters().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + clusterSelectedItemChanged(); + } + }); + setClusterConfigOptions(new ListModel<EntityModel<GlusterVolumeSnapshotConfig>>()); + } + + public boolean validate() { + boolean isValid = true; + setMessage(null); + Iterable<EntityModel<GlusterVolumeSnapshotConfig>> items1 = getClusterConfigOptions().getItems(); + for (EntityModel<GlusterVolumeSnapshotConfig> model : items1) { + GlusterVolumeSnapshotConfig option = model.getEntity(); + if (option.getParamValue().trim().length() == 0) { + setMessage(ConstantsManager.getInstance() + .getMessages() + .clusterSnapshotOptionValueEmpty(option.getParamName())); + isValid = false; + break; + } + } + + return isValid; + } + + private void clusterSelectedItemChanged() { + VDSGroup selectedCluster = getClusters().getSelectedItem(); + if (selectedCluster == null) { + return; + } + + AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue) { + VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; + Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = + (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); + if (configs != null) { + List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst(); + Collections.sort(clusterConfigOptions, new Linq.GlusterVolumeSnapshotConfigComparator()); + setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs); + } else { + getClusterConfigOptions().setItems(null); + } + } + + private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, + List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) { + List<EntityModel<GlusterVolumeSnapshotConfig>> coll = + new ArrayList<EntityModel<GlusterVolumeSnapshotConfig>>(); + for (GlusterVolumeSnapshotConfig cfg : cfgs) { + EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<GlusterVolumeSnapshotConfig>(); + cfgModel.setEntity(cfg); + fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue()); + coll.add(cfgModel); + } + + // set the entity items + listModel.setItems(coll); + } + }), + selectedCluster.getId(), + null); + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotConfigModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotConfigModel.java new file mode 100644 index 0000000..6e4cf39 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotConfigModel.java @@ -0,0 +1,151 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig; +import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; +import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicompat.ConstantsManager; + +public class GlusterVolumeSnapshotConfigModel extends Model { + private EntityModel<String> dataCenter; + private EntityModel<String> clusterName; + private EntityModel<String> volumeName; + private ListModel<EntityModel<VolumeSnapshotOptionModel>> configOptions; + private Map<String, String> existingVolumeConfigs = new HashMap<String, String>(); + + public EntityModel<String> getDataCenter() { + return this.dataCenter; + } + + public void setDataCenter(EntityModel<String> dataCenter) { + this.dataCenter = dataCenter; + } + + public EntityModel<String> getClusterName() { + return this.clusterName; + } + + public void setClusterName(EntityModel<String> cluster) { + this.clusterName = cluster; + } + + public EntityModel<String> getVolumeName() { + return volumeName; + } + + public void setVolumeName(EntityModel<String> volumeName) { + this.volumeName = volumeName; + } + + public ListModel<EntityModel<VolumeSnapshotOptionModel>> getConfigOptions() { + return configOptions; + } + + public void setConfigOptions(ListModel<EntityModel<VolumeSnapshotOptionModel>> configOptions) { + this.configOptions = configOptions; + } + + private GlusterVolumeEntity selectedVolumeEntity; + + public GlusterVolumeEntity getSelectedVolumeEntity() { + return this.selectedVolumeEntity; + } + + public void setSelectedVolumeEntity(GlusterVolumeEntity volume) { + this.selectedVolumeEntity = volume; + } + + private boolean isVolumeTabAvailable; + + public boolean getIsVolumeTabAvailable() { + return this.isVolumeTabAvailable; + } + + public void setIsVolumeTabAvailable(boolean value) { + this.isVolumeTabAvailable = value; + } + + public String getExistingVolumeConfigValue(String cfgName) { + return existingVolumeConfigs.get(cfgName); + } + + public GlusterVolumeSnapshotConfigModel(GlusterVolumeEntity volumeEntity) { + setSelectedVolumeEntity(volumeEntity); + init(); + } + + private void init() { + setDataCenter(new EntityModel<String>()); + setClusterName(new EntityModel<String>()); + setVolumeName(new EntityModel<String>()); + setConfigOptions(new ListModel<EntityModel<VolumeSnapshotOptionModel>>()); + populateConfigOptions(); + } + + public boolean validate() { + boolean isValid = true; + setMessage(null); + Iterable<EntityModel<VolumeSnapshotOptionModel>> items = getConfigOptions().getItems(); + for (EntityModel<VolumeSnapshotOptionModel> model : items) { + if (model.getEntity().getOptionValue().trim().length() == 0) { + setMessage(ConstantsManager.getInstance() + .getMessages() + .volumeSnapshotOptionValueEmpty(model.getEntity().getOptionName())); + isValid = false; + break; + } + } + + return isValid; + } + + private void populateConfigOptions() { + startProgress(null); + + AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue) { + VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; + Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = + (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); + Map<String, String> clusterConfigOptions = new HashMap<>(); + Map<String, String> volumeConfigOptions = new HashMap<>(); + for (GlusterVolumeSnapshotConfig config : configs.getFirst()) { + clusterConfigOptions.put(config.getParamName(), config.getParamValue()); + } + for (GlusterVolumeSnapshotConfig config : configs.getSecond()) { + volumeConfigOptions.put(config.getParamName(), config.getParamValue()); + } + List<EntityModel<VolumeSnapshotOptionModel>> coll = new ArrayList<EntityModel<VolumeSnapshotOptionModel>>(); + for (Map.Entry<String, String> entry : volumeConfigOptions.entrySet()) { + EntityModel<VolumeSnapshotOptionModel> cfgModel = new EntityModel<VolumeSnapshotOptionModel>(); + VolumeSnapshotOptionModel option = new VolumeSnapshotOptionModel(); + option.setOptionName(entry.getKey()); + option.setOptionValue(entry.getValue()); + option.setCorrespodingClusterValue(clusterConfigOptions.get(entry.getKey())); + cfgModel.setEntity(option); + existingVolumeConfigs.put(entry.getKey(), entry.getValue()); + coll.add(cfgModel); + } + + getConfigOptions().setItems(coll); + } + }), + selectedVolumeEntity.getClusterId(), + selectedVolumeEntity.getId()); + + stopProgress(); + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeSnapshotOptionModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeSnapshotOptionModel.java new file mode 100644 index 0000000..be76f00 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeSnapshotOptionModel.java @@ -0,0 +1,36 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import org.ovirt.engine.ui.uicommonweb.models.Model; + +public class VolumeSnapshotOptionModel extends Model { + String optionName; + String optionValue; + String correspodingClusterValue; + + public VolumeSnapshotOptionModel() { + } + + public String getOptionName() { + return optionName; + } + + public void setOptionName(String optionName) { + this.optionName = optionName; + } + + public String getOptionValue() { + return optionValue; + } + + public void setOptionValue(String optionValue) { + this.optionValue = optionValue; + } + + public String getCorrespodingClusterValue() { + return correspodingClusterValue; + } + + public void setCorrespodingClusterValue(String correspodingClusterValue) { + this.correspodingClusterValue = correspodingClusterValue; + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java index b7b91fe..cb1dcdf 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java @@ -12,6 +12,7 @@ import org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters; +import org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters; import org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask; import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType; import org.ovirt.engine.core.common.businessentities.StoragePool; @@ -20,6 +21,7 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType; import org.ovirt.engine.core.common.businessentities.gluster.TransportType; @@ -47,6 +49,8 @@ import org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemModel; import org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemType; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel; @@ -55,6 +59,7 @@ import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel; import org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult; @@ -101,6 +106,8 @@ private UICommand startVolumeProfilingCommand; private UICommand showVolumeProfileDetailsCommand; private UICommand stopVolumeProfilingCommand; + private UICommand configureClusterSnapshotOptionsCommand; + private UICommand configureVolumeSnapshotOptionsCommand; public UICommand getStartRebalanceCommand() { return startRebalanceCommand; @@ -195,6 +202,22 @@ this.stopVolumeProfilingCommand = stopVolumeProfilingCommand; } + public UICommand getConfigureClusterSnapshotOptionsCommand() { + return this.configureClusterSnapshotOptionsCommand; + } + + public void setConfigureClusterSnapshotOptionsCommand(UICommand command) { + this.configureClusterSnapshotOptionsCommand = command; + } + + public UICommand getConfigureVolumeSnapshotOptionsCommand() { + return this.configureVolumeSnapshotOptionsCommand; + } + + public void setConfigureVolumeSnapshotOptionsCommand(UICommand command) { + this.configureVolumeSnapshotOptionsCommand = command; + } + public VolumeListModel() { setTitle(ConstantsManager.getInstance().getConstants().volumesTitle()); setApplicationPlace(WebAdminApplicationPlaces.volumeMainTabPlace); @@ -215,6 +238,8 @@ setShowVolumeProfileDetailsCommand(new UICommand("showProfileDetails", this));//$NON-NLS-1$ setStopVolumeProfilingCommand(new UICommand("stopProfiling", this));//$NON-NLS-1$ setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); //$NON-NLS-1$ + setConfigureClusterSnapshotOptionsCommand(new UICommand("configureClusterSnapshotOptions", this)); //$NON-NLS-1$ + setConfigureVolumeSnapshotOptionsCommand(new UICommand("configureVolumeSnapshotOptions", this)); //$NON-NLS-1$ getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); @@ -437,6 +462,8 @@ boolean allowStartProfiling = false; boolean allowStopProfiling = false; boolean allowProfileStatisticsDetails = false; + boolean allowConfigureClusterSnapshotOptions = true; + boolean allowConfigureVolumeSnapshotOptions = false; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowStart = false; @@ -477,6 +504,7 @@ volumeEntity.getStatus() == GlusterStatus.UP && asyncTask != null && asyncTask.getType() == GlusterTaskType.REBALANCE && asyncTask.getStatus() == JobExecutionStatus.STARTED; + allowConfigureVolumeSnapshotOptions = volumeEntity.getStatus() == GlusterStatus.UP; } else { allowStopRebalance = false; @@ -491,6 +519,8 @@ getStopRebalanceCommand().setIsExecutionAllowed(allowStopRebalance); getStatusRebalanceCommand().setIsExecutionAllowed(allowStatusRebalance); getOptimizeForVirtStoreCommand().setIsExecutionAllowed(allowOptimize); + getConfigureClusterSnapshotOptionsCommand().setIsExecutionAllowed(allowConfigureClusterSnapshotOptions); + getConfigureVolumeSnapshotOptionsCommand().setIsExecutionAllowed(allowConfigureVolumeSnapshotOptions); // System tree dependent actions. boolean isAvailable = @@ -607,6 +637,18 @@ showVolumeProfiling(); }else if(command.getName().equalsIgnoreCase("closeProfileStats")) {//$NON-NLS-1$ setWindow(null); + } else if (command.equals(getConfigureClusterSnapshotOptionsCommand())) { + configureClusterSnapshotOptions(); + } else if (command.getName().equalsIgnoreCase("confirmConfigureClusterSnapshotOptions")) {//$NON-NLS-1$ + confirmConfigureClusterSnapshotOptions(); + } else if (command.getName().equalsIgnoreCase("onConfigureClusterSnapshotOptions")) {//$NON-NLS-1$ + onConfigureClusterSnapshotOptions(); + } else if (command.equals(getConfigureVolumeSnapshotOptionsCommand())) { + configureVolumeSnapshotOptions(); + } else if (command.getName().equalsIgnoreCase("confirmConfigureVolumeSnapshotOptions")) {//$NON-NLS-1$ + confirmConfigureVolumeSnapshotOptions(); + } else if (command.getName().equalsIgnoreCase("onConfigureVolumeSnapshotOptions")) {//$NON-NLS-1$ + onConfigureVolumeSnapshotOptions(); } } @@ -1055,6 +1097,246 @@ } } + /** + * This action is handled here in VolumeLisModel only, because there is a use case where no volume would be selected + * for setting the configuration. And in this scenario the GlusrerVolumeSnapshotListModel would not be initialized. + */ + public void configureClusterSnapshotOptions() { + if (getWindow() != null) { + return; + } + + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + + final GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = new GlusterClusterSnapshotConfigModel(); + clusterSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot); + clusterSnapshotConfigModel.setHashName("configure_volume_snapshot"); //$NON-NLS-1$ + clusterSnapshotConfigModel.setTitle(ConstantsManager.getInstance() + .getConstants() + .configureClusterSnapshotOptionsTitle()); + setWindow(clusterSnapshotConfigModel); + + AsyncDataProvider.getInstance().getClusterList(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, final Object returnValue) { + if (getSystemTreeSelectedItem() != null) { + VDSGroup selectedCluster = (VDSGroup) getSystemTreeSelectedItem().getEntity(); + clusterSnapshotConfigModel.getClusters().setItems((List<VDSGroup>) returnValue, selectedCluster); + } else { + if (getSelectedItems() != null) { + GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getSelectedItems().get(0); + if (volumeEntity != null) { + AsyncDataProvider.getInstance().getClusterById(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue1) { + clusterSnapshotConfigModel.getClusters().setItems((List<VDSGroup>) returnValue, (VDSGroup) returnValue1); + } + }), volumeEntity.getClusterId()); + } + } else { + clusterSnapshotConfigModel.getClusters().setItems((List<VDSGroup>) returnValue); + } + } + } + })); + + clusterSnapshotConfigModel.getClusterConfigOptions().setTitle(ConstantsManager.getInstance() + .getConstants() + .configureClusterSnapshotOptionsTitle()); + + UICommand updateCommand = new UICommand("confirmConfigureClusterSnapshotOptions", this); //$NON-NLS-1$ + updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel()); + updateCommand.setIsDefault(true); + clusterSnapshotConfigModel.getCommands().add(updateCommand); + + UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$ + cancelCommand.setTitle(constants.cancel()); + cancelCommand.setIsCancel(true); + clusterSnapshotConfigModel.getCommands().add(cancelCommand); + } + + public void confirmConfigureClusterSnapshotOptions() { + boolean cfgChanged = false; + GlusterClusterSnapshotConfigModel snapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow(); + + if (!snapshotConfigModel.validate()) { + return; + } + + for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : snapshotConfigModel.getClusterConfigOptions() + .getItems()) { + if (!(clusterCfg.getEntity().getParamValue().equals(snapshotConfigModel.getExistingClusterConfigValue(clusterCfg.getEntity() + .getParamName())))) { + cfgChanged = true; + break; + } + } + + if (cfgChanged) { + ConfirmationModel confirmModel = new ConfirmationModel(); + setConfirmWindow(confirmModel); + confirmModel.setTitle(ConstantsManager.getInstance() + .getConstants() + .updateSnapshotConfigurationConfirmationTitle()); + confirmModel.setHelpTag(HelpTag.configure_volume_snapshot_confirmation); + confirmModel.setHashName("configure_volume_snapshot_confirmation"); //$NON-NLS-1$ + confirmModel.setMessage(ConstantsManager.getInstance() + .getConstants() + .youAreAboutChangeSnapshotConfigurationMsg()); + + UICommand tempVar = new UICommand("onConfigureClusterSnapshotOptions", this); //$NON-NLS-1$ + tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); + tempVar.setIsDefault(true); + getConfirmWindow().getCommands().add(tempVar); + UICommand tempVar2 = new UICommand("CancelConfirmation", this); //$NON-NLS-1$ + tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); + tempVar2.setIsCancel(true); + getConfirmWindow().getCommands().add(tempVar2); + } else { + onConfigureClusterSnapshotOptions(); + } + } + + public void onConfigureClusterSnapshotOptions() { + GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow(); + + Guid clusterId = clusterSnapshotConfigModel.getClusters().getSelectedItem().getId(); + List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<GlusterVolumeSnapshotConfig>(); + for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : clusterSnapshotConfigModel.getClusterConfigOptions() + .getItems()) { + vdsParams.add(new GlusterVolumeSnapshotConfig(clusterId, + null, + clusterCfg.getEntity().getParamName(), + clusterCfg.getEntity().getParamValue())); + } + + Frontend.getInstance().runAction(VdcActionType.UpdateGlusterVolumeSnapshotConfig, + new UpdateGlusterVolumeSnapshotConfigParameters(clusterId, null, vdsParams), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) { + cancel(); + } + if (getConfirmWindow() != null) { + setConfirmWindow(null); + } + } + }, + this); + } + + public void configureVolumeSnapshotOptions() { + if (getWindow() != null) { + return; + } + + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + + GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getSelectedItems().get(0); + final GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = + new GlusterVolumeSnapshotConfigModel(volumeEntity); + volumeSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot); + volumeSnapshotConfigModel.setHashName("configure_volume_snapshot"); //$NON-NLS-1$ + volumeSnapshotConfigModel.setTitle(ConstantsManager.getInstance() + .getConstants() + .configureVolumeSnapshotOptionsTitle()); + setWindow(volumeSnapshotConfigModel); + + AsyncDataProvider.getInstance().getClusterById(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue) { + volumeSnapshotConfigModel.getClusterName().setEntity(((VDSGroup) returnValue).getName()); + } + }), volumeEntity.getClusterId()); + volumeSnapshotConfigModel.getVolumeName().setEntity(volumeEntity.getName()); + + UICommand updateCommand = new UICommand("confirmConfigureVolumeSnapshotOptions", this); //$NON-NLS-1$ + updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel()); + updateCommand.setIsDefault(true); + volumeSnapshotConfigModel.getCommands().add(updateCommand); + + UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$ + cancelCommand.setTitle(constants.cancel()); + cancelCommand.setIsCancel(true); + volumeSnapshotConfigModel.getCommands().add(cancelCommand); + } + + public void confirmConfigureVolumeSnapshotOptions() { + boolean cfgChanged = false; + GlusterVolumeSnapshotConfigModel snapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow(); + + if (!snapshotConfigModel.validate()) { + return; + } + + for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : snapshotConfigModel.getConfigOptions().getItems()) { + if (!(volumeCfg.getEntity().getOptionValue().equals(snapshotConfigModel.getExistingVolumeConfigValue(volumeCfg.getEntity() + .getOptionName())))) { + cfgChanged = true; + break; + } + } + + if (cfgChanged) { + ConfirmationModel confirmModel = new ConfirmationModel(); + setConfirmWindow(confirmModel); + confirmModel.setTitle(ConstantsManager.getInstance() + .getConstants() + .updateSnapshotConfigurationConfirmationTitle()); + confirmModel.setHelpTag(HelpTag.configure_volume_snapshot_confirmation); + confirmModel.setHashName("configure_volume_snapshot_confirmation"); //$NON-NLS-1$ + confirmModel.setMessage(ConstantsManager.getInstance() + .getConstants() + .youAreAboutChangeSnapshotConfigurationMsg()); + + UICommand tempVar = new UICommand("onConfigureVolumeSnapshotOptions", this); //$NON-NLS-1$ + tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); + tempVar.setIsDefault(true); + getConfirmWindow().getCommands().add(tempVar); + UICommand tempVar2 = new UICommand("CancelConfirmation", this); //$NON-NLS-1$ + tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); + tempVar2.setIsCancel(true); + getConfirmWindow().getCommands().add(tempVar2); + } else { + onConfigureVolumeSnapshotOptions(); + } + } + + public void onConfigureVolumeSnapshotOptions() { + GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow(); + + GlusterVolumeEntity volumeEntity = volumeSnapshotConfigModel.getSelectedVolumeEntity(); + List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<GlusterVolumeSnapshotConfig>(); + for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : volumeSnapshotConfigModel.getConfigOptions() + .getItems()) { + vdsParams.add(new GlusterVolumeSnapshotConfig(volumeEntity.getClusterId(), + volumeEntity.getId(), + volumeCfg.getEntity().getOptionName(), + volumeCfg.getEntity().getOptionValue())); + } + + Frontend.getInstance().runAction(VdcActionType.UpdateGlusterVolumeSnapshotConfig, + new UpdateGlusterVolumeSnapshotConfigParameters(volumeEntity.getClusterId(), + volumeEntity.getId(), + vdsParams), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) { + cancel(); + } + if (getConfirmWindow() != null) { + setConfirmWindow(null); + } + } + }, + this); + } + @Override protected String getListName() { return "VolumeListModel"; //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java index ac232d0..89db902 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java @@ -2431,5 +2431,22 @@ @DefaultStringValue("Remove the Data Center(s) will move the entities residing on the storage domain(s) to an unregistered state. For further information please consult documentation.") String removeDataCenterWarnningNote(); + + @DefaultStringValue("Volume Snapshot - Cluster Options") + String configureClusterSnapshotOptionsTitle(); + + @DefaultStringValue("Volume Snapshot - Volume Options") + String configureVolumeSnapshotOptionsTitle(); + + @DefaultStringValue("Update") + String snapshotConfigUpdateButtonLabel(); + + @DefaultStringValue("Update snapshot configuration options") + String updateSnapshotConfigurationConfirmationTitle(); + + @DefaultStringValue("Configuring volume snapshot options\n\n" + + "Changing configuration parameters will lead to deletion of snapshots if they exceed the new limit.\n\n" + + "Are you sure you want to continue?") + String youAreAboutChangeSnapshotConfigurationMsg(); } diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java index 4cfd1c7..6cdb44d 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java @@ -412,4 +412,10 @@ @DefaultMessage("Do you approve trusting self signed certificate subject {0}, SHA-1 fingerprint {1}?") String approveRootCertificateTrust(String subject, String sha1Fingerprint); + + @DefaultMessage("Value of cluster configuration parameter {0} is empty") + String clusterSnapshotOptionValueEmpty(String option); + + @DefaultMessage("Value of volume configuration parameter {0} is empty") + String volumeSnapshotOptionValueEmpty(String option); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index 04f8e4c..3751880 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -3881,6 +3881,15 @@ @DefaultStringValue("No of snapshots") String noOfSnapshotsLabel(); + @DefaultStringValue("Cluster") + String volumeClusterLabel(); + + @DefaultStringValue("Volume") + String volumeNameLabel(); + + @DefaultStringValue("Snapshot") + String volumeSnapshotMainTabTitle(); + @DefaultStringValue("Options - Cluster") String configureClusterSnapshotOptions(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java index 8c188f1..9d2c4fd 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java @@ -42,6 +42,8 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.AddBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.BrickAdvancedDetailsPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.DetachGlusterHostsPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.ReplaceBrickPopupPresenterWidget; @@ -277,6 +279,8 @@ import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.AddBrickPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.BrickAdvancedDetailsPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.DetachGlusterHostsPopupView; +import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterClusterSnapshotConfigureOptionsPopupView; +import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterVolumeSnapshotConfigureOptionsPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickStatusPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.ReplaceBrickPopupView; @@ -765,6 +769,12 @@ SubTabClusterCpuProfilePresenter.ViewDef.class, SubTabClusterCpuProfileView.class, SubTabClusterCpuProfilePresenter.ProxyDef.class); + bindPresenterWidget(GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.class, + GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.ViewDef.class, + GlusterVolumeSnapshotConfigureOptionsPopupView.class); + bindPresenterWidget(GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.class, + GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.ViewDef.class, + GlusterClusterSnapshotConfigureOptionsPopupView.class); // Host bindPresenter(HostSubTabPanelPresenter.class, diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java index be3422c..aada9ef 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java @@ -30,6 +30,8 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.event.EventPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.AddBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.BrickAdvancedDetailsPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.ReplaceBrickPopupPresenterWidget; @@ -69,6 +71,12 @@ else if(lastExecutedCommand == getModel().getShowVolumeProfileDetailsCommand() || lastExecutedCommand.getName().equals("showProfileDetails")) {//$NON-NLS-1$ return volumeProfileStatsPopupProvider.get(); } + else if (lastExecutedCommand == getModel().getConfigureVolumeSnapshotOptionsCommand()) { + return volumeSnapshotConfigOptionsPopupProvider.get(); + } + else if (lastExecutedCommand == getModel().getConfigureClusterSnapshotOptionsCommand()) { + return clusterSnapshotConfigOptionsPopupProvider.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/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.java new file mode 100644 index 0000000..8ef4198 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.java @@ -0,0 +1,28 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster; + +import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; +import org.ovirt.engine.ui.common.presenter.popup.DefaultConfirmationPopupPresenterWidget; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel; + +import com.google.gwt.event.shared.EventBus; +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget extends AbstractModelBoundPopupPresenterWidget<GlusterClusterSnapshotConfigModel, GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.ViewDef> { + @Inject + public GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget(EventBus eventBus, + ViewDef view, + Provider<GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget> snapshotPopupProvider, + Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupPrivder) { + super(eventBus, view); + } + + @Override + public void init(final GlusterClusterSnapshotConfigModel model) { + super.init(model); + } + + public interface ViewDef extends AbstractModelBoundPopupPresenterWidget.ViewDef<GlusterClusterSnapshotConfigModel> { + } + +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.java new file mode 100644 index 0000000..67f7e7f --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.java @@ -0,0 +1,27 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster; + +import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; +import org.ovirt.engine.ui.common.presenter.popup.DefaultConfirmationPopupPresenterWidget; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel; + +import com.google.gwt.event.shared.EventBus; +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget extends AbstractModelBoundPopupPresenterWidget<GlusterVolumeSnapshotConfigModel, GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.ViewDef> { + @Inject + public GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget(EventBus eventBus, + ViewDef view, + Provider<GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget> snapshotPopupProvider, + Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupPrivder) { + super(eventBus, view); + } + + @Override + public void init(final GlusterVolumeSnapshotConfigModel model) { + super.init(model); + } + + public interface ViewDef extends AbstractModelBoundPopupPresenterWidget.ViewDef<GlusterVolumeSnapshotConfigModel> { + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.java new file mode 100644 index 0000000..c368dcc --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.java @@ -0,0 +1,125 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster; + +import org.ovirt.engine.core.common.businessentities.VDSGroup; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig; +import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; +import org.ovirt.engine.ui.common.idhandler.WithElementId; +import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; +import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; +import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable; +import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor; +import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer; +import org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationResources; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget; + +import com.google.gwt.cell.client.FieldUpdater; +import com.google.gwt.cell.client.TextInputCell; +import com.google.gwt.core.shared.GWT; +import com.google.gwt.editor.client.SimpleBeanEditorDriver; +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.cellview.client.Column; +import com.google.gwt.user.client.ui.Label; +import com.google.inject.Inject; + +public class GlusterClusterSnapshotConfigureOptionsPopupView extends AbstractModelBoundPopupView<GlusterClusterSnapshotConfigModel> implements GlusterClusterSnapshotConfigureOptionsPopupPresenterWidget.ViewDef { + interface Driver extends SimpleBeanEditorDriver<GlusterClusterSnapshotConfigModel, GlusterClusterSnapshotConfigureOptionsPopupView> { + } + + interface ViewUiBinder extends UiBinder<SimpleDialogPanel, GlusterClusterSnapshotConfigureOptionsPopupView> { + ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); + } + + interface ViewIdHandler extends ElementIdHandler<GlusterClusterSnapshotConfigureOptionsPopupView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @UiField + @Ignore + @WithElementId + Label snapshotConfigHeader; + + @UiField(provided = true) + @Path(value = "clusters.selectedItem") + @WithElementId + ListModelListBoxEditor<VDSGroup> clusterEditor; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelCellTable<ListModel<EntityModel<GlusterVolumeSnapshotConfig>>> configsTable; + + private final ApplicationConstants constants; + + private final Driver driver = GWT.create(Driver.class); + + @Inject + public GlusterClusterSnapshotConfigureOptionsPopupView(EventBus eventBus, + ApplicationResources resources, + ApplicationConstants constants) { + super(eventBus, resources); + this.constants = constants; + initEditors(); + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + ViewIdHandler.idHandler.generateAndSetIds(this); + localize(); + driver.initialize(this); + } + + private void initEditors() { + clusterEditor = new ListModelListBoxEditor<VDSGroup>(new NullSafeRenderer<VDSGroup>() { + @Override + protected String renderNullSafe(VDSGroup object) { + return object.getName(); + } + }); + + configsTable = + new EntityModelCellTable<ListModel<EntityModel<GlusterVolumeSnapshotConfig>>>(false, true); + + configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() { + @Override + public String getText(GlusterVolumeSnapshotConfig object) { + return object.getParamName(); + } + }, constants.volumeSnapshotConfigName(), "200px"); //$NON-NLS-1$ + + Column<EntityModel, String> valueColumn = new Column<EntityModel, String>(new TextInputCell()) { + @Override + public String getValue(EntityModel object) { + return ((GlusterVolumeSnapshotConfig) object.getEntity()).getParamValue(); + } + }; + configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px"); //$NON-NLS-1$ + + valueColumn.setFieldUpdater(new FieldUpdater<EntityModel, String>() { + + @Override + public void update(int index, EntityModel object, String value) { + ((GlusterVolumeSnapshotConfig) object.getEntity()).setParamValue(value); + } + }); + } + + private void localize() { + clusterEditor.setLabel(constants.volumeClusterLabel()); + snapshotConfigHeader.setText(constants.snapshotConfigHeaderLabel()); + } + + @Override + public void edit(final GlusterClusterSnapshotConfigModel object) { + driver.edit(object); + configsTable.asEditor().edit(object.getClusterConfigOptions()); + } + + @Override + public GlusterClusterSnapshotConfigModel flush() { + return driver.flush(); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.ui.xml new file mode 100644 index 0000000..cf1767c --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterClusterSnapshotConfigureOptionsPopupView.ui.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> +<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" + xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog" + xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor" xmlns:w="urn:import:org.ovirt.engine.ui.common.widget" + xmlns:ge="urn:import:org.ovirt.engine.ui.common.widget.editor.generic"> + + <ui:style> + .tablePanel { + padding: 5px; + border: 1px solid #CED8DF; + width: + 450px; + } + + .panelStyle { + width:470px; + } + + .headerLabel { + font-weight: bold; + padding-bottom: 5px; + padding-top: 30px; + } + </ui:style> + + <d:SimpleDialogPanel width="550px" height="400px"> + <d:content> + <g:FlowPanel addStyleNames="{style.panelStyle}"> + <e:ListModelListBoxEditor + ui:field="clusterEditor" /> + <g:Label ui:field="snapshotConfigHeader" addStyleNames="{style.headerLabel}" /> + <e:EntityModelCellTable ui:field="configsTable" + addStyleNames="{style.tablePanel}" /> + </g:FlowPanel> + </d:content> + </d:SimpleDialogPanel> + +</ui:UiBinder> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.java new file mode 100644 index 0000000..1f41dae --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.java @@ -0,0 +1,129 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster; + +import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; +import org.ovirt.engine.ui.common.idhandler.WithElementId; +import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; +import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; +import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable; +import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelLabelEditor; +import org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationResources; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget; + +import com.google.gwt.cell.client.FieldUpdater; +import com.google.gwt.cell.client.TextInputCell; +import com.google.gwt.core.shared.GWT; +import com.google.gwt.editor.client.SimpleBeanEditorDriver; +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.cellview.client.Column; +import com.google.gwt.user.client.ui.Label; +import com.google.inject.Inject; + +public class GlusterVolumeSnapshotConfigureOptionsPopupView extends AbstractModelBoundPopupView<GlusterVolumeSnapshotConfigModel> implements GlusterVolumeSnapshotConfigureOptionsPopupPresenterWidget.ViewDef { + interface Driver extends SimpleBeanEditorDriver<GlusterVolumeSnapshotConfigModel, GlusterVolumeSnapshotConfigureOptionsPopupView> { + } + + interface ViewUiBinder extends UiBinder<SimpleDialogPanel, GlusterVolumeSnapshotConfigureOptionsPopupView> { + ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); + } + + interface ViewIdHandler extends ElementIdHandler<GlusterVolumeSnapshotConfigureOptionsPopupView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @UiField + @Ignore + @WithElementId + Label snapshotConfigHeader; + + @UiField + @Path(value = "clusterName.entity") + @WithElementId + StringEntityModelLabelEditor clusterNameEditor; + + @UiField + @Path(value = "volumeName.entity") + @WithElementId + StringEntityModelLabelEditor volumeNameEditor; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelCellTable<ListModel<EntityModel<VolumeSnapshotOptionModel>>> configsTable; + + private final ApplicationConstants constants; + + private final Driver driver = GWT.create(Driver.class); + + @Inject + public GlusterVolumeSnapshotConfigureOptionsPopupView(EventBus eventBus, + ApplicationResources resources, + ApplicationConstants constants) { + super(eventBus, resources); + this.constants = constants; + initEditors(); + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + ViewIdHandler.idHandler.generateAndSetIds(this); + localize(); + driver.initialize(this); + } + + private void initEditors() { + configsTable = + new EntityModelCellTable<ListModel<EntityModel<VolumeSnapshotOptionModel>>>(false, true); + + configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() { + @Override + public String getText(VolumeSnapshotOptionModel object) { + return object.getOptionName(); + } + }, constants.volumeSnapshotConfigName(), "150px"); //$NON-NLS-1$ + + configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() { + @Override + public String getText(VolumeSnapshotOptionModel object) { + return object.getCorrespodingClusterValue(); + } + }, constants.clusterSnapshotConfigValue(), "200px"); //$NON-NLS-1$ + + Column<EntityModel, String> valueColumn = new Column<EntityModel, String>(new TextInputCell()) { + @Override + public String getValue(EntityModel object) { + return ((VolumeSnapshotOptionModel)object.getEntity()).getOptionValue(); + } + }; + configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px"); //$NON-NLS-1$ + + valueColumn.setFieldUpdater(new FieldUpdater<EntityModel, String>() { + + @Override + public void update(int index, EntityModel object, String value) { + ((VolumeSnapshotOptionModel)object.getEntity()).setOptionValue(value); + } + }); + } + + private void localize() { + clusterNameEditor.setLabel(constants.volumeClusterLabel()); + volumeNameEditor.setLabel(constants.volumeNameLabel()); + snapshotConfigHeader.setText(constants.snapshotConfigHeaderLabel()); + } + + @Override + public void edit(final GlusterVolumeSnapshotConfigModel object) { + driver.edit(object); + configsTable.asEditor().edit(object.getConfigOptions()); + } + + @Override + public GlusterVolumeSnapshotConfigModel flush() { + return driver.flush(); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.ui.xml new file mode 100644 index 0000000..b1bef9b --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotConfigureOptionsPopupView.ui.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> +<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" + xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog" + xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor" xmlns:w="urn:import:org.ovirt.engine.ui.common.widget" + xmlns:ge="urn:import:org.ovirt.engine.ui.common.widget.editor.generic"> + + <ui:style> + .tablePanel { + padding: 5px; + border: 1px solid #CED8DF; + width: + 450px; + } + + .panelStyle { + width:470px; + } + + .headerLabel { + font-weight: bold; + padding-bottom: 5px; + padding-top: 30px; + } + </ui:style> + + <d:SimpleDialogPanel width="550px" height="400px"> + <d:content> + <g:FlowPanel addStyleNames="{style.panelStyle}"> + <ge:StringEntityModelLabelEditor + ui:field="clusterNameEditor" /> + <ge:StringEntityModelLabelEditor + ui:field="volumeNameEditor" /> + <g:Label ui:field="snapshotConfigHeader" addStyleNames="{style.headerLabel}" /> + <e:EntityModelCellTable ui:field="configsTable" + addStyleNames="{style.tablePanel}" /> + </g:FlowPanel> + </d:content> + </d:SimpleDialogPanel> + +</ui:UiBinder> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java index 9335f85..d97f2f9 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java @@ -221,7 +221,35 @@ return getMainModel().getStopVolumeProfilingCommand(); } }); - getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterVolumeEntity>(constants.volumeProfilingAction(), volumeProfilingActions, CommandLocation.ContextAndToolBar)); + + getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterVolumeEntity>(constants.volumeProfilingAction(), + volumeProfilingActions, + CommandLocation.ContextAndToolBar)); + + getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterVolumeEntity>(constants.volumeSnapshotMainTabTitle(), + getVolumeSnapshotMenu(constants), + CommandLocation.ContextAndToolBar)); + } + + private List<ActionButtonDefinition<GlusterVolumeEntity>> getVolumeSnapshotMenu(ApplicationConstants constants) { + List<ActionButtonDefinition<GlusterVolumeEntity>> snapshotMenu = new ArrayList<ActionButtonDefinition<GlusterVolumeEntity>>(); + + WebAdminButtonDefinition<GlusterVolumeEntity> configureClusterSnapshotOptionsButton = new WebAdminButtonDefinition<GlusterVolumeEntity>(constants.configureClusterSnapshotOptions()) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getConfigureClusterSnapshotOptionsCommand(); + } + }; + WebAdminButtonDefinition<GlusterVolumeEntity> configureVolumeSnapshotOptionsButton = new WebAdminButtonDefinition<GlusterVolumeEntity>(constants.configureVolumeSnapshotOptions()) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getConfigureVolumeSnapshotOptionsCommand(); + } + }; + + snapshotMenu.add(configureClusterSnapshotOptionsButton); + snapshotMenu.add(configureVolumeSnapshotOptionsButton); + return snapshotMenu; } private MenuCell<GlusterTaskSupport> getRebalanceActivityMenu(ApplicationConstants constants) { -- To view, visit https://gerrit.ovirt.org/39352 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I08b5e592b818266106bc1891c3aa2f3ba3541d36 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: Shubhendu Tripathi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
