Hello Sahina Bose, I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/39429 to review the following change. Change subject: webadmin : Add Geo-Replication Sub-tab under Volumes MainTab ...................................................................... webadmin : Add Geo-Replication Sub-tab under Volumes MainTab Add Geo-Replication Sub-tab under Volumes MainTab. The sub-tab will contain a list of geo-replication sessions setup for the volume. Bug-Url: https://bugzilla.redhat.com/1138116 Change-Id: I1cbcd5e0218d93c1d198462133b2efc883267ffa Signed-off-by: Anmol Babu <anb...@redhat.com> Signed-off-by: Sahina Bose <sab...@redhat.com> --- 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/VolumeGeoRepListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/place/WebAdminApplicationPlaces.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.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/ClientGinjectorExtension.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/tab/gluster/SubTabVolumeGeoRepPresenter.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java 13 files changed, 458 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/39429/1 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 a3d386b..486ef0f 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.GlusterGeoRepSession; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkInterface; import org.ovirt.engine.core.common.businessentities.network.NetworkQoS; @@ -124,6 +125,17 @@ } } + + public static class GlusterVolumeGeoRepSessionComparer implements Comparator<GlusterGeoRepSession>, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public int compare(GlusterGeoRepSession session0, GlusterGeoRepSession session1) { + return session0.getSlaveVolumeName().compareTo(session1.getSlaveVolumeName()); + } + } + 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 13854ca..81a8a98 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.GlusterGeoRepSession; import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; @@ -1580,7 +1581,17 @@ Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeBricksByServerId, new IdQueryParameters(serverId), aQuery); } - public static void getGlusterHook(AsyncQuery aQuery, Guid hookId, boolean includeServerHooks) { + public void getGlusterVolumeGeoRepStatusForMasterVolume(AsyncQuery aQuery, Guid masterVolumeId) { + aQuery.converterCallback = new IAsyncConverter() { + @Override + public Object Convert(Object source, AsyncQuery asyncQuery) { + return source != null ? source : new ArrayList<GlusterGeoRepSession>(); + } + }; + Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeGeoRepSessions, new IdQueryParameters(masterVolumeId), aQuery); + } + + public void getGlusterHook(AsyncQuery aQuery, Guid hookId, boolean includeServerHooks) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) 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 97419ca..4af2c64 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 @@ -54,6 +54,8 @@ bricks("bricks", HelpTagType.UNKNOWN), //$NON-NLS-1$ + geo_replication("geo_replication", HelpTagType.UNKNOWN), //$NON-NLS-1$ + cannot_add_bricks("cannot_add_bricks", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Bricks sub tab (Add Bricks context), dialog shows the following message: 'Could not find any host in Up status in the cluster. Please try again later.'"), //$NON-NLS-1$ //$NON-NLS-2$ change_cd("change_cd", HelpTagType.COMMON, "VMs Tab > Change CD"), //$NON-NLS-1$ //$NON-NLS-2$ 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 new file mode 100644 index 0000000..2875d72 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java @@ -0,0 +1,186 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +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.UICommand; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.help.HelpTag; +import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel; +import org.ovirt.engine.ui.uicompat.ConstantsManager; +import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; + +public class VolumeGeoRepListModel extends SearchableListModel{ + + private UICommand newSessionCommand; + private UICommand removeSessionCommand; + private UICommand startSessionCommand; + private UICommand stopSessionCommand; + private UICommand sessionOptionsCommand; + private UICommand viewSessionDetailsCommand; + + + @Override + protected String getListName() { + return "VolumeGeoReplicationModel";//$NON-NLS-1$ + } + + public VolumeGeoRepListModel() { + setTitle(ConstantsManager.getInstance().getConstants().geoReplicationTitle()); + setHelpTag(HelpTag.geo_replication); + setHashName("geo_replication");//$NON-NLS-1$ + setNewSessionCommand(new UICommand("createNewSession", this));//$NON-NLS-1$ + setRemoveSessionCommand(new UICommand("removeSession", this));//$NON-NLS-1$ + setStartSessionCommand(new UICommand("startSession", this));//$NON-NLS-1$ + setStopSessionCommand(new UICommand("stopSession", this));//$NON-NLS-1$ + setSessionOptionsCommand(new UICommand("sessionOptions", this));//$NON-NLS-1$ + setViewSessionDetailsCommand(new UICommand("viewSessionDetails", this));//$NON-NLS-1$ + } + + public UICommand getViewSessionDetailsCommand() { + return viewSessionDetailsCommand; + } + + public void setViewSessionDetailsCommand(UICommand viewDetailsCommand) { + this.viewSessionDetailsCommand = viewDetailsCommand; + } + + public UICommand getNewSessionCommand() { + return newSessionCommand; + } + + public void setNewSessionCommand(UICommand newSessionCommand) { + this.newSessionCommand = newSessionCommand; + } + + public UICommand getRemoveSessionCommand() { + return removeSessionCommand; + } + + public void setRemoveSessionCommand(UICommand removeSessionCommand) { + this.removeSessionCommand = removeSessionCommand; + } + + public UICommand getStartSessionCommand() { + return startSessionCommand; + } + + public void setStartSessionCommand(UICommand startCommand) { + this.startSessionCommand = startCommand; + } + + public UICommand getStopSessionCommand() { + return stopSessionCommand; + } + + public void setStopSessionCommand(UICommand stopCommand) { + this.stopSessionCommand = stopCommand; + } + + public UICommand getSessionOptionsCommand() { + return sessionOptionsCommand; + } + + public void setSessionOptionsCommand(UICommand optionsCommand) { + this.sessionOptionsCommand = optionsCommand; + } + + @Override + protected void onEntityChanged() { + super.onEntityChanged(); + getSearchCommand().execute(); + } + + @Override + protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) + { + super.entityPropertyChanged(sender, e); + getSearchCommand().execute(); + } + + @Override + protected void selectedItemsChanged() + { + super.selectedItemsChanged(); + updateActionAvailability(getEntity()); + } + + @Override + public void search() + { + if (getEntity() != null) + { + super.search(); + } + } + + @Override + protected void syncSearch() { + if (getEntity() == null) + { + return; + } + + AsyncDataProvider.getInstance().getGlusterVolumeGeoRepStatusForMasterVolume(new AsyncQuery(this, new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + List<GlusterGeoRepSession> geoRepSessions = (ArrayList<GlusterGeoRepSession>) returnValue; + Collections.sort(geoRepSessions, new Linq.GlusterVolumeGeoRepSessionComparer()); + setItems(geoRepSessions); + } + }), getEntity().getId()); + + } + + private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { + if(volumeEntity == null) { + return; + } + getNewSessionCommand().setIsAvailable(true); + getRemoveSessionCommand().setIsAvailable(false); + getStartSessionCommand().setIsAvailable(false); + getStopSessionCommand().setIsAvailable(false); + getSessionOptionsCommand().setIsAvailable(false); + getViewSessionDetailsCommand().setIsAvailable(false); + } + + @Override + public void executeCommand(UICommand command) { + super.executeCommand(command); + if(command.equals(getNewSessionCommand())) { + createNewGeoRepSession(); + } else if(command.equals(getRemoveSessionCommand())) { + + } else if(command.equals(getStartSessionCommand())) { + + } else if(command.equals(getStopSessionCommand())) { + + } else if(command.equals(getSessionOptionsCommand())) { + + } else if(command.equals(getViewSessionDetailsCommand())) { + + } + } + + private void createNewGeoRepSession() { + + } + + @Override + public GlusterVolumeEntity getEntity() + { + return (GlusterVolumeEntity) super.getEntity(); + } + + public void setEntity(GlusterVolumeEntity value) + { + super.setEntity(value); + } + +} 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 1123e2e..dd80bd3 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 @@ -54,6 +54,7 @@ import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel; @@ -164,6 +165,16 @@ this.brickListModel = brickListModel; } + private VolumeGeoRepListModel geoRepListModel; + + public VolumeGeoRepListModel getGeoRepListModel() { + return geoRepListModel; + } + + public void setGeoRepListModel(VolumeGeoRepListModel geoRepListModel) { + this.geoRepListModel = geoRepListModel; + } + public UICommand getStartVolumeProfilingCommand() { return startVolumeProfilingCommand; } @@ -227,11 +238,13 @@ super.initDetailModels(); setBrickListModel(new VolumeBrickListModel()); + setGeoRepListModel(new VolumeGeoRepListModel()); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new VolumeGeneralModel()); list.add(new VolumeParameterListModel()); list.add(getBrickListModel()); + list.add(getGeoRepListModel()); list.add(new PermissionListModel()); list.add(new VolumeEventListModel()); setDetailModels(list); @@ -406,7 +419,9 @@ protected void onSelectedItemChanged() { super.onSelectedItemChanged(); updateActionAvailability(); - getBrickListModel().setVolumeEntity((GlusterVolumeEntity) provideDetailModelEntity(getSelectedItem())); + GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)provideDetailModelEntity(getSelectedItem()); + getBrickListModel().setVolumeEntity(selectedVolume); + getGeoRepListModel().setEntity(selectedVolume); } @Override @@ -1023,11 +1038,11 @@ return; } - Guid clusterId = ((VDSGroup) volumeModel.getCluster().getSelectedItem()).getId(); + Guid clusterId = volumeModel.getCluster().getSelectedItem().getId(); final GlusterVolumeEntity volume = new GlusterVolumeEntity(); volume.setClusterId(clusterId); - volume.setName((String) volumeModel.getName().getEntity()); - GlusterVolumeType type = (GlusterVolumeType) volumeModel.getTypeList().getSelectedItem(); + volume.setName(volumeModel.getName().getEntity()); + GlusterVolumeType type = volumeModel.getTypeList().getSelectedItem(); if (type.isStripedType()) { volume.setStripeCount(volumeModel.getStripeCountValue()); @@ -1038,10 +1053,10 @@ volume.setVolumeType(type); - if ((Boolean) volumeModel.getTcpTransportType().getEntity()) { + if (volumeModel.getTcpTransportType().getEntity()) { volume.getTransportTypes().add(TransportType.TCP); } - if ((Boolean) volumeModel.getRdmaTransportType().getEntity()) { + if (volumeModel.getRdmaTransportType().getEntity()) { volume.getTransportTypes().add(TransportType.RDMA); } @@ -1054,21 +1069,21 @@ volume.setBricks(brickList); - if ((Boolean) volumeModel.getNfs_accecssProtocol().getEntity()) { + if (volumeModel.getNfs_accecssProtocol().getEntity()) { volume.enableNFS(); } else { volume.disableNFS(); } - if ((Boolean) volumeModel.getCifs_accecssProtocol().getEntity()) { + if (volumeModel.getCifs_accecssProtocol().getEntity()) { volume.enableCifs(); } else { volume.disableCifs(); } - volume.setAccessControlList((String) volumeModel.getAllowAccess().getEntity()); + volume.setAccessControlList(volumeModel.getAllowAccess().getEntity()); volumeModel.startProgress(null); @@ -1094,7 +1109,7 @@ if (returnValue != null && returnValue.getSucceeded()) { cancel(); - if ((Boolean) model.getOptimizeForVirtStore().getEntity()) { + if (model.getOptimizeForVirtStore().getEntity()) { optimizeVolumesForVirtStore(Arrays.asList(volume)); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/place/WebAdminApplicationPlaces.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/place/WebAdminApplicationPlaces.java index ab057e5..759d8d5 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/place/WebAdminApplicationPlaces.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/place/WebAdminApplicationPlaces.java @@ -306,6 +306,8 @@ public static final String volumeEventSubTabPlace = volumeMainTabPlace + SUB_TAB_PREFIX + "events"; //$NON-NLS-1$ + public static final String volumeGeoRepSubTabPlace = volumeMainTabPlace + SUB_TAB_PREFIX + "geo_rep"; //$NON-NLS-1$ + // Disk public static final String diskGeneralSubTabPlace = diskMainTabPlace + SUB_TAB_PREFIX + "general"; //$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 1f4b89c..ff6715c 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 @@ -279,6 +279,9 @@ @DefaultStringValue("Bricks") String bricksTitle(); + @DefaultStringValue("Geo-Replication") + String geoReplicationTitle(); + @DefaultStringValue("Rebalance Status") String volumeRebalanceStatusTitle(); 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 57329f2..eeff2f0 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 @@ -103,6 +103,39 @@ @DefaultStringValue("Bricks") String volumeBrickSubTabLabel(); + @DefaultStringValue("Geo-Replication") + String volumeGeoRepSubTabLabel(); + + @DefaultStringValue("Destination Host") + String volumeSubTabGeoRepSlaveClusterHostColumn(); + + @DefaultStringValue("Destination Volume") + String volumeSubTabGeoRepSlaveVolumeColumn(); + + @DefaultStringValue("Status") + String volumeSubTabGeoRepStatusColumn(); + + @DefaultStringValue("Up Time") + String volumeSubTabGeoRepUptime(); + + @DefaultStringValue("New") + String newGeoRepSession(); + + @DefaultStringValue("Remove") + String removeGeoRepSession(); + + @DefaultStringValue("Start") + String startGeoRepSession(); + + @DefaultStringValue("Stop") + String stopGeoRepSession(); + + @DefaultStringValue("Options") + String geoRepSessionsOptions(); + + @DefaultStringValue("View Details") + String geoRepSessionDetails(); + @DefaultStringValue("Permissions") String volumePermissionSubTabLabel(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ClientGinjectorExtension.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ClientGinjectorExtension.java index fbb2bd8..966f15b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ClientGinjectorExtension.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/ClientGinjectorExtension.java @@ -21,6 +21,7 @@ import org.ovirt.engine.core.common.businessentities.aaa.DbUser; import org.ovirt.engine.core.common.businessentities.event_subscriber; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; +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; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; @@ -73,6 +74,7 @@ import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBricksListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostEventListModel; @@ -381,6 +383,8 @@ SearchableDetailModelProvider<AuditLog, VolumeListModel, VolumeEventListModel> getSubTabVolumeEventModelProvider(); + SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> getSubTabVolumeGeoRepModelProvider(); + // Disk DetailModelProvider<DiskListModel, DiskGeneralModel> getSubTabDiskGeneralModelProvider(); 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 3d97a3c..f003ee4 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 @@ -161,6 +161,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeBrickPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeEventPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeGeneralPresenter; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeGeoRepPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeParameterPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumePermissionPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.VolumeSubTabPanelPresenter; @@ -400,6 +401,7 @@ import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumeBrickView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumeEventView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumeGeneralView; +import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumeGeoRepView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumeParameterView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.SubTabVolumePermissionView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster.VolumeSubTabPanelView; @@ -1409,6 +1411,11 @@ SubTabVolumeBrickView.class, SubTabVolumeBrickPresenter.ProxyDef.class); + bindPresenter(SubTabVolumeGeoRepPresenter.class, + SubTabVolumeGeoRepPresenter.ViewDef.class, + SubTabVolumeGeoRepView.class, + SubTabVolumeGeoRepPresenter.ProxyDef.class); + bindPresenter(SubTabVolumeParameterPresenter.class, SubTabVolumeParameterPresenter.ViewDef.class, SubTabVolumeParameterView.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 f8a2c66..95910e2 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 @@ -3,6 +3,7 @@ import org.ovirt.engine.core.common.businessentities.AuditLog; import org.ovirt.engine.core.common.businessentities.Permissions; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; +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.GlusterVolumeOptionEntity; import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; @@ -22,6 +23,7 @@ import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel; import org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.PermissionsPopupPresenterWidget; @@ -145,6 +147,17 @@ @Provides @Singleton + public SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> getVolumeGeoRepListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider) { + return new SearchableDetailTabModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel>(eventBus, defaultConfirmPopupProvider, VolumeListModel.class, VolumeGeoRepListModel.class) { + @Override + public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(VolumeGeoRepListModel source, UICommand lastExecutedCommand, Model windowModel) { + return null; + } + }; + } + + @Provides + @Singleton public SearchableDetailModelProvider<GlusterVolumeOptionEntity, VolumeListModel, VolumeParameterListModel> getVolumeParameterListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<VolumeParameterPopupPresenterWidget> addParameterPopupProvider, @@ -221,7 +234,6 @@ } }; } - @Override protected void configure() { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/gluster/SubTabVolumeGeoRepPresenter.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/gluster/SubTabVolumeGeoRepPresenter.java new file mode 100644 index 0000000..cb93e49 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/gluster/SubTabVolumeGeoRepPresenter.java @@ -0,0 +1,53 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.ui.common.place.PlaceRequestFactory; +import org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter; +import org.ovirt.engine.ui.common.uicommon.model.SearchableDetailModelProvider; +import org.ovirt.engine.ui.common.widget.tab.ModelBoundTabData; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel; +import org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.place.ApplicationPlaces; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.VolumeSelectionChangeEvent; +import com.google.gwt.event.shared.EventBus; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.TabData; +import com.gwtplatform.mvp.client.annotations.NameToken; +import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit; +import com.gwtplatform.mvp.client.annotations.ProxyEvent; +import com.gwtplatform.mvp.client.annotations.TabInfo; +import com.gwtplatform.mvp.client.proxy.PlaceManager; +import com.gwtplatform.mvp.client.proxy.PlaceRequest; +import com.gwtplatform.mvp.client.proxy.TabContentProxyPlace; + +public class SubTabVolumeGeoRepPresenter extends AbstractSubTabPresenter<GlusterVolumeEntity, VolumeListModel, VolumeGeoRepListModel, SubTabVolumeGeoRepPresenter.ViewDef, SubTabVolumeGeoRepPresenter.ProxyDef> { + @TabInfo(container = VolumeSubTabPanelPresenter.class) + static TabData getTabData(ApplicationConstants applicationConstants, SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> modelProvider) { + return new ModelBoundTabData(applicationConstants.volumeGeoRepSubTabLabel(), 4, modelProvider); + } + + @Inject + public SubTabVolumeGeoRepPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> modelProvider) { + super(eventBus, view, proxy, placeManager, modelProvider, VolumeSubTabPanelPresenter.TYPE_SetTabContent); + } + + @ProxyCodeSplit + @NameToken(ApplicationPlaces.volumeGeoRepSubTabPlace) + public interface ProxyDef extends TabContentProxyPlace<SubTabVolumeGeoRepPresenter> { + } + + public interface ViewDef extends AbstractSubTabPresenter.ViewDef<GlusterVolumeEntity> { + } + + @Override + protected PlaceRequest getMainTabRequest() { + return PlaceRequestFactory.get(ApplicationPlaces.volumeMainTabPlace); + } + + @ProxyEvent + public void onVolumeSelectionChange(VolumeSelectionChangeEvent event) { + updateMainTabSelection(event.getSelectedItems()); + } +} 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 new file mode 100644 index 0000000..d6c5ab5 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java @@ -0,0 +1,106 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.tab.gluster; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; +import org.ovirt.engine.ui.common.uicommon.model.SearchableDetailModelProvider; +import org.ovirt.engine.ui.common.widget.table.column.TextColumnWithTooltip; +import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel; +import org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabVolumeGeoRepPresenter; +import org.ovirt.engine.ui.webadmin.section.main.view.AbstractSubTabTableView; +import org.ovirt.engine.ui.webadmin.widget.action.WebAdminButtonDefinition; + +import com.google.gwt.core.client.GWT; +import com.google.inject.Inject; + +public class SubTabVolumeGeoRepView + extends + AbstractSubTabTableView<GlusterVolumeEntity, GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> + implements SubTabVolumeGeoRepPresenter.ViewDef { + + interface ViewIdHandler extends ElementIdHandler<SubTabVolumeGeoRepView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @Inject + public SubTabVolumeGeoRepView(SearchableDetailModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel> modelProvider, + ApplicationConstants constants) { + super(modelProvider); + initTable(constants); + initWidget(getTable()); + } + + @Override + protected void generateIds() { + ViewIdHandler.idHandler.generateAndSetIds(this); + } + + void initTable(ApplicationConstants constants) { + getTable().enableColumnResizing(); + getTable().addColumn(new TextColumnWithTooltip<GlusterGeoRepSession>() { + @Override + public String getValue(GlusterGeoRepSession object) { + return object.getSlaveHostName(); + } + }, constants.volumeSubTabGeoRepSlaveClusterHostColumn(), "220px"); //$NON-NLS-1$ + + getTable().addColumn(new TextColumnWithTooltip<GlusterGeoRepSession>() { + @Override + public String getValue(GlusterGeoRepSession object) { + return object.getSlaveVolumeName(); + } + }, constants.volumeSubTabGeoRepSlaveVolumeColumn(), "220px"); //$NON-NLS-1$ + + getTable().addColumn(new TextColumnWithTooltip<GlusterGeoRepSession>() { + @Override + public String getValue(GlusterGeoRepSession object) { + return object.getStatus().toString(); + } + }, constants.volumeSubTabGeoRepStatusColumn(), "150px"); //$NON-NLS-1$ + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.newGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getNewSessionCommand(); + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.removeGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return null; + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.startGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return null; + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.stopGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return null; + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.geoRepSessionsOptions()) { + @Override + protected UICommand resolveCommand() { + return null; + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.geoRepSessionDetails()) { + @Override + protected UICommand resolveCommand() { + return null; + } + }); + } +} -- To view, visit https://gerrit.ovirt.org/39429 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1cbcd5e0218d93c1d198462133b2efc883267ffa Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: anmolbabu <anb...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches