On 03/05/2013 12:34 AM, Dev Priya wrote:
Hi,

I have developed a Node.js based web UI that interacts with Autotest using the 
JSON interface that Autotest's default GWT frontend uses. For the jobs table I 
want to be able to search all jobs whose names match the given pattern but the 
current interface seems to be doing an exact match instead of a regular 
expression based or a partial match. For example -

That's great! If sometime you'd like to share it, we'd be happy to embrace it.

For my requirement, typing "Sleep Test" should be able to match "Sample Sleep Test", "Sleep Test" 
and "Sleep Test Modified" but right now it will match only "Sleep Test".

I want to know if there is a provision to achieve what I am looking for in the 
existing interface?

I was looking, and the rpc interface offers an API to list tests:

def get_tests(**filter_data):
    return rpc_utils.prepare_for_serialization(
        models.Test.list_objects(filter_data))

So the key here is to provide the right filter data. So, Django offers a number of filters, and the one that does the "LIKE" match is name__contains. So you would have to call the get_tests API with the filter data:

{'name__contains': 'Sleep Test', 'experimental': False}

I believe that's what you were looking for. In case it isn't, let me know.

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to