anmolbabu has uploaded a new change for review. Change subject: webadmin : Create + Delete Geo-rep session ......................................................................
webadmin : Create + Delete Geo-rep session This patch adds create and delete geo-rep session. Change-Id: Ied7317d456bf66db9a7800ba7106f2e8ec66429c Signed-off-by: Anmol Babu <[email protected]> --- 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 M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepCreateModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.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/GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java 16 files changed, 995 insertions(+), 47 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/40131/1 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 401959e..0cf2106 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 @@ -72,6 +72,7 @@ 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.GlusterClusterService; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason; import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService; @@ -138,6 +139,7 @@ import org.ovirt.engine.core.common.queries.gluster.GlusterServersQueryParameters; import org.ovirt.engine.core.common.queries.gluster.GlusterServiceQueryParameters; import org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters; +import org.ovirt.engine.core.common.queries.gluster.GlusterVolumeGeoRepEligibilityParameters; import org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters; import org.ovirt.engine.core.common.queries.gluster.GlusterVolumeQueriesParameters; import org.ovirt.engine.core.common.utils.ObjectUtils; @@ -1592,6 +1594,21 @@ Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeGeoRepSessions, new IdQueryParameters(masterVolumeId), aQuery); } + public void getGlusterVolumeGeoRepRecommendationViolations(AsyncQuery aQuery, + Guid masterVolumeId, + Guid slaveVolumeId) { + aQuery.converterCallback = new IAsyncConverter() { + @Override + public Object Convert(Object returnValue, AsyncQuery asyncQuery) { + return returnValue == null ? new ArrayList<GlusterGeoRepNonEligibilityReason>() + : (List<GlusterGeoRepNonEligibilityReason>) returnValue; + } + }; + Frontend.getInstance().runQuery(VdcQueryType.GetNonEligibilityReasonsOfVolumeForGeoRepSession, + new GlusterVolumeGeoRepEligibilityParameters(masterVolumeId, slaveVolumeId), + aQuery); + } + public static void getGlusterHook(AsyncQuery aQuery, Guid hookId, boolean includeServerHooks) { aQuery.converterCallback = new IAsyncConverter() { @Override 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 56e7209..ef383c9 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 @@ -484,18 +484,6 @@ volume_snapshots("volume_snapshots", HelpTagType.WEBADMIN), //$NON-NLS-1$ - volume_geo_rep_start_confirmation("volume_geo_rep_start_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Start' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - - volume_geo_rep_stop_confirmation("volume_geo_rep_stop_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Stop' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - - volume_geo_rep_pause_confirmation("volume_geo_rep_pause_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Pause' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - - volume_geo_rep_resume_confirmation("volume_geo_rep_resume_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Resume' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - - volume_geo_rep_configuration_display("volume_geo_rep_configuration_display", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Options' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - - volume_geo_rep_config_multiple_action_error_display("volume_geo_rep_config_multiple_action_error_display", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> Options -> 'Set/Reset' error dialog"), //$NON-NLS-1$ //$NON-NLS-2$ - volume_restore_snapshot_confirmation( "volume_restore_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Restore Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ @@ -511,6 +499,22 @@ volume_deactivate_snapshot_confirmation( "volume_deactivate_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Deactivate Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + volume_geo_rep_create("volume_geo_rep_create", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'New' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_start_confirmation("volume_geo_rep_start_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Start' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_stop_confirmation("volume_geo_rep_stop_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Stop' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_pause_confirmation("volume_geo_rep_pause_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Pause' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_resume_confirmation("volume_geo_rep_resume_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Resume' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_remove_confirmation("volume_geo_rep_remove_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Remove' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_configuration_display("volume_geo_rep_configuration_display", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 'Options' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + + volume_geo_rep_config_multiple_action_error_display("volume_geo_rep_config_multiple_action_error_display", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> Options -> 'Set/Reset' error dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + new_role("new_role", HelpTagType.WEBADMIN), //$NON-NLS-1$ edit_role("edit_role", HelpTagType.WEBADMIN), //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java index 963113e..2a40ea9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java @@ -1,6 +1,5 @@ package org.ovirt.engine.ui.uicommonweb.models.gluster; -import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.Model; import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; @@ -26,11 +25,11 @@ } - protected void initWindow(GlusterGeoRepSession selectedSession) { + protected void initWindow(String masterVolume, String slaveVolume, String slaveHost) { getForce().setEntity(false); - getMasterVolume().setEntity(selectedSession.getMasterVolumeName()); - getSlaveVolume().setEntity(selectedSession.getSlaveVolumeName()); - getSlaveHost().setEntity(selectedSession.getSlaveHostName()); + getMasterVolume().setEntity(masterVolume); + getSlaveVolume().setEntity(slaveVolume); + getSlaveHost().setEntity(slaveHost); } public EntityModel<String> getMasterVolume() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepCreateModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepCreateModel.java new file mode 100644 index 0000000..c6012b8 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepCreateModel.java @@ -0,0 +1,316 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.interfaces.SearchType; +import org.ovirt.engine.core.common.queries.IdQueryParameters; +import org.ovirt.engine.core.common.queries.SearchParameters; +import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; +import org.ovirt.engine.core.common.queries.VdcQueryType; +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.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.help.HelpTag; +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.uicommonweb.validation.AsciiNameValidation; +import org.ovirt.engine.ui.uicommonweb.validation.IValidation; +import org.ovirt.engine.ui.uicommonweb.validation.LengthValidation; +import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; +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; +import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; +import org.ovirt.engine.ui.uicompat.UIConstants; +import org.ovirt.engine.ui.uicompat.UIMessages; + +public class GlusterVolumeGeoRepCreateModel extends Model{ + + private EntityModel<Boolean> showEligibleVolumes; + private EntityModel<String> slaveUserName; + private ListModel<GlusterVolumeEntity> slaveVolumes; + private ListModel<String> slaveClusters; + private ListModel<String> slaveHosts; + private EntityModel<Boolean> startSession; + private String queryFailureMessage; + private Collection<GlusterVolumeEntity> volumeList = new ArrayList<GlusterVolumeEntity>(); + private final UIConstants constants = ConstantsManager.getInstance().getConstants(); + private final UIMessages messages = ConstantsManager.getInstance().getMessages(); + private GlusterVolumeEntity masterVolume; + private String recommendationViolations; + private EntityModel<String> slaveUserGroupName; + + public GlusterVolumeGeoRepCreateModel(GlusterVolumeEntity masterVolume) { + this.masterVolume = masterVolume; + init(); + initValueChangeListeners(); + } + + private void initValueChangeListeners() { + getShowEligibleVolumes().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + if (!getShowEligibleVolumes().getEntity()) { + getVolumesForForceSessionCreate(); + } else { + getEligibleVolumes(); + setRecommendationViolations(null); + } + } + }); + + IEventListener<EventArgs> clusterEventListener = new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + String selectedCluster = getSlaveClusters().getSelectedItem(); + List<GlusterVolumeEntity> volumesInCurrentCluster = new ArrayList<GlusterVolumeEntity>(); + if (selectedCluster != null) { + volumesInCurrentCluster = getVolumesInCluster(selectedCluster, getVolumeList()); + } + if (volumesInCurrentCluster.size() > 0) { + getSlaveVolumes().setItems(volumesInCurrentCluster, volumesInCurrentCluster.get(0)); + } else { + getSlaveVolumes().setItems(volumesInCurrentCluster); + } + } + }; + getSlaveClusters().getSelectedItemChangedEvent().addListener(clusterEventListener); + + IEventListener<EventArgs> slaveVolumeEventListener = new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + GlusterVolumeEntity selectedSlaveVolume = getSlaveVolumes().getSelectedItem(); + Set<String> hostsInCurrentVolume = new HashSet<String>(); + if (!getShowEligibleVolumes().getEntity() && selectedSlaveVolume != null) { + updateRecommendatonViolations(); + } + if (selectedSlaveVolume != null) { + hostsInCurrentVolume = getHostNamesForVolume(selectedSlaveVolume); + } + getSlaveHosts().setItems(hostsInCurrentVolume); + } + }; + getSlaveVolumes().getSelectedItemChangedEvent().addListener(slaveVolumeEventListener); + + getSlaveUserName().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + String slaveUser = getSlaveUserName().getEntity(); + getSlaveUserGroupName().setIsChangable(slaveUser != null && !slaveUser.equalsIgnoreCase(ConstantsManager.getInstance().getConstants().rootUser())); + } + }); + } + + public void getVolumesForForceSessionCreate() { + GlusterVolumeGeoRepCreateModel.this.startProgress(constants.fetchingDataMessage()); + AsyncQuery _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object ReturnValue) + { + showAvailableVolumes(ReturnValue); + } + + }; + SearchParameters volumesSearchParameters = new SearchParameters("Volumes:", SearchType.GlusterVolume, false);//$NON-NLS-1$ + volumesSearchParameters.setRefresh(true); + + Frontend.getInstance().runQuery(VdcQueryType.Search, volumesSearchParameters, _asyncQuery); + } + + private void showAvailableVolumes(Object returnValue) { + VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; + GlusterVolumeGeoRepCreateModel.this.stopProgress(); + if(!vdcReturnValue.getSucceeded()) { + setQueryFailureMessage(vdcReturnValue.getExceptionString()); + } else { + setVolumeList((Collection) vdcReturnValue.getReturnValue()); + Set<String> clusterForVolumes = getClusterForVolumes(getVolumeList()); + getSlaveClusters().setItems(clusterForVolumes, clusterForVolumes.iterator().next()); + } + } + + public void getEligibleVolumes() { + this.startProgress(constants.fetchingDataMessage()); + AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + showAvailableVolumes(returnValue); + } + }); + + Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); + } + + protected Set<String> getClusterForVolumes(Collection<GlusterVolumeEntity> eligibleVolumes) { + Set<String> clusters = new HashSet<String>(); + for(GlusterVolumeEntity currentVolume : eligibleVolumes) { + clusters.add(currentVolume.getVdsGroupName()); + } + return clusters; + } + + public List<GlusterVolumeEntity> getVolumesInCluster(String cluster, Collection<GlusterVolumeEntity> volumes) { + List<GlusterVolumeEntity> volumesInCurrentCluster= new ArrayList<GlusterVolumeEntity>(); + for(GlusterVolumeEntity currentVolume : volumes) { + if(currentVolume.getVdsGroupName().equals(cluster)) { + volumesInCurrentCluster.add(currentVolume); + } + } + return volumesInCurrentCluster; + } + + public Set<String> getHostNamesForVolume(GlusterVolumeEntity volume) { + Set<String> hosts = new HashSet<String>(); + for(GlusterBrickEntity currentBrick : volume.getBricks()) { + hosts.add(currentBrick.getServerName()); + } + return hosts; + } + + public ListModel<String> getSlaveClusters() { + return slaveClusters; + } + + public void setSlaveClusters(ListModel<String> slaveClusters) { + this.slaveClusters = slaveClusters; + } + + public ListModel<String> getSlaveHosts() { + return slaveHosts; + } + + public void setSlaveHosts(ListModel<String> slaveHosts) { + this.slaveHosts = slaveHosts; + } + + public Collection<GlusterVolumeEntity> getVolumeList() { + return volumeList; + } + + public void setVolumeList(Collection<GlusterVolumeEntity> volumeList) { + this.volumeList = volumeList; + onPropertyChanged(new PropertyChangedEventArgs("RecommendationViolations"));//$NON-NLS-1$ + } + + private void init() { + setTitle(constants.newGeoRepSessionTitle()); + setHelpTag(HelpTag.volume_geo_rep_create); + setHashName("volume_geo_rep_create");//$NON-NLS-1$ + + setShowEligibleVolumes(new EntityModel<Boolean>()); + setSlaveClusters(new ListModel<String>()); + setSlaveVolumes(new ListModel<GlusterVolumeEntity>()); + setSlaveHosts(new ListModel<String>()); + + setStartSession(new EntityModel<Boolean>()); + setSlaveUserName(new EntityModel<String>(constants.emptyString())); + setSlaveUserGroupName(new EntityModel<String>()); + } + + public EntityModel<String> getSlaveUserName() { + return slaveUserName; + } + + public void setSlaveUserName(EntityModel<String> slaveUserName) { + this.slaveUserName = slaveUserName; + } + + public ListModel<GlusterVolumeEntity> getSlaveVolumes() { + return slaveVolumes; + } + + public void setSlaveVolumes(ListModel<GlusterVolumeEntity> slaveVolumeSelected) { + this.slaveVolumes = slaveVolumeSelected; + } + + public EntityModel<Boolean> getStartSession() { + return startSession; + } + + public void setStartSession(EntityModel<Boolean> startSession) { + this.startSession = startSession; + } + + public EntityModel<Boolean> getShowEligibleVolumes() { + return showEligibleVolumes; + } + + public void setShowEligibleVolumes(EntityModel<Boolean> showEligibleVolumes) { + this.showEligibleVolumes = showEligibleVolumes; + } + + public GlusterVolumeEntity getMasterVolume() { + return masterVolume; + } + + public void setMasterVolume(GlusterVolumeEntity masterVolume) { + this.masterVolume = masterVolume; + } + + public String getRecommendationViolations() { + return recommendationViolations; + } + + public void setRecommendationViolations(String recommendationViolations) { + this.recommendationViolations = recommendationViolations; + onPropertyChanged(new PropertyChangedEventArgs("RecommendationViolations"));//$NON-NLS-1$ + } + + public void updateRecommendatonViolations() { + startProgress(constants.fetchingDataMessage()); + AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + GlusterVolumeGeoRepCreateModel.this.stopProgress(); + List<GlusterGeoRepNonEligibilityReason> eligibilityViolators = (List<GlusterGeoRepNonEligibilityReason>) returnValue; + if(eligibilityViolators.size() > 0) { + StringBuilder configViolations = new StringBuilder(constants.geoReplicationRecommendedConfigViolation()); + for(GlusterGeoRepNonEligibilityReason currentViolator : eligibilityViolators) { + configViolations.append("\n* ");//$NON-NLS-1$ + configViolations.append(messages.geoRepEligibilityViolations(currentViolator)); + } + setRecommendationViolations(configViolations.toString()); + } else { + setRecommendationViolations(null); + } + } + }); + AsyncDataProvider.getInstance().getGlusterVolumeGeoRepRecommendationViolations(aQuery, masterVolume.getId(), getSlaveVolumes().getSelectedItem().getId()); + } + + public boolean validate() { + getSlaveVolumes().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128), + new AsciiNameValidation() }); + getSlaveHosts().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(128)}); + return getSlaveVolumes().getIsValid() && getSlaveHosts().getIsValid(); + } + + public String getQueryFailureMessage() { + return queryFailureMessage; + } + + public void setQueryFailureMessage(String queryFailureMessage) { + this.queryFailureMessage = queryFailureMessage; + onPropertyChanged(new PropertyChangedEventArgs("QueryFailed"));//$NON-NLS-1$ + } + + public EntityModel<String> getSlaveUserGroupName() { + return slaveUserGroupName; + } + + public void setSlaveUserGroupName(EntityModel<String> slaveUserGroupName) { + this.slaveUserGroupName = slaveUserGroupName; + } +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java index e3541fe..f5f2637 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java @@ -17,6 +17,14 @@ import org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.core.common.queries.IdQueryParameters; +import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; +import org.ovirt.engine.core.common.queries.VdcQueryType; +import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.ui.frontend.AsyncQuery; import org.ovirt.engine.ui.frontend.Frontend; import org.ovirt.engine.ui.frontend.INewAsyncCallback; @@ -185,11 +193,13 @@ } private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { + boolean allowNewGeoRepSessionCommand = true; boolean allowStartSessionCommand = false; boolean allowStopSessionCommand = false; boolean allowResumeSessionCommand = false; boolean allowPauseSessionCommand = false; boolean allowSessionOptionsCommand = false; + boolean allowRemoveSessionCommand = false; if(volumeEntity == null) { return; } @@ -203,9 +213,11 @@ allowPauseSessionCommand = sessionStatus == GeoRepSessionStatus.ACTIVE || sessionStatus == GeoRepSessionStatus.INITIALIZING; allowSessionOptionsCommand = true; + allowNewGeoRepSessionCommand = volumeEntity.getStatus() == GlusterStatus.UP; + allowRemoveSessionCommand = true; } - getNewSessionCommand().setIsAvailable(true); - getRemoveSessionCommand().setIsAvailable(false); + getNewSessionCommand().setIsExecutionAllowed(allowNewGeoRepSessionCommand); + getRemoveSessionCommand().setIsExecutionAllowed(allowRemoveSessionCommand); getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand); getStopSessionCommand().setIsExecutionAllowed(allowStopSessionCommand); getPauseSessionCommand().setIsExecutionAllowed(allowPauseSessionCommand); @@ -218,8 +230,10 @@ @Override public void executeCommand(UICommand command) { super.executeCommand(command); - if (command.equals(getRemoveSessionCommand())) { - + if (command.equals(getNewSessionCommand())) { + createGeoRepSession(); + } else if (command.equals(getRemoveSessionCommand())) { + removeGeoRepSession(); } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { @@ -234,6 +248,8 @@ } else if (command.equals(getRefreshSessionsCommand())) { refreshSessions(); + } else if (command.getName().equalsIgnoreCase("onCreateSession")) {//$NON-NLS-1$ + onCreateSession(); } else if (command.getName().equalsIgnoreCase("onStartGeoRepSession")) {//$NON-NLS-1$ onGeoRepSessionAction(VdcActionType.StartGlusterVolumeGeoRep); } else if (command.getName().equalsIgnoreCase("onStopGeoRepSession")) {//$NON-NLS-1$ @@ -242,6 +258,8 @@ onGeoRepSessionAction(VdcActionType.PauseGlusterVolumeGeoRepSession); } else if (command.getName().equalsIgnoreCase("onResumeGeoRepSession")) {//$NON-NLS-1$ onGeoRepSessionAction(VdcActionType.ResumeGeoRepSession); + } else if (command.getName().equalsIgnoreCase("onRemoveGeoRepSession")) {//$NON-NLS-1$ + onGeoRepSessionAction(VdcActionType.DeleteGeoRepSession); } else if (command.getName().equalsIgnoreCase("ok")) {//$NON-NLS-1$ updateConfig(); } else if (command.getName().equalsIgnoreCase("closeWindow")) {//$NON-NLS-1$ @@ -359,6 +377,88 @@ geoRepConfigModel.addCancelCommand(cancelCommand); } + private void onCreateSession() { + final GlusterVolumeGeoRepCreateModel createModel = (GlusterVolumeGeoRepCreateModel) getWindow(); + if (!createModel.validate()) { + return; + } + createModel.startProgress(null); + final Guid masterVolumeId = getEntity().getId(); + final String remoteVolumeName = createModel.getSlaveVolumes().getSelectedItem().getName(); + final String remoteHostName = createModel.getSlaveHosts().getSelectedItem(); + String remoteUserName = createModel.getSlaveUserName().getEntity(); + String remoteUserGroup = createModel.getSlaveUserGroupName().getEntity(); + Frontend.getInstance().runAction(VdcActionType.CreateGlusterVolumeGeoRepSession, + new GlusterVolumeGeoRepSessionParameters(masterVolumeId, + remoteVolumeName, + remoteHostName, + remoteUserName, + remoteUserGroup, + !createModel.getShowEligibleVolumes().getEntity()), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + createModel.stopProgress(); + if (result.getReturnValue().getSucceeded()) { + closeWindow(); + if (createModel.getStartSession().getEntity()) { + initializeGeoRepActionConfirmation(constants.geoReplicationStartTitle(), HelpTag.volume_geo_rep_start_confirmation, "volume_geo_rep_start_confirmation", constants.geoRepForceHelp(), messages.geoRepForceTitle(constants.startGeoRep()), "onStartGeoRepSession", getEntity().getName(), remoteVolumeName, remoteHostName);//$NON-NLS-1$//$NON-NLS-2$ + final GlusterVolumeGeoRepActionConfirmationModel cModel = (GlusterVolumeGeoRepActionConfirmationModel) getWindow(); + cModel.startProgress(null); + Frontend.getInstance().runAction(VdcActionType.StartGlusterVolumeGeoRep, + new GlusterVolumeGeoRepSessionParameters(masterVolumeId, + remoteVolumeName, + remoteHostName), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + cModel.stopProgress(); + if (!result.getReturnValue().getSucceeded()) { + cModel.setMessage(result.getReturnValue().getFault().getMessage()); + } else { + closeWindow(); + } + } + }, + VolumeGeoRepListModel.this, + false); + } + } else { + createModel.setQueryFailureMessage(result.getReturnValue().getFault().getMessage()); + } + } + }, + this, + false); + } + + private void createGeoRepSession() { + if (getWindow() != null || getEntity() == null) { + return; + } + + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + + GlusterVolumeEntity selectedMasterVolume = getEntity(); + + final GlusterVolumeGeoRepCreateModel geoRepCreateModel = + new GlusterVolumeGeoRepCreateModel(selectedMasterVolume); + setWindow(geoRepCreateModel); + + geoRepCreateModel.getSlaveUserName().setEntity(constants.rootUser()); + geoRepCreateModel.getShowEligibleVolumes().setEntity(true); + + UICommand ok = new UICommand("onCreateSession", this);//$NON-NLS-1$ + ok.setTitle(constants.ok()); + ok.setIsDefault(true); + geoRepCreateModel.getCommands().add(ok); + + UICommand close = new UICommand("closeWindow", this);//$NON-NLS-1$ + close.setTitle(constants.cancel()); + close.setIsCancel(true); + geoRepCreateModel.getCommands().add(close); + } + private void closeWindow() { setWindow(null); } @@ -379,6 +479,10 @@ performGeoRepAction("onResumeGeoRepSession", constants.geoReplicationResumeTitle(), HelpTag.volume_geo_rep_resume_confirmation, "volume_geo_rep_resume_confirmation", constants.resumeGeoRep(), VdcActionType.ResumeGeoRepSession, constants.resumeGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$ } + private void removeGeoRepSession() { + performGeoRepAction("onRemoveGeoRepSession", constants.geoReplicationRemoveTitle(), HelpTag.volume_geo_rep_remove_confirmation, "volume_geo_rep_remove_confirmation", constants.removeGeoRep(), VdcActionType.DeleteGeoRepSession, constants.removeGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$ + } + private void performGeoRepAction(String commandName, String confirmTitle, HelpTag helpTag, @@ -391,12 +495,11 @@ return; } - initializeGeoRepActionConfirmation(confirmTitle, helpTag, hashName, constants.geoRepForceHelp(), messages.geoRepForceTitle(action), commandName); + initializeGeoRepActionConfirmation(confirmTitle, helpTag, hashName, constants.geoRepForceHelp(), messages.geoRepForceTitle(action), commandName, selectedSession.getMasterVolumeName(), selectedSession.getSlaveVolumeName(), selectedSession.getSlaveHostName()); onGeoRepSessionAction(actionType); } - private void initializeGeoRepActionConfirmation(String title, HelpTag helpTag, String hashName, String forceHelp, String forceLabelText, String commandName) { - GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) getSelectedItem(); + private void initializeGeoRepActionConfirmation(String title, HelpTag helpTag, String hashName, String forceHelp, String forceLabelText, String commandName, String masterVolumeName, String slaveVolumeName, String slaveHostName) { GlusterVolumeGeoRepActionConfirmationModel cModel = new GlusterVolumeGeoRepActionConfirmationModel(); cModel.setTitle(title); cModel.setHelpTag(helpTag); @@ -404,7 +507,7 @@ setWindow(cModel); - cModel.initWindow(selectedSession); + cModel.initWindow(masterVolumeName, slaveVolumeName, slaveHostName); cModel.setForceHelp(forceHelp); cModel.setForceLabel(forceLabelText); 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 1559d07..a6693f2 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 @@ -113,6 +113,17 @@ private UICommand stopVolumeProfilingCommand; private UICommand configureClusterSnapshotOptionsCommand; private UICommand configureVolumeSnapshotOptionsCommand; + private UICommand createSnapshotCommand; + private UICommand editSnapshotScheduleCommand; + private UICommand newGeoRepSessionCommand; + + public UICommand getNewGeoRepSessionCommand() { + return newGeoRepSessionCommand; + } + + public void setNewGeoRepSessionCommand(UICommand newGeoRepSessionCommand) { + this.newGeoRepSessionCommand = newGeoRepSessionCommand; + } public UICommand getStartRebalanceCommand() { return startRebalanceCommand; @@ -255,6 +266,9 @@ setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); //$NON-NLS-1$ setConfigureClusterSnapshotOptionsCommand(new UICommand("configureClusterSnapshotOptions", this)); //$NON-NLS-1$ setConfigureVolumeSnapshotOptionsCommand(new UICommand("configureVolumeSnapshotOptions", this)); //$NON-NLS-1$ + setCreateSnapshotCommand(new UICommand("createSnapshot", this)); //$NON-NLS-1$ + setEditSnapshotScheduleCommand(new UICommand("editSnapshotSchedule", this)); //$NON-NLS-1$ + setNewGeoRepSessionCommand(new UICommand("createGeoRepSession", this));//$NON-NLS-1$ getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); @@ -483,6 +497,9 @@ boolean allowProfileStatisticsDetails = false; boolean allowConfigureClusterSnapshotOptions = true; boolean allowConfigureVolumeSnapshotOptions = false; + boolean allowCreateSnapshot = false; + boolean allowEditSnapshotSchedule = false; + boolean allowCreateGeoRepSession = false; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowStart = false; @@ -524,6 +541,7 @@ && asyncTask.getType() == GlusterTaskType.REBALANCE && asyncTask.getStatus() == JobExecutionStatus.STARTED; allowConfigureVolumeSnapshotOptions = volumeEntity.getStatus() == GlusterStatus.UP; + allowCreateGeoRepSession = volumeEntity.getStatus() == GlusterStatus.UP; } else { allowStopRebalance = false; @@ -550,6 +568,7 @@ getStartVolumeProfilingCommand().setIsExecutionAllowed(allowStartProfiling); getStopVolumeProfilingCommand().setIsExecutionAllowed(allowStopProfiling); getShowVolumeProfileDetailsCommand().setIsExecutionAllowed(allowProfileStatisticsDetails); + getNewGeoRepSessionCommand().setIsExecutionAllowed(allowCreateGeoRepSession); } private boolean isStopProfileAvailable(List<GlusterVolumeEntity> list) { @@ -632,6 +651,8 @@ startRebalance(); } else if (command.equals(getStopRebalanceCommand())) { stopRebalance(); + } else if (command.equals(getNewGeoRepSessionCommand())) { + getGeoRepListModel().getNewSessionCommand().execute(); } else if (command.getName().equals("onStopRebalance")) { //$NON-NLS-1$ onStopRebalance(); } else if (command.equals(getStatusRebalanceCommand())) { 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 676ccbc..5a937b3 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 @@ -25,6 +25,9 @@ @DefaultStringValue("N/A") String notAvailableLabel(); + @DefaultStringValue("") + String emptyString(); + @DefaultStringValue("[N/A]") String bracketedNotAvailableLabel(); @@ -294,6 +297,9 @@ @DefaultStringValue("Resume Geo-Replication") String geoReplicationResumeTitle(); + @DefaultStringValue("Remove Geo-Replication") + String geoReplicationRemoveTitle(); + @DefaultStringValue("Start") String startGeoRepProgressText(); @@ -306,6 +312,9 @@ @DefaultStringValue("Resume") String resumeGeoRepProgressText(); + @DefaultStringValue("Remove") + String removeGeoRepProgressText(); + @DefaultStringValue("start") String startGeoRep(); @@ -317,6 +326,9 @@ @DefaultStringValue("resume") String resumeGeoRep(); + + @DefaultStringValue("remove") + String removeGeoRep(); @DefaultStringValue("Geo-Replication Options") String geoReplicationOptions(); @@ -2569,5 +2581,38 @@ @DefaultStringValue("Storage Devices") String storageDevices(); + + @DefaultStringValue("No week days selected") + String noWeekDaysSelectedMessage(); + + @DefaultStringValue("No month days selected") + String noMonthDaysSelectedMessage(); + + @DefaultStringValue("Last day of month cannot be selected with other month days") + String lastDayMonthCanBeSelectedAlone(); + + @DefaultStringValue("End by date cannot be equal to or before start date") + String endDateBeforeStartDate(); + + @DefaultStringValue("Unable to fetch gluster volume snapshot schedule") + String unableToFetchVolumeSnapshotSchedule(); + + @DefaultStringValue("Create Brick") + String createBrick(); + + @DefaultStringValue("Changing management network is only permitted via the 'Manage Cluster Networks' dialog.") + String prohibitManagementNetworkChangeInEditClusterInfoMessage(); + + @DefaultStringValue("No volume type") + String noCinderVolumeType(); + + @DefaultStringValue("New Geo-Replication Session") + String newGeoRepSessionTitle(); + + @DefaultStringValue("root") + String rootUser(); + + @DefaultStringValue("Warning : Recommendations for geo-replication not met -") + String geoReplicationRecommendedConfigViolation(); } 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 8085d6b..2cca3c8 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 @@ -2,6 +2,9 @@ import java.util.List; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotScheduleRecurrence; + public interface UIMessages extends com.google.gwt.i18n.client.Messages { @DefaultMessage("One of the parameters isn''t supported (available parameter(s): {0})") @@ -439,4 +442,30 @@ @DefaultMessage("Below snapshots would be removed. Do you want to continue?\n\n {0}") String confirmVolumeSnapshotDeleteMessage(String snapshotNames); + + @DefaultMessage("Incorrect enum") + @AlternateMessage({ + "UNKNOWN", "None", + "INTERVAL", "Minutely", + "HOURLY", "Hourly", + "DAILY", "Daily", + "WEEKLY", "Weekly", + "MONTHLY", "Monthly" + }) + String recurrenceType(@Select GlusterVolumeSnapshotScheduleRecurrence recurrence); + + @DefaultMessage("Session DB Id:{0}, User:{1}") + String userSessionRow(long sessionId, String UserName); + + @DefaultMessage("") + @AlternateMessage({ + "SLAVE_AND_MASTER_VOLUMES_SHOULD_NOT_BE_IN_SAME_CLUSTER", "Destination and master volumes should not be from same cluster.", + "SLAVE_VOLUME_SIZE_SHOULD_BE_GREATER_THAN_MASTER_VOLUME_SIZE", "Capacity of destination volume should be greater than or equal to that of master volume.", + "SLAVE_CLUSTER_AND_MASTER_CLUSTER_COMPATIBILITY_VERSIONS_DO_NOT_MATCH", "Cluster Compatibility version of destination and master volumes should be same.", + "SLAVE_VOLUME_SHOULD_NOT_BE_SLAVE_OF_ANOTHER_GEO_REP_SESSION", "Destination volume is already a part of another geo replication session.", + "SLAVE_VOLUME_SHOULD_BE_UP", "Destination volume should be up.", + "SLAVE_VOLUME_SIZE_TO_BE_AVAILABLE", "Capacity information of the destination volume is not available.", + "MASTER_VOLUME_SIZE_TO_BE_AVAILABLE", "Capacity information of the master volume is not available." + }) + String geoRepEligibilityViolations(@Select GlusterGeoRepNonEligibilityReason reason); } 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 269f048..40fbc9f 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 @@ -3941,15 +3941,6 @@ @DefaultStringValue("It is suggested to optimise a Volume for virt store if the volume is of replica-3 type") String newVolumeOptimiseForVirtStoreWarning(); - @DefaultStringValue("Master Volume") - String geoRepMasterVolume(); - - @DefaultStringValue("Host name (or) IP") - String geoRepSlaveHostIp(); - - @DefaultStringValue("Slave Volume") - String geoRepSlaveVolume(); - // Volume snapshots @DefaultStringValue("Name") String volumeSnapshotName(); @@ -4020,4 +4011,75 @@ @DefaultStringValue("Reset") String resetGeoRepSessionConfig(); + @DefaultStringValue("Frequent creation of snapshots would overload the cluster") + String criticalSnapshotIntervalNote(); + + @DefaultStringValue("Brick Name") + String logicalVolume(); + + @DefaultStringValue("Size") + String lvSize(); + + @DefaultStringValue("Create Brick") + String createBrick(); + + @DefaultStringValue("Extend Brick") + String extendBrick(); + + @DefaultStringValue("RAID Type") + String raidType(); + + @DefaultStringValue("No. of Physical Disks in RAID Volume") + String noOfPhysicalDisksInRaidVolume(); + + @DefaultStringValue("Stripe Size") + String stripeSize(); + + @DefaultStringValue("Choose storage devices of RAID type: ") + String getStorageDeviceSelectionInfo(); + + @DefaultStringValue("Auto-start geo-replication session after creation") + String geoRepSessionCreateAndStart(); + + @DefaultStringValue("Master Volume") + String geoRepMasterVolume(); + + @DefaultStringValue("Destination host") + String geoRepSlaveHostIp(); + + @DefaultStringValue("Slave User") + String geoRepSlaveUserName(); + + @DefaultStringValue("User") + String geoRepUserSessionCreate(); + + @DefaultStringValue("Show volumes eligible for geo-replication") + String geoRepShowEligibleVolumes(); + + @DefaultStringValue("User Name") + String geoRepSessionUserName(); + + @DefaultStringValue("User Group") + String slaveUserGroupName(); + + @DefaultStringValue("Password") + String geoRepSlaveNodePassword(); + + @DefaultStringValue("Destination cluster") + String geoRepSessionSlaveCluster(); + + @DefaultStringValue("Destination volume") + String geoRepSlaveVolume(); + + @DefaultStringValue("Geo-replication") + String geoReplicationMainTabTitle(); + + @DefaultStringValue("Show Volumes") + String selectGeoRepSlaveVolumeButtonLabel(); + + @DefaultStringValue("Fetching Data") + String fetchingDataMessage(); + + @DefaultStringValue("Warning : Recommendations for geo-replication not met -") + String geoReplicationRecommendedConfigViolation(); } 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 be727e6..1a3921b 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 @@ -43,6 +43,7 @@ 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.GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoRepCreateSessionPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; @@ -282,6 +283,8 @@ 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.GeoRepActionConfirmPopUpView; +import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterClusterSnapshotConfigureOptionsPopupView; +import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterVolumeGeoRepCreateSessionPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterVolumeGeoReplicationSessionConfigPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickStatusPopupView; @@ -1174,6 +1177,10 @@ GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget.ViewDef.class, GlusterVolumeGeoReplicationSessionConfigPopupView.class); + bindPresenterWidget(GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.class, + GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.ViewDef.class, + GlusterVolumeGeoRepCreateSessionPopupView.class); + bindPresenterWidget(RemoveBrickStatusPopupPresenterWidget.class, RemoveBrickStatusPopupPresenterWidget.ViewDef.class, RemoveBrickStatusPopupView.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 85176bc..c3d1ec2 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 @@ -33,6 +33,7 @@ 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.GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoRepCreateSessionPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; @@ -270,6 +271,38 @@ }; } + @Provides + @Singleton + public SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> getVolumeGeoRepListProvider(EventBus eventBus, + final Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, + final Provider<GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget> geoRepActionConfirmationPopupProvider, + final Provider<GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget> geoRepConfigPopupProvider, + final Provider<GlusterVolumeGeoRepCreateSessionPopupPresenterWidget> geoRepSessionCreatePopupProvider, + final Provider<VolumeListModel> mainModelProvider, + final Provider<VolumeGeoRepListModel> modelProvider) { + return new SearchableDetailTabModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel>(eventBus, + defaultConfirmPopupProvider, VolumeListModel.class, VolumeGeoRepListModel.class) { + @Override + public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(VolumeGeoRepListModel source, + UICommand lastExecutedCommand, + Model windowModel) { + if (lastExecutedCommand == getModel().getStartSessionCommand() + || lastExecutedCommand == getModel().getStopSessionCommand() + || lastExecutedCommand == getModel().getPauseSessionCommand() + || lastExecutedCommand == getModel().getResumeSessionCommand() + || lastExecutedCommand == getModel().getRemoveSessionCommand()) { + return geoRepActionConfirmationPopupProvider.get(); + } else if (lastExecutedCommand == getModel().getSessionOptionsCommand()) { + return geoRepConfigPopupProvider.get(); + } else if (lastExecutedCommand == getModel().getNewSessionCommand()) { + return geoRepSessionCreatePopupProvider.get(); + } else { + return geoRepActionConfirmationPopupProvider.get(); + } + } + }; + } + @Override protected void configure() { } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.java new file mode 100644 index 0000000..b328cd7 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.java @@ -0,0 +1,40 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster; + +import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeGeoRepCreateModel; +import org.ovirt.engine.ui.uicompat.Event; +import org.ovirt.engine.ui.uicompat.IEventListener; +import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; + +import com.google.gwt.event.shared.EventBus; +import com.google.inject.Inject; + +public class GlusterVolumeGeoRepCreateSessionPopupPresenterWidget extends AbstractModelBoundPopupPresenterWidget<GlusterVolumeGeoRepCreateModel, GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.ViewDef>{ + + @Inject + public GlusterVolumeGeoRepCreateSessionPopupPresenterWidget(EventBus eventBus, ViewDef view) { + super(eventBus, view); + } + + public interface ViewDef extends AbstractModelBoundPopupPresenterWidget.ViewDef<GlusterVolumeGeoRepCreateModel> { + public void setSuggestedConfigViolations(String recommendationViolations); + + public void setFailureMessage(String failureMessage); + } + + @Override + public void init(final GlusterVolumeGeoRepCreateModel model) { + super.init(model); + + model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { + @Override + public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { + if(args.propertyName.equalsIgnoreCase("RecommendationViolations")) {//$NON-NLS-1$ + getView().setSuggestedConfigViolations(model.getRecommendationViolations()); + } else if (args.propertyName.equalsIgnoreCase("QueryFailed")) {//$NON-NLS-1$ + getView().setFailureMessage(model.getQueryFailureMessage()); + } + } + }); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.java new file mode 100644 index 0000000..3f45a9c --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.java @@ -0,0 +1,205 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.ui.common.CommonApplicationTemplates; +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.Align; +import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; +import org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadListBoxEditor; +import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor; +import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxEditor; +import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeGeoRepCreateModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoRepCreateSessionPopupPresenterWidget; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.editor.client.SimpleBeanEditorDriver; +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.TextArea; +import com.google.inject.Inject; + +public class GlusterVolumeGeoRepCreateSessionPopupView extends AbstractModelBoundPopupView<GlusterVolumeGeoRepCreateModel> implements GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.ViewDef{ + + interface Driver extends SimpleBeanEditorDriver<GlusterVolumeGeoRepCreateModel, GlusterVolumeGeoRepCreateSessionPopupView> { + } + + interface ViewUiBinder extends UiBinder<SimpleDialogPanel, GlusterVolumeGeoRepCreateSessionPopupView> { + ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); + } + + interface ViewIdHandler extends ElementIdHandler<GlusterVolumeGeoRepCreateSessionPopupView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @UiField + WidgetStyle style; + + @UiField(provided = true) + @Path(value = "showEligibleVolumes.entity") + @WithElementId + EntityModelCheckBoxEditor showEligibleVolumes; + + @UiField(provided = true) + @Path(value = "slaveClusters.selectedItem") + @WithElementId + ListModelTypeAheadListBoxEditor<String> slaveClusterEditor; + + @UiField(provided = true) + @Path(value = "slaveHosts.selectedItem") + @WithElementId + ListModelTypeAheadListBoxEditor<String> slaveHostIpEditor; + + @UiField(provided = true) + @Path(value = "slaveVolumes.selectedItem") + @WithElementId + ListModelTypeAheadListBoxEditor<GlusterVolumeEntity> slaveVolumeEditor; + + @UiField + @Path(value = "slaveUserName.entity") + @WithElementId + StringEntityModelTextBoxEditor slaveUserName; + + @UiField + @Path(value = "slaveUserGroupName.entity") + @WithElementId + StringEntityModelTextBoxEditor slaveUserGroupNameEditor; + + @UiField(provided = true) + @Path(value = "startSession.entity") + @WithElementId + EntityModelCheckBoxEditor startSessionEditor; + + @UiField + @Ignore + @WithElementId + TextArea suggestedConfigViolations; + + @UiField + @Ignore + @WithElementId + Label message; + + private final ApplicationConstants constants; + + private final CommonApplicationTemplates templates; + + private final Driver driver = GWT.create(Driver.class); + + @Inject + public GlusterVolumeGeoRepCreateSessionPopupView(EventBus eventBus, + ApplicationConstants constants, + CommonApplicationTemplates templates) { + super(eventBus); + this.constants = constants; + this.templates = templates; + initEditors(); + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + ViewIdHandler.idHandler.generateAndSetIds(this); + localize(); + addStyles(); + driver.initialize(this); + setVisibilities(); + } + + private void setVisibilities() { + suggestedConfigViolations.setVisible(false); + } + + private void initEditors() { + showEligibleVolumes = new EntityModelCheckBoxEditor(Align.RIGHT); + + startSessionEditor = new EntityModelCheckBoxEditor(Align.RIGHT); + + slaveClusterEditor = new ListModelTypeAheadListBoxEditor<String>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<String>() { + + @Override + public String getReplacementStringNullSafe(String data) { + return data; + } + + @Override + public String getDisplayStringNullSafe(String data) { + return templates.typeAheadNameDescription(data == null ? constants.empty() : data, constants.empty()).asString(); + } + }); + + slaveHostIpEditor = new ListModelTypeAheadListBoxEditor<String>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<String>() { + + @Override + public String getReplacementStringNullSafe(String data) { + return data; + } + + @Override + public String getDisplayStringNullSafe(String data) { + return templates.typeAheadNameDescription(data == null ? constants.empty() : data, constants.empty()).asString(); + } + }); + + slaveVolumeEditor = new ListModelTypeAheadListBoxEditor<GlusterVolumeEntity>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<GlusterVolumeEntity>() { + @Override + public String getReplacementStringNullSafe(GlusterVolumeEntity data) { + return data.getName(); + } + + @Override + public String getDisplayStringNullSafe(GlusterVolumeEntity data) { + return templates.typeAheadNameDescription(data.getName() == null ? constants.empty() : data.getName(), data.getVdsGroupName() == null ? constants.empty() : data.getVdsGroupName()).asString(); + } + }); + } + + private void addStyles() { + showEligibleVolumes.addContentWidgetContainerStyleName(style.checkBoxEditorWidget()); + startSessionEditor.addContentWidgetContainerStyleName(style.checkBoxEditorWidget()); + suggestedConfigViolations.setEnabled(false); + } + + private void localize() { + slaveHostIpEditor.setLabel(constants.geoRepSlaveHostIp()); + slaveClusterEditor.setLabel(constants.geoRepSessionSlaveCluster()); + slaveVolumeEditor.setLabel(constants.geoRepSlaveVolume()); + showEligibleVolumes.setLabel(constants.geoRepShowEligibleVolumes()); + slaveUserName.setLabel(constants.geoRepSessionUserName()); + slaveUserGroupNameEditor.setLabel(constants.slaveUserGroupName()); + startSessionEditor.setLabel(constants.geoRepSessionCreateAndStart()); + } + + @Override + public void edit(final GlusterVolumeGeoRepCreateModel object) { + driver.edit(object); + } + + @Override + public void setFailureMessage(String failureMessage) { + boolean failureMessageVisible = failureMessage != null; + if(failureMessageVisible) { + message.setText(failureMessage); + } + message.setVisible(failureMessageVisible); + } + + @Override + public void setSuggestedConfigViolations(String recommendationViolations) { + boolean recommendationViolationsVisible = recommendationViolations != null; + if(recommendationViolationsVisible) { + suggestedConfigViolations.setText(recommendationViolations); + } + suggestedConfigViolations.setVisible(recommendationViolationsVisible); + } + + @Override + public GlusterVolumeGeoRepCreateModel flush() { + return driver.flush(); + } + + interface WidgetStyle extends CssResource { + String checkBoxEditorWidget(); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.ui.xml new file mode 100644 index 0000000..9ce3966 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeGeoRepCreateSessionPopupView.ui.xml @@ -0,0 +1,49 @@ +<?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:ge="urn:import:org.ovirt.engine.ui.common.widget.editor.generic" + xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor" xmlns:w="urn:import:org.ovirt.engine.ui.common.widget"> + + <ui:style + type="org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.GlusterVolumeGeoRepCreateSessionPopupView.WidgetStyle"> + .forceWarningLabel { + width: 470px; + font-size: 13px; + left: 10px; + padding-left: 15px; + padding-bottom: 10px; + color: #FF0000; + } + + .messageLabel { + color: #FF0000; + left: 10px; + padding-left: 5px; + } + + .panelStyle{ + width:490px; + } + + .checkBoxEditorWidget{ + width: 470px; + } + </ui:style> + + <d:SimpleDialogPanel width="500px" height="440px"> + <d:content> + <g:FlowPanel addStyleNames="{style.panelStyle}"> + <e:ListModelTypeAheadListBoxEditor ui:field="slaveClusterEditor" /> + <e:ListModelTypeAheadListBoxEditor ui:field="slaveVolumeEditor" /> + <ge:EntityModelCheckBoxEditor ui:field="showEligibleVolumes" /> + <e:ListModelTypeAheadListBoxEditor ui:field="slaveHostIpEditor" /> + <ge:StringEntityModelTextBoxEditor ui:field="slaveUserName" /> + <ge:StringEntityModelTextBoxEditor ui:field="slaveUserGroupNameEditor" /> + <ge:EntityModelCheckBoxEditor ui:field="startSessionEditor" /> + <g:TextArea ui:field="suggestedConfigViolations" addStyleNames="{style.forceWarningLabel}" /> + <g:Label ui:field="message" addStyleNames="{style.messageLabel}" /> + </g:FlowPanel> + </d:content> + </d:SimpleDialogPanel> +</ui:UiBinder> \ No newline at end of file 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 7ce2797..8590a22 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 @@ -92,11 +92,11 @@ TextColumnWithTooltip<GlusterVolumeEntity> volumeTypeColumn = new EnumColumn<GlusterVolumeEntity, GlusterVolumeType>() { - @Override - protected GlusterVolumeType getRawValue(GlusterVolumeEntity object) { - return object.getVolumeType(); - } - }; + @Override + protected GlusterVolumeType getRawValue(GlusterVolumeEntity object) { + return object.getVolumeType(); + } + }; volumeTypeColumn.makeSortable(); getTable().addColumn(volumeTypeColumn, constants.volumeTypeVolume(), "150px"); //$NON-NLS-1$ @@ -147,13 +147,13 @@ }, constants.volumeCapacity(), "100px");//$NON-NLS-1$ getTable().addColumn(new VolumeActivityColumn<GlusterVolumeEntity>(new VolumeActivityCompositeCell<GlusterTaskSupport>(compositeList) { - @Override - protected boolean isVisible(GlusterTaskSupport value) { - return !(value == null || value.getAsyncTask() == null); - } - }), - constants.activitiesOnVolume(), - "100px"); //$NON-NLS-1$ + @Override + protected boolean isVisible(GlusterTaskSupport value) { + return !(value == null || value.getAsyncTask() == null); + } + }), + constants.activitiesOnVolume(), + "100px"); //$NON-NLS-1$ TextColumnWithTooltip<GlusterVolumeEntity> snapshotCountColumn = new TextColumnWithTooltip<GlusterVolumeEntity>() { @@ -229,6 +229,24 @@ getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterVolumeEntity>(constants.volumeSnapshotMainTabTitle(), getVolumeSnapshotMenu(constants), CommandLocation.ContextAndToolBar)); + + getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterVolumeEntity>(constants.geoReplicationMainTabTitle(), + getGeoRepCreateMenu(constants), + CommandLocation.ContextAndToolBar)); + } + + private List<ActionButtonDefinition<GlusterVolumeEntity>> getGeoRepCreateMenu(ApplicationConstants constants) { + List<ActionButtonDefinition<GlusterVolumeEntity>> geoRepMenu = + new ArrayList<ActionButtonDefinition<GlusterVolumeEntity>>(); + WebAdminButtonDefinition<GlusterVolumeEntity> geoRepButton = + new WebAdminButtonDefinition<GlusterVolumeEntity>(constants.newGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getNewGeoRepSessionCommand(); + } + }; + geoRepMenu.add(geoRepButton); + return geoRepMenu; } private List<ActionButtonDefinition<GlusterVolumeEntity>> getVolumeSnapshotMenu(ApplicationConstants constants) { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java index dba9600..5d5c398 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java @@ -67,7 +67,7 @@ getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.removeGeoRepSession()) { @Override protected UICommand resolveCommand() { - return null; + return getDetailModel().getRemoveSessionCommand(); } }); -- To view, visit https://gerrit.ovirt.org/40131 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ied7317d456bf66db9a7800ba7106f2e8ec66429c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: anmolbabu <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
