Adam Litke has uploaded a new change for review.

Change subject: engine: Search VMs by description
......................................................................

engine: Search VMs by description

Users have asked for the ability to search for Virtual Machines by
description.  Update the VmConditionFieldAutoCompleter class to define
'description' as a valid conditional field.

Change-Id: I2909b3444cf6729680018150974a644d2b61a790
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=526471
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java
M 
backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleterTest.java
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/21656/1

diff --git 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java
 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java
index 5c4b32b..650d93a 100644
--- 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java
+++ 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java
@@ -13,7 +13,7 @@
 
 public class VmConditionFieldAutoCompleter extends 
BaseConditionFieldAutoCompleter {
     public VmConditionFieldAutoCompleter() {
-        // Building the basic vervs Dict
+        // Building the basic verbs Dict
         mVerbs.add("NAME");
         mVerbs.add("COMMENT");
         mVerbs.add("STATUS");
@@ -37,6 +37,7 @@
         mVerbs.add("QUOTA");
         mVerbs.add("HOST");
         mVerbs.add("ID");
+        mVerbs.add("DESCRIPTION");
         // Building the autoCompletion Dict
         buildCompletions();
 
@@ -64,6 +65,7 @@
         getTypeDictionary().put("QUOTA", String.class);
         getTypeDictionary().put("HOST", String.class);
         getTypeDictionary().put("ID", UUID.class);
+        getTypeDictionary().put("DESCRIPTION", String.class);
 
         // building the ColumnName Dict
         columnNameDict.put("NAME", "vm_name");
@@ -90,6 +92,7 @@
         columnNameDict.put("QUOTA", "quota_name");
         columnNameDict.put("HOST", "run_on_vds_name");
         columnNameDict.put("ID", "vm_guid");
+        columnNameDict.put("DESCRIPTION", "vm_description");
 
         // Override field names for purpose of sorting, if needed
         sortableFieldDict.put("IP", 
StringFormat.format("fn_get_comparable_ip_list(%s)", getDbFieldName("IP")));
diff --git 
a/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleterTest.java
 
b/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleterTest.java
index 46a05bc..918b576 100644
--- 
a/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleterTest.java
+++ 
b/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleterTest.java
@@ -20,4 +20,11 @@
         assertFalse("Fer Ever", comp.validateFieldValue("UPTIME", "FerEver"));
     }
 
+    @Test
+    public void testDescriptionField() {
+        VmConditionFieldAutoCompleter comp = new 
VmConditionFieldAutoCompleter();
+        assertTrue(comp.validationDict.containsKey("DESCRIPTION"));
+        assertTrue(comp.validateFieldValue("DESCRIPTION", "bar"));
+    }
+
 }


-- 
To view, visit http://gerrit.ovirt.org/21656
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2909b3444cf6729680018150974a644d2b61a790
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to