anmolbabu has uploaded a new change for review. Change subject: engine,webadmin : geo-rep status detail ......................................................................
engine,webadmin : geo-rep status detail Changes in this patch : 1. session details is added to respective sessions while returing session list. As the list command and session detail command are separate and detail might not be available at the time of passing session list, session detail could potentially be null. 2. Host name of which the brick in the session detail is a part of, is added to the session detail so that UI doesn't need to explicitly make multiple queries to backend inorder to fetch the master server name of respective bricks; that is listed in the UI popup. 3. UI popup to show session details. Change-Id: I0cc6151fb71a4aa67dc76ec8dd8c93b76796f165 Signed-off-by: Anmol Babu <anb...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQuery.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQueryTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionDetails.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/VolumeGeoRepListModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepSessionDetailsModel.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/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/VolumeGeoRepSessionDetailsPopUpPresenterWidget.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java 14 files changed, 528 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/42243/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQuery.java index 9f9f409..7783e1c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQuery.java @@ -1,6 +1,13 @@ package org.ovirt.engine.core.bll.gluster; +import java.util.ArrayList; +import java.util.List; + +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.GlusterGeoRepSessionDetails; import org.ovirt.engine.core.common.queries.IdQueryParameters; +import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dao.gluster.GlusterGeoRepDao; public class GetGlusterVolumeGeoRepSessionsQuery<P extends IdQueryParameters> extends GlusterQueriesCommandBase<P>{ @@ -12,7 +19,46 @@ @Override protected void executeQueryCommand() { GlusterGeoRepDao geoRepDao = getGeoRepDao(); - getQueryReturnValue().setReturnValue(geoRepDao.getGeoRepSessions(getParameters().getId())); + List<GlusterGeoRepSession> geoRepSessions = geoRepDao.getGeoRepSessions(getParameters().getId()); + /* + * If master volume has sessions, update the master server names in accordance with masterBrickId in sessionDetails. + */ + if (geoRepSessions != null) { + for (GlusterGeoRepSession currentSession : geoRepSessions) { + // For each session get corresponding session details. + List<GlusterGeoRepSessionDetails> geoRepSessionDetails = geoRepDao.getGeoRepSessionDetails(currentSession.getId()); + /* + * Session details could be null, if they are not yet synced. possible if session detail command failed for some unexpected reason + * such as network failure even though the sessions in the cluster are synced(sessionListCommand) + */ + if(geoRepSessionDetails == null) { + continue; + } + /* + * If non null session detail, set masterBrick servername in accordance with that in brick + * as obtained by using masterbrickId + */ + for (GlusterGeoRepSessionDetails currentDetail : geoRepSessionDetails) { + if(currentDetail == null) { + continue; + } + Guid currentMasterBrickId = currentDetail.getMasterBrickId(); + if(currentMasterBrickId == null) { + continue; + } + GlusterBrickEntity currentBrick = + getGlusterBrickDao().getById(currentMasterBrickId); + if (currentBrick != null) { + currentDetail.setMasterBrickHostName(currentBrick.getServerName()); + } + } + /* + * Finally set session details to the current session + */ + currentSession.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepSessionDetails); + } + } + getQueryReturnValue().setReturnValue(geoRepSessions); } } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQueryTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQueryTest.java index accbc1d..eff403e 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQueryTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepSessionsQueryTest.java @@ -12,6 +12,7 @@ import org.ovirt.engine.core.bll.AbstractQueryTest; 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.GlusterGeoRepSessionDetails; import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dao.gluster.GlusterGeoRepDao; @@ -57,6 +58,7 @@ doReturn(geoRepDao).when(getQuery()).getGeoRepDao(); doReturn(masterVolumeId).when(getQueryParameters()).getId(); doReturn(getMockGeoRepSessions()).when(geoRepDao).getGeoRepSessions(masterVolumeId); + doReturn(new ArrayList<GlusterGeoRepSessionDetails>()).when(geoRepDao).getGeoRepSessionDetails(sessionId); } @Test diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionDetails.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionDetails.java index 1d76f19..fb48b60 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionDetails.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionDetails.java @@ -26,7 +26,15 @@ private Date checkPointTime; private Date checkPointCompletedAt; private boolean checkpointCompleted; + private String masterBrickHostName; + public String getMasterBrickHostName() { + return masterBrickHostName; + } + + public void setMasterBrickHostName(String masterBrickHostName) { + this.masterBrickHostName = masterBrickHostName; + } public Guid getMasterBrickId() { return masterBrickId; @@ -163,6 +171,7 @@ } GlusterGeoRepSessionDetails geoRep = (GlusterGeoRepSessionDetails) obj; +<<<<<<< HEAD return ObjectUtils.objectsEqual(getSessionId(), geoRep.getSessionId()) && ObjectUtils.objectsEqual(getMasterBrickId(), geoRep.getMasterBrickId()) && ObjectUtils.objectsEqual(getSlaveNodeUuid(), geoRep.getSlaveNodeUuid()) && @@ -178,6 +187,7 @@ ObjectUtils.objectsEqual(getLastSyncedAt(), geoRep.getLastSyncedAt()) && ObjectUtils.objectsEqual(getUpdatedAt(), geoRep.getUpdatedAt()) && ObjectUtils.objectsEqual(getFailures(), geoRep.getFailures()) && + ObjectUtils.objectsEqual(getMasterBrickHostName(), geoRep.getMasterBrickHostName()) && isCheckpointCompleted() == geoRep.isCheckpointCompleted(); } @@ -201,6 +211,7 @@ result = prime * result + ((lastSyncedAt == null) ? 0 : lastSyncedAt.hashCode()); result = prime * result + ((failures == null) ? 0 : failures.hashCode()); result = prime * result + ((updatedAt == null) ? 0 : updatedAt.hashCode()); + result = prime * result + ((masterBrickHostName == null) ? 0 : masterBrickHostName.hashCode()); return result; } } 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 a708765..bd24e00 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 @@ -56,6 +56,8 @@ geo_replication("geo_replication", HelpTagType.UNKNOWN), //$NON-NLS-1$ + geo_replication_status_detail("geo_replication_status_detail", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub tab -> View Details"), //$NON-NLS-1$//$NON-NLS-2$ + 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 index 9af29dd..a4c7bdf 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 @@ -12,6 +12,7 @@ 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.GlusterGeoRepSessionConfiguration; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails; 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; @@ -26,6 +27,7 @@ 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.ConfirmationModel; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel; import org.ovirt.engine.ui.uicompat.ConstantsManager; @@ -194,6 +196,7 @@ boolean allowPauseSessionCommand = false; boolean allowSessionOptionsCommand = false; boolean allowRemoveSessionCommand = false; + boolean allowSessionDetailsCommand = false; if(volumeEntity == null) { return; } @@ -209,6 +212,7 @@ allowSessionOptionsCommand = true; allowNewGeoRepSessionCommand = volumeEntity.getStatus() == GlusterStatus.UP; allowRemoveSessionCommand = true; + allowSessionDetailsCommand = true; } getNewSessionCommand().setIsExecutionAllowed(allowNewGeoRepSessionCommand); getRemoveSessionCommand().setIsExecutionAllowed(allowRemoveSessionCommand); @@ -217,7 +221,7 @@ getPauseSessionCommand().setIsExecutionAllowed(allowPauseSessionCommand); getResumeSessionCommand().setIsExecutionAllowed(allowResumeSessionCommand); getSessionOptionsCommand().setIsExecutionAllowed(allowSessionOptionsCommand); - getViewSessionDetailsCommand().setIsAvailable(false); + getViewSessionDetailsCommand().setIsExecutionAllowed(allowSessionDetailsCommand); getRefreshSessionsCommand().setIsAvailable(true); } @@ -239,7 +243,7 @@ } else if(command.equals(getSessionOptionsCommand())) { showSessionOptions(); } else if(command.equals(getViewSessionDetailsCommand())) { - + showGeoRepSessionDetails((GlusterGeoRepSession)getSelectedItem()); } else if (command.equals(getRefreshSessionsCommand())) { refreshSessions(); } else if (command.getName().equalsIgnoreCase("onCreateSession")) {//$NON-NLS-1$ @@ -266,6 +270,48 @@ setConfirmWindow(null); } + private void populateStatus(final List<GlusterGeoRepSessionDetails> details) { + final VolumeGeoRepSessionDetailsModel windowModel = new VolumeGeoRepSessionDetailsModel(); + windowModel.setHelpTag(HelpTag.geo_replication_status_detail); + windowModel.setHashName("geo_replication_status_detail");//$NON-NLS-1$ + + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + windowModel.setTitle(constants.geoReplicationSessionDetailsTitle()); + + UICommand okCommand = new UICommand("closeWindow", this);//$NON-NLS-1$ + okCommand.setIsCancel(true); + okCommand.setTitle(constants.ok()); + windowModel.getCommands().add(okCommand); + + setWindow(windowModel); + + final List<EntityModel<GlusterGeoRepSessionDetails>> detailRows = new ArrayList<>(); + for (GlusterGeoRepSessionDetails detail : details) { + detailRows.add(new EntityModel<GlusterGeoRepSessionDetails>(detail)); + } + windowModel.getGeoRepSessionSummary().setItems(detailRows, detailRows.get(0)); + } + + public void showGeoRepSessionDetails(GlusterGeoRepSession session) { + ArrayList<GlusterGeoRepSessionDetails> details = session.getSessionDetails(); + if(getWindow() != null) { + return; + } + if(details == null || details.size() == 0) { + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + final ConfirmationModel cModel = new ConfirmationModel(); + cModel.setTitle(constants.geoReplicationSessionDetailsTitle()); + UICommand okCommand = new UICommand("closeConfirmWindow", this);//$NON-NLS-1$ + okCommand.setTitle(constants.ok()); + okCommand.setIsCancel(true); + cModel.getCommands().add(okCommand); + setConfirmWindow(cModel); + cModel.setMessage(constants.geoRepSessionStatusDetailFetchFailed()); + } else { + populateStatus(details); + } + } + private void showSessionOptions() { if (getWindow() != null) { return; diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepSessionDetailsModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepSessionDetailsModel.java new file mode 100644 index 0000000..b8f9beb --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepSessionDetailsModel.java @@ -0,0 +1,33 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicompat.Event; +import org.ovirt.engine.ui.uicompat.EventArgs; +import org.ovirt.engine.ui.uicompat.IEventListener; +import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; + +public class VolumeGeoRepSessionDetailsModel extends Model{ + private ListModel<EntityModel<GlusterGeoRepSessionDetails>> geoRepSessionSummary; + public ListModel<EntityModel<GlusterGeoRepSessionDetails>> getGeoRepSessionSummary() { + return geoRepSessionSummary; + } + + public void setGeoRepSessionSummary(ListModel<EntityModel<GlusterGeoRepSessionDetails>> geoRepSessionSummary) { + this.geoRepSessionSummary = geoRepSessionSummary; + } + + public VolumeGeoRepSessionDetailsModel() { + setGeoRepSessionSummary(new ListModel<EntityModel<GlusterGeoRepSessionDetails>>()); + getGeoRepSessionSummary().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { + @Override + public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { + if(geoRepSessionSummary != null && geoRepSessionSummary.getSelectedItem() != null) { + onPropertyChanged(new PropertyChangedEventArgs("selectedSessionSummaryRow"));//$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 30497dd..78f54cb 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 @@ -284,6 +284,15 @@ @DefaultStringValue("Geo-Replication") String geoReplicationTitle(); + @DefaultStringValue("Geo-Replication Session Details") + String geoReplicationSessionDetailsTitle(); + + @DefaultStringValue("Could not fetch brick details") + String geoRepBrickDetailsFetchFailed(); + + @DefaultStringValue("Could not fetch Geo-Replication status details") + String geoRepSessionStatusDetailFetchFailed(); + @DefaultStringValue("Start Geo-Replication") String geoReplicationStartTitle(); 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 10fb221..138d491 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 @@ -3681,6 +3681,52 @@ @DefaultStringValue("Rebalance NOT STARTED") String rebalanceNotStarted(); + //Volume Geo Rep Status Detail Column Headers + @DefaultStringValue("Master Host") + String geoRepSessionHostName(); + + @DefaultStringValue("Status") + String geoRepSessionStatus(); + + @DefaultStringValue("Last Synced At") + String geoRepLastSyncedAt(); + + @DefaultStringValue("Master Brick") + String geoRepMasterBrick(); + + @DefaultStringValue("Slave host") + String geoRepSlaveHostName(); + + @DefaultStringValue("Status") + String geoRepPairStatus(); + + @DefaultStringValue("Geo-Rep Session Detail") + String geoRepSessionDetailHeader(); + + @DefaultStringValue("Checkpoint Status") + String geoRepCheckPointStatus(); + + @DefaultStringValue("Crawl Status") + String georepCrawlStatus(); + + @DefaultStringValue("Pending Data operations") + String geoRepDataOpsPending(); + + @DefaultStringValue("Pending meta-operations") + String geoRepMetaOpsPending(); + + @DefaultStringValue("Pending Entry operations") + String geoRepEntryOpsPending(); + + @DefaultStringValue("Failures") + String geoRepFailures(); + + @DefaultStringValue("Checkpoint time") + String geoRepCheckPointTime(); + + @DefaultStringValue("Checkpoint completed at") + String geoRepCheckPointCompletedAt(); + @DefaultStringValue("Manage Policy Units") String managePolicyUnits(); 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 97fc2e6..b5d90b7 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 @@ -52,6 +52,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.ReplaceBrickPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeGeoRepSessionDetailsPopUpPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeParameterPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumePopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeProfileStatisticsPopupPresenterWidget; @@ -296,6 +297,7 @@ import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.RemoveBrickStatusPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.ReplaceBrickPopupView; +import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.VolumeGeoRepSessionDetailsPopUpView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.VolumeParameterPopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.VolumePopupView; import org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster.VolumeProfileStatisticsPopupView; @@ -1193,6 +1195,10 @@ GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget.ViewDef.class, GlusterVolumeGeoReplicationSessionConfigPopupView.class); + bindPresenterWidget(VolumeGeoRepSessionDetailsPopUpPresenterWidget.class, + VolumeGeoRepSessionDetailsPopUpPresenterWidget.ViewDef.class, + VolumeGeoRepSessionDetailsPopUpView.class); + bindPresenterWidget(GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.class, GlusterVolumeGeoRepCreateSessionPopupPresenterWidget.ViewDef.class, GlusterVolumeGeoRepCreateSessionPopupView.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 62303a8..aee4f0f 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 @@ -41,6 +41,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.ReplaceBrickPopupPresenterWidget; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeGeoRepSessionDetailsPopUpPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeParameterPopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumePopupPresenterWidget; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeProfileStatisticsPopupPresenterWidget; @@ -277,6 +278,7 @@ final Provider<GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget> geoRepActionConfirmationPopupProvider, final Provider<GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget> geoRepConfigPopupProvider, final Provider<GlusterVolumeGeoRepCreateSessionPopupPresenterWidget> geoRepSessionCreatePopupProvider, + final Provider<VolumeGeoRepSessionDetailsPopUpPresenterWidget> geoRepSessionDetailsProvider, final Provider<VolumeListModel> mainModelProvider, final Provider<VolumeGeoRepListModel> modelProvider) { return new SearchableDetailTabModelProvider<GlusterGeoRepSession, VolumeListModel, VolumeGeoRepListModel>(eventBus, @@ -295,6 +297,8 @@ return geoRepConfigPopupProvider.get(); } else if (lastExecutedCommand == getModel().getNewSessionCommand()) { return geoRepSessionCreatePopupProvider.get(); + } else if (lastExecutedCommand == getModel().getViewSessionDetailsCommand()) { + return geoRepSessionDetailsProvider.get(); } else { return geoRepActionConfirmationPopupProvider.get(); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/VolumeGeoRepSessionDetailsPopUpPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/VolumeGeoRepSessionDetailsPopUpPresenterWidget.java new file mode 100644 index 0000000..296afd5 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/VolumeGeoRepSessionDetailsPopUpPresenterWidget.java @@ -0,0 +1,41 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails; +import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; +import org.ovirt.engine.ui.common.presenter.popup.DefaultConfirmationPopupPresenterWidget; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepSessionDetailsModel; +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; +import com.google.inject.Provider; + +public class VolumeGeoRepSessionDetailsPopUpPresenterWidget extends AbstractModelBoundPopupPresenterWidget<VolumeGeoRepSessionDetailsModel, VolumeGeoRepSessionDetailsPopUpPresenterWidget.ViewDef>{ + public interface ViewDef extends AbstractModelBoundPopupPresenterWidget.ViewDef<VolumeGeoRepSessionDetailsModel> { + public void setCheckPointCompletedAtVisibility(boolean visible); + public void updateSessionDetailProperties(GlusterGeoRepSessionDetails selectedSessionDetail); + } + + @Inject + public VolumeGeoRepSessionDetailsPopUpPresenterWidget(EventBus eventBus, ViewDef view, Provider<VolumeGeoRepSessionDetailsPopUpPresenterWidget> geoRepSessionDetailPopupProvider, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider) { + super(eventBus, view); + } + + @Override + public void init(final VolumeGeoRepSessionDetailsModel model) { + super.init(model); + model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { + @Override + public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { + PropertyChangedEventArgs e = (PropertyChangedEventArgs) args; + if(e.propertyName.equalsIgnoreCase("selectedSessionSummaryRow")) {//$NON-NLS-1$ + GlusterGeoRepSessionDetails selectedSessionDetail = model.getGeoRepSessionSummary().getSelectedItem().getEntity(); + getView().setCheckPointCompletedAtVisibility(selectedSessionDetail.isCheckpointCompleted()); + getView().updateSessionDetailProperties(selectedSessionDetail); + } + } + }); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.java new file mode 100644 index 0000000..1e26f28 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.java @@ -0,0 +1,231 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster; + +import java.util.Date; + +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails; +import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; +import org.ovirt.engine.ui.common.idhandler.WithElementId; +import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; +import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; +import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable; +import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelLabelEditor; +import org.ovirt.engine.ui.common.widget.renderer.FullDateTimeRenderer; +import org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn; +import org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn; +import org.ovirt.engine.ui.uicommonweb.models.EntityModel; +import org.ovirt.engine.ui.uicommonweb.models.ListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepSessionDetailsModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationMessages; +import org.ovirt.engine.ui.webadmin.ApplicationResources; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeGeoRepSessionDetailsPopUpPresenterWidget; + +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.text.shared.AbstractRenderer; +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.inject.Inject; + +public class VolumeGeoRepSessionDetailsPopUpView extends AbstractModelBoundPopupView<VolumeGeoRepSessionDetailsModel> implements VolumeGeoRepSessionDetailsPopUpPresenterWidget.ViewDef{ + + interface Driver extends SimpleBeanEditorDriver<VolumeGeoRepSessionDetailsModel, VolumeGeoRepSessionDetailsPopUpView> { + } + + interface ViewUiBinder extends UiBinder<SimpleDialogPanel, VolumeGeoRepSessionDetailsPopUpView> { + ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class); + } + + interface ViewIdHandler extends ElementIdHandler<VolumeGeoRepSessionDetailsPopUpView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelCellTable<ListModel<EntityModel<GlusterGeoRepSessionDetails>>> geoRepSessionSummaryTable; + + @UiField + @Ignore + @WithElementId + Label georepSessionDetailsHeader; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> checkPointStatus; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> crawlStatus; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> dataOpsPending; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> metaOpsPending; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> entryOpsPending; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> failures; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> checkPointTime; + + @UiField(provided = true) + @Ignore + @WithElementId + EntityModelLabelEditor<GlusterGeoRepSessionDetails> checkPointCompletedAt; + + ApplicationResources resources; + ApplicationConstants constants; + ApplicationMessages messages; + + private final Driver driver = GWT.create(Driver.class); + + @Inject + public VolumeGeoRepSessionDetailsPopUpView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants, ApplicationMessages messages) { + super(eventBus); + this.resources = resources; + this.constants = constants; + this.messages = messages; + intiEditors(constants); + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + ViewIdHandler.idHandler.generateAndSetIds(this); + localise(); + driver.initialize(this); + } + + private void localise() { + checkPointStatus.setLabel(constants.geoRepCheckPointStatus()); + crawlStatus.setLabel(constants.georepCrawlStatus()); + dataOpsPending.setLabel(constants.geoRepDataOpsPending()); + metaOpsPending.setLabel(constants.geoRepMetaOpsPending()); + entryOpsPending.setLabel(constants.geoRepEntryOpsPending()); + failures.setLabel(constants.geoRepFailures()); + georepSessionDetailsHeader.setText(constants.geoRepSessionDetailHeader()); + checkPointTime.setLabel(constants.geoRepCheckPointTime()); + checkPointCompletedAt.setLabel(constants.geoRepCheckPointCompletedAt()); + } + + private void intiEditors(final ApplicationConstants constants) { + checkPointStatus = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getCheckPointStatus(); + } + }); + crawlStatus = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getCrawlStatus().toString(); + } + }); + dataOpsPending = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getDataOpsPending().toString(); + } + }); + metaOpsPending = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getMetaOpsPending().toString(); + } + }); + entryOpsPending = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getEntryOpsPending().toString(); + } + }); + failures = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return object.getFailures().toString(); + } + }); + + checkPointTime = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return new FullDateTimeRenderer().render(object.getCheckPointTime()); + } + }); + + checkPointCompletedAt = new EntityModelLabelEditor<GlusterGeoRepSessionDetails>(new AbstractRenderer<GlusterGeoRepSessionDetails>() { + @Override + public String render(GlusterGeoRepSessionDetails object) { + return new FullDateTimeRenderer().render(object.getCheckPointCompletedAt()); + } + }); + + geoRepSessionSummaryTable = new EntityModelCellTable<ListModel<EntityModel<GlusterGeoRepSessionDetails>>>(false, true); + + geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() { + @Override + public String getText(GlusterGeoRepSessionDetails object) { + return object.getMasterBrickHostName() == null ? constants.notAvailableLabel() : object.getMasterBrickHostName(); + } + }, constants.geoRepSessionHostName()); + geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() { + @Override + protected String getText(GlusterGeoRepSessionDetails entity) { + return (entity == null || entity.getStatus() == null) ? constants.notAvailableLabel() : entity.getStatus().toString(); + } + }, constants.geoRepSessionStatus()); + geoRepSessionSummaryTable.addColumn(new AbstractFullDateTimeColumn<EntityModel<GlusterGeoRepSessionDetails>>() { + @Override + protected Date getRawValue(EntityModel<GlusterGeoRepSessionDetails> object) { + GlusterGeoRepSessionDetails sessionDetail = object.getEntity(); + return (sessionDetail == null || sessionDetail.getLastSyncedAt() == null) ? new Date() : sessionDetail.getLastSyncedAt(); + } + }, constants.geoRepLastSyncedAt()); + + } + + @Override + public void setCheckPointCompletedAtVisibility(boolean visible) { + checkPointCompletedAt.setVisible(visible); + } + + @Override + public void updateSessionDetailProperties(GlusterGeoRepSessionDetails selectedSessionDetail) { + checkPointStatus.asValueBox().setValue(selectedSessionDetail); + crawlStatus.asValueBox().setValue(selectedSessionDetail); + dataOpsPending.asValueBox().setValue(selectedSessionDetail); + metaOpsPending.asValueBox().setValue(selectedSessionDetail); + entryOpsPending.asValueBox().setValue(selectedSessionDetail); + failures.asValueBox().setValue(selectedSessionDetail); + checkPointTime.asValueBox().setValue(selectedSessionDetail); + checkPointCompletedAt.asValueBox().setValue(selectedSessionDetail); + } + + @Override + public void edit(final VolumeGeoRepSessionDetailsModel object) { + driver.edit(object); + + geoRepSessionSummaryTable.asEditor().edit(object.getGeoRepSessionSummary()); + } + + @Override + public VolumeGeoRepSessionDetailsModel flush() { + return driver.flush(); + } + +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.ui.xml new file mode 100644 index 0000000..9bffa98 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeGeoRepSessionDetailsPopUpView.ui.xml @@ -0,0 +1,47 @@ +<?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> + .tablePanel { + height: 280px; + width: 730px; + padding: 1px; + border: 1px solid #CED8DF; + } + + .headerLabel { + font-weight: bold; + padding-bottom: 5px; + } + + .button table{ + width: 100%; + } + </ui:style> + + <d:SimpleDialogPanel width="750px" height="625px"> + <d:content> + <g:VerticalPanel> + <g:ScrollPanel addStyleNames="{style.tablePanel}"> + <e:EntityModelCellTable ui:field="geoRepSessionSummaryTable" /> + </g:ScrollPanel> + <g:FlowPanel> + <g:Label ui:field="georepSessionDetailsHeader" + addStyleNames="{style.headerLabel}" /> + <ge:EntityModelLabelEditor ui:field="checkPointStatus" /> + <ge:EntityModelLabelEditor ui:field="crawlStatus" /> + <ge:EntityModelLabelEditor ui:field="dataOpsPending" /> + <ge:EntityModelLabelEditor ui:field="metaOpsPending" /> + <ge:EntityModelLabelEditor ui:field="entryOpsPending" /> + <ge:EntityModelLabelEditor ui:field="failures" /> + <ge:EntityModelLabelEditor ui:field="checkPointTime" /> + <ge:EntityModelLabelEditor ui:field="checkPointCompletedAt" /> + </g:FlowPanel> + </g:VerticalPanel> + </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/gluster/SubTabVolumeGeoRepView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java index 45c3387..9c3e0a7 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 @@ -116,7 +116,7 @@ getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.geoRepSessionDetails()) { @Override protected UICommand resolveCommand() { - return null; + return getDetailModel().getViewSessionDetailsCommand(); } }); -- To view, visit https://gerrit.ovirt.org/42243 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0cc6151fb71a4aa67dc76ec8dd8c93b76796f165 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches