anmolbabu has uploaded a new change for review. Change subject: webadmin : Introduce volume profile pdf Export option ......................................................................
webadmin : Introduce volume profile pdf Export option Introduce volume profile pdf Export option. Change-Id: I9791208b327dbe3e3b4dacfb568f08e042e8b8c9 Signed-off-by: Anmol Babu <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeProfileStatisticsModel.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/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.ui.xml 4 files changed, 60 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/28453/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeProfileStatisticsModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeProfileStatisticsModel.java index d9395e0..9efe6e4 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeProfileStatisticsModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeProfileStatisticsModel.java @@ -47,6 +47,10 @@ private VolumeListModel volumeListModel; private GlusterVolumeProfileInfo profileInfo; + private String profileExportUrl; + + private boolean isBrickTabSelected; + public ListModel getCumulativeStatistics() { return cumulativeStatistics; } @@ -138,12 +142,18 @@ getCumulativeStatistics().setItems(fopStatsEntities); } + private String setProfileUrl(boolean isBrickSelected) { + String url = "/api/clusters/" + clusterId + "/glustervolumes/" + volumeId + "/exportstats";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + return url; + } + public void queryBackend(final boolean isBrickSelected) { boolean nfs = false; if(isBrickSelected == false) { nfs = true; } + setBrickTabSelected(isBrickSelected); startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); AsyncDataProvider.getGlusterVolumeProfilingStatistics(new AsyncQuery(new INewAsyncCallback() { @@ -171,6 +181,7 @@ showProfileStats(profileInfoEntity); } } + setProfileExportUrl(setProfileUrl(isBrickSelected)); onPropertyChanged(new PropertyChangedEventArgs("successfulFetchingProfileStats"));//$NON-NLS-1$ } } @@ -258,4 +269,16 @@ public void setProfileInfo(GlusterVolumeProfileInfo profileInfo) { this.profileInfo = profileInfo; } + public String getProfileExportUrl() { + return profileExportUrl; + } + public void setProfileExportUrl(String profileExportUrl) { + this.profileExportUrl = profileExportUrl; + } + public boolean isBrickTabSelected() { + return isBrickTabSelected; + } + public void setBrickTabSelected(boolean isBrickTabSelected) { + this.isBrickTabSelected = isBrickTabSelected; + } } 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 878a996..95d3e24 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 @@ -3707,4 +3707,7 @@ @DefaultStringValue("Could not fetch brick profile stats") String brickProfileErrorMessage(); + + @DefaultStringValue("Save As Pdf") + String exportToPdf(); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.java index 9cce045..8f2b07f 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.java @@ -32,7 +32,9 @@ import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.VerticalPanel; import com.google.inject.Inject; public class VolumeProfileStatisticsPopupView extends AbstractModelBoundPopupView<VolumeProfileStatisticsModel> implements VolumeProfileStatisticsPopupPresenterWidget.ViewDef { @@ -85,6 +87,11 @@ Label bytesWritten; @UiField + @Ignore + @WithElementId + VerticalPanel brickProfileAnchorContainer; + + @UiField DialogTab nfsTab; @UiField @@ -120,24 +127,40 @@ @WithElementId Label nfsBytesWritten; + @UiField + @Ignore + @WithElementId + VerticalPanel nfsProfileAnchorContainer; + private final Driver driver = GWT.create(Driver.class); + ApplicationConstants constants; + ApplicationResources resources; + @Inject - public VolumeProfileStatisticsPopupView(EventBus eventBus, - ApplicationResources resources, - ApplicationConstants constants, - ApplicationMessages messages) { + public VolumeProfileStatisticsPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants, ApplicationMessages messages) { super(eventBus, resources); - initEditors(constants, resources); + this.constants = constants; + this.resources = resources; + initEditors(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); - localize(constants, messages); + localize(); nfsErrorLabel.setVisible(false); bricksErrorLabel.setVisible(false); driver.initialize(this); } - private void localize(ApplicationConstants constants, ApplicationMessages messages) { + private void initAnchor(String url, boolean isBrickTabSelected) { + Anchor profileExport = new Anchor(constants.exportToPdf(), false, url, "_blank");//$NON-NLS-1$//$NON-NLS-2$ + if(isBrickTabSelected) { + brickProfileAnchorContainer.add(profileExport); + } else { + nfsProfileAnchorContainer.add(profileExport); + } + } + + private void localize() { bricks.setLabel(constants.selectBrickToViewFopStats()); nfsServers.setLabel(constants.selectServerToViewFopStats()); bricksTab.setLabel(constants.volumeProfileBricksTab()); @@ -146,7 +169,7 @@ nfsErrorLabel.setText(constants.nfsProfileErrorMessage()); } - private void initEditors(ApplicationConstants constants, ApplicationResources resources) { + private void initEditors() { nfsRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML, resources); brickRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML, resources); bricks = new ListModelListBoxEditor<BrickProfileDetails>(new NullSafeRenderer<BrickProfileDetails>() { @@ -304,6 +327,7 @@ nfsErrorLabel.setVisible(true); } if(e.propertyName.equals("successfulFetchingProfileStats")) {//$NON-NLS-1$ + initAnchor(object.getProfileExportUrl(), object.isBrickTabSelected()); bricksErrorLabel.setVisible(false); nfsErrorLabel.setVisible(false); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.ui.xml index 2fa2f9c..0b3ffc5 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumeProfileStatisticsPopupView.ui.xml @@ -44,6 +44,7 @@ <g:Label ui:field="bytesRead" /> <g:Label ui:field="bytesWritten" /> </g:VerticalPanel> + <g:VerticalPanel ui:field="brickProfileAnchorContainer"/> </g:VerticalPanel> </g:SimplePanel> </t:content> @@ -70,6 +71,7 @@ <g:Label ui:field="nfsBytesRead" /> <g:Label ui:field="nfsBytesWritten" /> </g:VerticalPanel> + <g:VerticalPanel ui:field="nfsProfileAnchorContainer"/> </g:VerticalPanel> </g:SimplePanel> </t:content> -- To view, visit http://gerrit.ovirt.org/28453 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9791208b327dbe3e3b4dacfb568f08e042e8b8c9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
