Kanagaraj M has uploaded a new change for review. Change subject: engine,webadmin: Adding cluster name colume to Volumes Tab ......................................................................
engine,webadmin: Adding cluster name colume to Volumes Tab A new view named 'gluster_volumes_view' is added by joining 'gluster_volumes' and 'vds_groups' tables to get the cluster name of the volumes. gluster volumes functions are modified to use the 'gluster_volumes_view' instead of 'gluster_volumes'. 'clusterName' field is added to the GlusterVolumeEntity and it will shown in the newly added 'Cluster' column in the UI. Change-Id: I6b98e7b46e312d0dc0b9b29b7cb8a0b0a7ecd3b7 Bug-Url: https://bugzilla.redhat.com/875800 Signed-off-by: Kanagaraj M <[email protected]> --- M backend/manager/dbscripts/create_views.sql M backend/manager/dbscripts/gluster_volumes_sp.sql M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoTest.java M backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.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/tab/MainTabVolumeView.java 8 files changed, 43 insertions(+), 14 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/12461/1 diff --git a/backend/manager/dbscripts/create_views.sql b/backend/manager/dbscripts/create_views.sql index ec9d080..870b536 100644 --- a/backend/manager/dbscripts/create_views.sql +++ b/backend/manager/dbscripts/create_views.sql @@ -1493,3 +1493,10 @@ SELECT DISTINCT entity_id, user_id FROM user_network_permissions_view_base NATURAL JOIN user_flat_groups; + +CREATE OR REPLACE VIEW gluster_volumes_view +AS +SELECT gluster_volumes.*, + vds_groups.name AS vds_group_name +FROM gluster_volumes +LEFT JOIN vds_groups ON gluster_volumes.cluster_id = vds_group_id; diff --git a/backend/manager/dbscripts/gluster_volumes_sp.sql b/backend/manager/dbscripts/gluster_volumes_sp.sql index 7c211b6..5c482e3 100644 --- a/backend/manager/dbscripts/gluster_volumes_sp.sql +++ b/backend/manager/dbscripts/gluster_volumes_sp.sql @@ -74,11 +74,11 @@ Create or replace FUNCTION GetGlusterVolumesByClusterGuid(v_cluster_id UUID) - RETURNS SETOF gluster_volumes + RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; @@ -87,11 +87,11 @@ v_status VARCHAR(32), v_option_key VARCHAR(8192), v_option_val VARCHAR(8192)) -RETURNS SETOF gluster_volumes +RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND id IN (SELECT volume_id FROM gluster_volume_options WHERE option_key=v_option_key AND option_val=v_option_val); @@ -104,11 +104,11 @@ v_vol_types text, v_option_key VARCHAR(8192), v_option_val VARCHAR(8192)) -RETURNS SETOF gluster_volumes +RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND vol_type IN (SELECT ID FROM fnSplitter(v_vol_types)) AND id IN (SELECT volume_id FROM gluster_volume_options @@ -119,11 +119,11 @@ Create or replace FUNCTION GetGlusterVolumesByStatusAndTypes(v_cluster_id UUID, v_status VARCHAR(32), v_vol_types text) -RETURNS SETOF gluster_volumes +RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND vol_type IN (SELECT ID FROM fnSplitter(v_vol_types)); END; $procedure$ @@ -131,11 +131,11 @@ Create or replace FUNCTION GetGlusterVolumeById(v_volume_id UUID) - RETURNS SETOF gluster_volumes + RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; @@ -143,11 +143,11 @@ Create or replace FUNCTION GetGlusterVolumeByName(v_cluster_id UUID, v_vol_name VARCHAR(1000)) -RETURNS SETOF gluster_volumes +RETURNS SETOF gluster_volumes_view AS $procedure$ BEGIN RETURN QUERY SELECT * - FROM gluster_volumes + FROM gluster_volumes_view WHERE cluster_id = v_cluster_id and vol_name = v_vol_name; END; $procedure$ LANGUAGE plpgsql; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java index aa67ad0..051edbf 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java @@ -46,6 +46,8 @@ @NotNull(message = "VALIDATION.GLUSTER.VOLUME.CLUSTER_ID.NOT_NULL", groups = {CreateEntity.class, CreateReplicatedVolume.class, CreateStripedVolume.class}) private Guid clusterId; + private String clusterName; + @NotNull(message = "VALIDATION.GLUSTER.VOLUME.NAME.NOT_NULL", groups = {CreateEntity.class, CreateReplicatedVolume.class, CreateStripedVolume.class}) private String name; @@ -102,6 +104,14 @@ this.name = name; } + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + public GlusterVolumeType getVolumeType() { return volumeType; } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java index 05074e1..ae410f7 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoDbFacadeImpl.java @@ -295,6 +295,7 @@ entity.setId(Guid.createGuidFromString(rs.getString("id"))); entity.setClusterId(Guid.createGuidFromString(rs .getString("cluster_id"))); + entity.setClusterName(rs.getString("vds_group_name")); entity.setName(rs.getString("vol_name")); entity.setVolumeType(GlusterVolumeType.valueOf(rs.getString("vol_type"))); entity.setStatus(GlusterStatus.valueOf(rs.getString("status"))); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoTest.java index 35fdccf..ff32304 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeDaoTest.java @@ -83,7 +83,7 @@ @Test public void testGetAllWithQuery() { List<GlusterVolumeEntity> volumes = - dao.getAllWithQuery("select * from gluster_volumes where vol_type = '" + dao.getAllWithQuery("select * from gluster_volumes_view where vol_type = '" + GlusterVolumeType.DISTRIBUTED_REPLICATE.name() + "'"); assertTrue(volumes != null); diff --git a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java index a4bb9b0..e0acc6f 100644 --- a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java +++ b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java @@ -239,7 +239,7 @@ new EntitySearchInfo(GlusterVolumeCrossRefAutoCompleter.INSTANCE, GlusterVolumeConditionFieldAutoCompleter.INSTANCE, null, - "gluster_volumes", + "gluster_volumes_view", "id", "vol_name ASC ")); put(SearchObjects.VDC_POOL_OBJ_NAME, new EntitySearchInfo(null, 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 2be4c22..2ea4091 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 @@ -2166,6 +2166,9 @@ @DefaultStringValue("Name") String NameVolume(); + @DefaultStringValue("Cluster") + String clusterVolume(); + @DefaultStringValue("Volume Type") String volumeTypeVolume(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java index 2b9e84f..2d5021a 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java @@ -52,6 +52,14 @@ }; getTable().addColumn(nameColumn, constants.NameVolume(), "150px"); //$NON-NLS-1$ + TextColumnWithTooltip<GlusterVolumeEntity> clusterColumn = new TextColumnWithTooltip<GlusterVolumeEntity>() { + @Override + public String getValue(GlusterVolumeEntity object) { + return object.getClusterName(); + } + }; + getTable().addColumn(clusterColumn, constants.clusterVolume(), "150px"); //$NON-NLS-1$ + TextColumnWithTooltip<GlusterVolumeEntity> volumeTypeColumn = new EnumColumn<GlusterVolumeEntity, GlusterVolumeType>() { -- To view, visit http://gerrit.ovirt.org/12461 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6b98e7b46e312d0dc0b9b29b7cb8a0b0a7ecd3b7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
