Ramesh N has uploaded a new change for review. Change subject: webadmin: show storage devices in host ......................................................................
webadmin: show storage devices in host Show all available storage devices in 'Storage Devies' sub tab under Hosts . Change-Id: I10da2f35012795de32367f295260ce9151c44909 Signed-off-by: Ramesh Nachimuthu <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/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/clusters/ClusterHostListModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/StorageDeviceListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.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/HostModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabStorageDevicesPresenter.java A frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabStorageDevicesView.java 14 files changed, 289 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/35315/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml index 190e459..e6db198 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml @@ -326,6 +326,7 @@ <include name="common/businessentities/gluster/GlusterHookContentType.java"/> <include name="common/businessentities/gluster/GlusterHookConflictFlags.java"/> <include name="common/businessentities/gluster/GlusterVolumeSizeInfo.java"/> + <include name="common/businessentities/gluster/StorageDeviceInfo.java"/> <include name="common/asynctasks/gluster/GlusterAsyncTask.java"/> <include name="common/asynctasks/gluster/GlusterTaskStatus.java"/> <include name="common/asynctasks/gluster/GlusterTaskType.java"/> 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 ee962cd..3e3d97e 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 @@ -3839,4 +3839,19 @@ NumaTuneMode.INTERLEAVE })); } + + public void getStorageDevices(AsyncQuery aQuery, Guid hostId) { + aQuery.converterCallback = new IAsyncConverter() { + @Override + public Object Convert(Object source, AsyncQuery _asyncQuery) + { + return source; + } + }; + VdsIdParametersBase parameters = + new VdsIdParametersBase(hostId); //$NON-NLS-1$ //$NON-NLS-2$ + Frontend.getInstance().runQuery(VdcQueryType.GetStorageDevices, + parameters, + aQuery); + } } 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 bcf0d49..19ebeb2 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 @@ -448,6 +448,8 @@ view_gluster_hook("view_gluster_hook", HelpTagType.WEBADMIN, "[gluster] Clusters main tab -> Gluster Hooks sub tab -> 'Hook Content' dialog"), //$NON-NLS-1$ //$NON-NLS-2$ + storage_device_list("storage_device_list", HelpTagType.UNKNOWN), //$NON-NLS-1$ + virtual_machines("virtual_machines", HelpTagType.UNKNOWN), //$NON-NLS-1$ vm_import("vm_import", HelpTagType.UNKNOWN), //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterHostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterHostListModel.java index 9782ff2..24bea9c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterHostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterHostListModel.java @@ -18,6 +18,7 @@ import org.ovirt.engine.ui.uicommonweb.UICommand; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.StorageDeviceListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBricksListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostEventListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel; @@ -40,9 +41,13 @@ final HostVmListModel hostVmListModel, final HostEventListModel hostEventListModel, final HostInterfaceListModel hostInterfaceListModel, final HostHardwareGeneralModel hostHardwareGeneralModel, final HostHooksListModel hostHooksListModel, - final PermissionListModel permissionListModel) { + final PermissionListModel permissionListModel, final StorageDeviceListModel storageDeviceListModel) { super(hostGeneralModel, hostGlusterSwiftListModel, hostBricksListModel, hostVmListModel, hostEventListModel, - hostInterfaceListModel, hostHardwareGeneralModel, hostHooksListModel, permissionListModel); + hostInterfaceListModel, + hostHardwareGeneralModel, + hostHooksListModel, + permissionListModel, + storageDeviceListModel); setUpdateMomPolicyCommand(new UICommand("updateMomPolicyCommand", this)); //$NON-NLS-1$ getUpdateMomPolicyCommand().setAvailableInModes(ApplicationMode.VirtOnly); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/StorageDeviceListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/StorageDeviceListModel.java new file mode 100644 index 0000000..dd9300b --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/StorageDeviceListModel.java @@ -0,0 +1,81 @@ +package org.ovirt.engine.ui.uicommonweb.models.gluster; + +import java.util.List; + +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDeviceInfo; +import org.ovirt.engine.core.common.mode.ApplicationMode; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.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 StorageDeviceListModel extends SearchableListModel { + + @Override + public VDS getEntity() { + return (VDS) super.getEntity(); + } + + public void setEntity(VDS value) + { + super.setEntity(value); + } + + public StorageDeviceListModel() { + setTitle(ConstantsManager.getInstance().getConstants().storageDevices()); + setHelpTag(HelpTag.storage_device_list); + setHashName("logical_volumes"); //$NON-NLS-1$ + setAvailableInModes(ApplicationMode.GlusterOnly); + } + + @Override + protected void onEntityChanged() { + super.onEntityChanged(); + getSearchCommand().execute(); + } + + @Override + protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) + { + super.entityPropertyChanged(sender, e); + getSearchCommand().execute(); + } + + @Override + public void search() + { + if (getEntity() != null) + { + super.search(); + } + } + + @Override + protected void syncSearch() + { + if (getEntity() == null || getEntity().getStatus() != VDSStatus.Up) { + return; + } + + AsyncDataProvider.getInstance().getStorageDevices(new AsyncQuery(this, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue) { + List<StorageDeviceInfo> disks = (List<StorageDeviceInfo>) returnValue; + setItems(disks); + } + }), getEntity().getId()); + + } + + @Override + protected String getListName() { + return "HostDeviceListListModel"; //$NON-NLS-1$ + } + +} diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index fe06555..34addc3 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -78,6 +78,7 @@ import org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterFeaturesUtil; import org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.StorageDeviceListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel; import org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel; import org.ovirt.engine.ui.uicommonweb.models.tags.TagModel; @@ -352,6 +353,16 @@ return hostBricksListModel; } + private StorageDeviceListModel storageDeviceListModel; + + public StorageDeviceListModel getStorageDeviceListModel() { + return storageDeviceListModel; + } + + public void setStorageDeviceListModel(StorageDeviceListModel storageDeviceListModel) { + this.storageDeviceListModel = storageDeviceListModel; + } + private final HostVmListModel hostVmListModel; public HostVmListModel getHostVmListModel(){ @@ -381,12 +392,14 @@ final HostVmListModel hostVmListModel, final HostEventListModel hostEventListModel, final HostInterfaceListModel hostInterfaceListModel, final HostHardwareGeneralModel hostHardwareGeneralModel, final HostHooksListModel hostHooksListModel, - final PermissionListModel permissionListModel) { + final PermissionListModel permissionListModel, final StorageDeviceListModel storageDeviceListModel) { this.generalModel = hostGeneralModel; this.glusterSwiftModel = hostGlusterSwiftListModel; this.hostBricksListModel = hostBricksListModel; this.hostVmListModel = hostVmListModel; this.privateHostEventListModel = hostEventListModel; + this.storageDeviceListModel = storageDeviceListModel; + setDetailList(hostInterfaceListModel, hostHardwareGeneralModel, hostHooksListModel, permissionListModel); setTitle(ConstantsManager.getInstance().getConstants().hostsTitle()); @@ -438,6 +451,7 @@ list.add(hostHooksListModel); list.add(getGlusterSwiftModel()); list.add(getHostBricksListModel()); + list.add(getStorageDeviceListModel()); list.add(permissionListModel); setDetailModels(list); } @@ -2379,4 +2393,5 @@ protected String getListName() { return "HostListModel"; //$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 fde7b44..eb37239 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 @@ -2461,4 +2461,7 @@ @DefaultStringValue("Click on Numa Pinning to configure VM's virtual node span on top of physical host NUMA nodes") String numaInfoMessage(); + + @DefaultStringValue("Storage Devices") + String storageDevices(); } 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 35b7146..51d76ea 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 @@ -2316,6 +2316,19 @@ @DefaultStringValue("Volume") String volumeName(); + // Disk + @DefaultStringValue("Device Name") + String deviceName(); + + @DefaultStringValue("File System") + String fileSystem(); + + @DefaultStringValue("Size") + String size(); + + @DefaultStringValue("Storage Devices") + String storageDevices(); + @DefaultStringValue("Brick Directory") String brickDirectory(); 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 d5d8504..95a6370 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 @@ -26,6 +26,7 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDeviceInfo; import org.ovirt.engine.core.common.businessentities.network.ExternalSubnet; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; @@ -71,6 +72,7 @@ import org.ovirt.engine.ui.uicommonweb.models.disks.DiskVmListModel; import org.ovirt.engine.ui.uicommonweb.models.events.EventListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.StorageDeviceListModel; 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; @@ -317,6 +319,8 @@ SearchableDetailModelProvider<GlusterBrickEntity, HostListModel, HostBricksListModel> getSubTabHostBricksModelProvider(); + SearchableDetailModelProvider<StorageDeviceInfo, HostListModel, StorageDeviceListModel> getSubTabStorageDeviceModelProvider(); + // Pool DetailModelProvider<PoolListModel, PoolGeneralModel> getSubTabPoolGeneralModelProvider(); 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 7e32232..1ef5633 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 @@ -177,6 +177,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostInterfacePresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostPermissionPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostVmPresenter; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabStorageDevicesPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.network.NetworkSubTabPanelPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.network.SubTabNetworkClusterPresenter; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.network.SubTabNetworkExternalSubnetPresenter; @@ -419,6 +420,7 @@ import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostInterfaceView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostPermissionView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabHostVmView; +import org.ovirt.engine.ui.webadmin.section.main.view.tab.host.SubTabStorageDevicesView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.network.NetworkSubTabPanelView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.network.SubTabNetworkClusterView; import org.ovirt.engine.ui.webadmin.section.main.view.tab.network.SubTabNetworkExternalSubnetView; @@ -814,6 +816,10 @@ SubTabHostBrickPresenter.ViewDef.class, SubTabHostBrickView.class, SubTabHostBrickPresenter.ProxyDef.class); + bindPresenter(SubTabStorageDevicesPresenter.class, + SubTabStorageDevicesPresenter.ViewDef.class, + SubTabStorageDevicesView.class, + SubTabStorageDevicesPresenter.ProxyDef.class); // VirtualMachine bindPresenter(VirtualMachineSubTabPanelPresenter.class, diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java index 5dc7698..6ec560b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java @@ -9,6 +9,7 @@ import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDeviceInfo; import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget; import org.ovirt.engine.ui.common.presenter.ModelBoundPresenterWidget; import org.ovirt.engine.ui.common.presenter.popup.DefaultConfirmationPopupPresenterWidget; @@ -27,6 +28,7 @@ import org.ovirt.engine.ui.uicommonweb.models.Model; import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel; import org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel; +import org.ovirt.engine.ui.uicommonweb.models.gluster.StorageDeviceListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBondInterfaceModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostBricksListModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.HostEventListModel; @@ -300,6 +302,7 @@ bind(HostHardwareGeneralModel.class).in(Singleton.class); bind(HostHooksListModel.class).in(Singleton.class); bind(HostBricksListModel.class).in(Singleton.class); + bind(StorageDeviceListModel.class).in(Singleton.class); bind(HostInterfaceListModel.class).in(Singleton.class); bind(HostVmListModel.class).in(Singleton.class); bind(HostGlusterSwiftListModel.class).in(Singleton.class); @@ -317,6 +320,9 @@ bind(new TypeLiteral<SearchableDetailModelProvider<GlusterBrickEntity, HostListModel, HostBricksListModel>>(){}) .to(new TypeLiteral<SearchableDetailTabModelProvider<GlusterBrickEntity, HostListModel, HostBricksListModel>>(){}) .in(Singleton.class); + bind(new TypeLiteral<SearchableDetailModelProvider<StorageDeviceInfo, HostListModel, StorageDeviceListModel>>(){}) + .to(new TypeLiteral<SearchableDetailTabModelProvider<StorageDeviceInfo, HostListModel, StorageDeviceListModel>>(){}) + .in(Singleton.class); bind(new TypeLiteral<SearchableDetailModelProvider<GlusterServerService, HostListModel, HostGlusterSwiftListModel>>(){}) .to(new TypeLiteral<SearchableDetailTabModelProvider<GlusterServerService, HostListModel, HostGlusterSwiftListModel>>(){}) .in(Singleton.class); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java index 4a6d248..1d2bd68 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/place/ApplicationPlaces.java @@ -211,6 +211,9 @@ public static final String hostBricksSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + "gluster_bricks"; //$NON-NLS-1$ + public static final String hostStorageDevicesSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + + "storage_devices"; //$NON-NLS-1$ + public static final String hostPermissionSubTabPlace = hostMainTabPlace + SUB_TAB_PREFIX + "permissions"; //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabStorageDevicesPresenter.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabStorageDevicesPresenter.java new file mode 100644 index 0000000..b58322f --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabStorageDevicesPresenter.java @@ -0,0 +1,62 @@ +package org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host; + +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDeviceInfo; +import org.ovirt.engine.ui.common.place.PlaceRequestFactory; +import org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter; +import org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider; +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.StorageDeviceListModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel; +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.HostSelectionChangeEvent; + +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.TabContentProxyPlace; +import com.gwtplatform.mvp.shared.proxy.PlaceRequest; + +public class SubTabStorageDevicesPresenter extends AbstractSubTabPresenter<VDS, HostListModel, StorageDeviceListModel, SubTabStorageDevicesPresenter.ViewDef, SubTabStorageDevicesPresenter.ProxyDef> { + + @ProxyCodeSplit + @NameToken(ApplicationPlaces.hostStorageDevicesSubTabPlace) + public interface ProxyDef extends TabContentProxyPlace<SubTabStorageDevicesPresenter> { + } + + public interface ViewDef extends AbstractSubTabPresenter.ViewDef<VDS> { + } + + @TabInfo(container = HostSubTabPanelPresenter.class) + static TabData getTabData(ApplicationConstants applicationConstants, + DetailModelProvider<HostListModel, StorageDeviceListModel> modelProvider) { + return new ModelBoundTabData(applicationConstants.storageDevices(), 4, modelProvider); + } + + @Inject + public SubTabStorageDevicesPresenter(EventBus eventBus, + ViewDef view, + ProxyDef proxy, + PlaceManager placeManager, + SearchableDetailModelProvider<StorageDeviceInfo, HostListModel, StorageDeviceListModel> modelProvider) { + super(eventBus, view, proxy, placeManager, modelProvider, + HostSubTabPanelPresenter.TYPE_SetTabContent); + } + + @Override + protected PlaceRequest getMainTabRequest() { + return PlaceRequestFactory.get(ApplicationPlaces.hostMainTabPlace); + } + + @ProxyEvent + public void onHostSelectionChange(HostSelectionChangeEvent event) { + updateMainTabSelection(event.getSelectedItems()); + } +} diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabStorageDevicesView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabStorageDevicesView.java new file mode 100644 index 0000000..36f6386 --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabStorageDevicesView.java @@ -0,0 +1,70 @@ +package org.ovirt.engine.ui.webadmin.section.main.view.tab.host; + +import javax.inject.Inject; + +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDeviceInfo; +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.models.gluster.StorageDeviceListModel; +import org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabStorageDevicesPresenter; +import org.ovirt.engine.ui.webadmin.section.main.view.AbstractSubTabTableView; + +import com.google.gwt.core.client.GWT; + +public class SubTabStorageDevicesView extends AbstractSubTabTableView<VDS, StorageDeviceInfo, HostListModel, StorageDeviceListModel> + implements SubTabStorageDevicesPresenter.ViewDef { + + interface ViewIdHandler extends ElementIdHandler<SubTabStorageDevicesView> { + ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); + } + + @Inject + public SubTabStorageDevicesView(SearchableDetailModelProvider<StorageDeviceInfo, HostListModel, StorageDeviceListModel> modelProvider, + ApplicationConstants constants) { + super(modelProvider); + initTable(constants); + initWidget(getTable()); + } + + void initTable(ApplicationConstants constants) { + getTable().enableColumnResizing(); + + TextColumnWithTooltip<StorageDeviceInfo> diskNameColumn = new TextColumnWithTooltip<StorageDeviceInfo>() { + @Override + public String getValue(StorageDeviceInfo object) { + return object.getName(); + } + }; + diskNameColumn.makeSortable(); + getTable().addColumn(diskNameColumn, constants.deviceName()); //$NON-NLS-1$ + + TextColumnWithTooltip<StorageDeviceInfo> deviceTypeColumn = new TextColumnWithTooltip<StorageDeviceInfo>() { + @Override + public String getValue(StorageDeviceInfo object) { + return object.getFileSystem(); + } + }; + deviceTypeColumn.makeSortable(); + getTable().addColumn(deviceTypeColumn, constants.fileSystem()); //$NON-NLS-1$ + + TextColumnWithTooltip<StorageDeviceInfo> sizeColumn = new TextColumnWithTooltip<StorageDeviceInfo>() { + @Override + public String getValue(StorageDeviceInfo object) { + return object.getCapacity(); + } + }; + sizeColumn.makeSortable(); + getTable().addColumn(sizeColumn, constants.size()); //$NON-NLS-1$ + + } + + @Override + protected void generateIds() { + ViewIdHandler.idHandler.generateAndSetIds(this); + + } +} -- To view, visit http://gerrit.ovirt.org/35315 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I10da2f35012795de32367f295260ce9151c44909 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ramesh N <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
