Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#449 Make "id" configurable.

open
Corey Trager
None
6
2010-12-24
2009-05-20
Anonymous
No

v. 3.1.6:
1. Make sure EnableTags = 1 in the web.config
2. Create a bug with a tag
3. Go to the bugs screen and select "show all bugs" in the queries dropdown
4. Click on "select tags"
5. Click on your newly created tag
6. The tags textbox populates, but the data does not filter to show bugs with those selected tags

Details:
- When the tags_input textbox changes, it's supposed to call "javascript:on_tags_change()" [App_Code/bug_list.cs, line 431].
- function on_tags_change() calls on_filter() [bug_list.js, line 302]
- function on_filter() looks like it has the problem[bug_list.js, line 56]
- code appears to look for filter dropdowns starting with "sel_[" to build a filter clause, but it doesn't use the tags_input control
- looks like you need to add a new block of code to build another "and" condition, which itself is a series of bg_tags like <blah> conditions separated by "or" inside paretheses. <-- may not perform well... perhaps store tags alphabetically to use one like clause, or create a table-valued function to run on list of tags and join against that (may not work in all versions of SQL Server...)

Discussion

  • Corey Trager
    Corey Trager
    2009-05-30

    I can't reproduce this. It's working for me. Can you reproduce this in the most recent version of BugTracker.NET?

    (Nobody else has reported this)

     
  • Corey Trager
    Corey Trager
    2009-05-30

    • priority: 5 --> 2
    • assigned_to: nobody --> ctrager
     
  • I have updated to v 3.1.8, and the problem still exists. I tried it in IE, Firefox, Chrome, but I don't see how any browser could properly filter on the tags because the javascript code for on_filter() is not referencing "tags_input" at all when building the filter criteria. The version I got from SourceForge is just getting the select lists and building a where clause from the dropdowns.

    function on_filter()
    {

    var filter\_condition = "66 = 66 "; // a dummy condition, just so I can start all the following with "and"
    
    // look for filter selects
    selects = document.getElementsByTagName\("SELECT"\)
    for \(var i = 0; i &lt; selects.length; i++\)
    \{
        sel = selects\[i\]
    
        if \(sel.id.indexOf\("sel\_\["\) == 0\)
        \{
            text = get\_selected\_text\(sel\)
    
            if \(text \!= "\[no filter\]"\)
            \{
                val = get\_selected\_val\(sel\)
    
                if \(text == "\[none\]"\)
                \{
                    filter\_condition += " and " + sel.id.substr\(4\) + " =$$$"
                    filter\_condition += val // value, not text
                \}
                else if \(text == "\[any\]"\)
                \{
                    filter\_condition += " and " + sel.id.substr\(4\) + "&lt;&gt;$$$"  // not equal
                    filter\_condition += val // value, not text
                \}
                else
                \{
                    if \(text.indexOf\("NOT "\) == 0\)
                    \{
                        filter\_condition += " and " + sel.id.substr\(4\) + "&lt;&gt;$$$"
                        filter\_condition += text.substring\(4\)
                    \}
                    else
                    \{
                        filter\_condition += " and " + sel.id.substr\(4\) + " =$$$"
                        filter\_condition += text
                    \}
    
                \}
                filter\_condition += "$$$"
            \}
    
        \}
    \}
    var frm = document.getElementById\(asp\_form\_id\);
    
    frm.new\_page.value = "0"
    frm.actn.value = "filter";
    frm.filter.value = filter\_condition;
    frm.submit\(\);
    

    }

     
  • Corey Trager
    Corey Trager
    2009-06-18

    In the javascript:

    Text in tags_input is put into the "tags" element of the form.

    function on_tags_change()
    {
    el = document.getElementById("tags_input")
    var frm = document.getElementById(asp_form_id)
    frm.tags.value = el.value
    on_filter()
    }

    Server side code for processing the "tags" element:

    string filter_string2 = filter_string.Replace("'", "''").Replace("$$$", "'");
    if (HttpContext.Current.Request["tags"] != null && HttpContext.Current.Request["tags"] != "")
    {
    filter_string2 += btnet.Tags.build_filter_clause(
    HttpContext.Current.Application,
    HttpContext.Current.Request["tags"]);
    }

    dv.RowFilter = filter_string2;

     
  • Aha. That's all I needed. I found the problem.

    App_Code/tags.cs: build_filter_clause(...)
    ...
    StringBuilder sb = new StringBuilder();
    sb.Append(" and id in (");
    ...

    The filter assumes the ID column is called "id". We like to use a different name here.

    I would suggest adding a third parameter to build_filter_clause(...) which includes the ID column name. The calling function (App_Code/bug_list.cs: sort_and_filter_buglist_dataview) has the dataview and so can get the column name to pass in.

     
  • Corey Trager
    Corey Trager
    2009-06-20

    • summary: "select tags" filter doesn't work --> Make "id" configurable.
     
  • Corey Trager
    Corey Trager
    2009-06-20

    I'm going to change this from a "Bugs" to a "Feature Request", make "id" configurable.

     
  • I'm not sure why it wouldn't be a bug... We can define our own queries and call the bg_id column anything we want, such as "Bug ID". Shouldn't the tags filter work regardless of what we call the ID column?

     
  • Corey Trager
    Corey Trager
    2009-06-23

    Well.... a bug is something where it's not working the way I intended, and this is actually working the way I intended.

    What you want is more configurablity than I've invested in.

    Yes, BugTtracker.NET let's you define your own queries, but those queries aren't free form. They have to follow rules. The rules don't give you much freedom to rename columns. You'll see the filter dropdown logic is also related to names being just so. It's fragile, me depending on the names being just so, not configurable, but to make it more configurable would also mean making it more complex.

     
  • Corey Trager
    Corey Trager
    2010-12-24

    • priority: 2 --> 6