Posts Tagged changesetUI

v0.9 Release Complete

All the goals for my v0.9 release have been accomplished and thus another release comes to an end. Looking back I ended up using quite a bit of jquery to fix my bugs. In the process I learnt some new things about the library that I didn’t know beforehand, such as how $(document).ready() works. The guys over at jquery have definitely done some good work.

Files touched

This patch had bitrotted as the pushlog had gone through a variety of changes since I had submitted it way back in 2008. Now, it is up to date and raring to go. I will most probably have another iteration for this patch though, where I add expand/collapse functionality to it. Although, I’ll have to get clearance from ted first though.

Changeset UI

Ted gave me an r- review since he didn’t like that I was removing what the user had entered in the text boxes if another item was selected from the drop down list. Also, he wanted the drop down list to remember which query type was last executed. I’ve managed to get both these features working and I also altered the code to take advantage of jquery, which is now available in hg_templates.

Line breaks turned into spaces

This was the new bug that I tackled this release. First of all I wanted to keep the line breaks instead of have them turned into spaces. I managed to do that. Next, I had to implement expand/collapse functionality for any commit messages that had more than one line break. Since I had experience doing this with another bug; I quickly managed to get this functionality working.

The following are the important links for this release:

The patches have been posted to their respective bug pages. Please view the project page for further details.

, , ,

1 Comment

v0.9 Release - Implementing changes to the Changset Query UI

In my goals blog post I outlined my revised plans for the changeset query UI. I wanted to make the use of jquery now that the library has been added to the repo. Also, the textbox value that the user enters for a query shouldn’t be removed or changed. Furthermore, I wanted to add the 3rd query supported by the pushlog, which takes in two pushids. Lastly, I also wanted the UI to remember the previously executed query (I forgot to specify this in my goals post). So, for example if I make a changeset query and the results are displayed, the selected item on the drop down should still be a changeset. I believe this is what ted wanted, if I understood him correctly.

Previous Implementation

Let me show you the old code to put things into perspective so that it’s easier to visualize what changes I have made:

function changeQueryType() 
{
  var queryType = document.getElementById("querytype");
  var fromBox = document.getElementById("from");
  var toBox = document.getElementById("to");
  if(queryType.value == "changeset") {
    fromBox.name = "fromchange";
    fromBox.value="#fromchange|escape#";
    toBox.name = "tochange";
    toBox.value="#tochange|escape#";
  } else {
    fromBox.name = "startdate";
    fromBox.value="#startdate|escape#";
    toBox.name = "enddate";
    toBox.value="#enddate|escape#";
}
<form action="{url}pushloghtml">
<div class="search">
<select id="querytype" onchange="changeQueryType()">
<option value="date">Date</option>
<option value="changeset">Changeset</option>
</select>&nbsp;&nbsp;&nbsp;
From:
<input id="from" type="text" name="startdate"  value="#startdate|escape#"/>
To:
<input id="to" type="text"name="enddate"  value="#enddate|escape#"/>
<input type="submit" value="Search"/>
</div>
</form>

Moving to jquery

As I mentioned before we are now using jquery in hg_templates. This is a great move as I love using this library. I’m still learning new things about it every time I try something. Here is what my code looks like with the jquery changes:

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// remember the previously selected query
var queryString = window.top.location.search.substring(1);
if(queryString != "") {
  if(queryString.indexOf("startdate") != -1)
    $(".querytype option[value='date']").attr('selected', 'selected');
  else if(queryString.indexOf("fromchange") != -1)
    $(".querytype option[value='changeset']").attr('selected', 'selected');
  else if(queryString.indexOf("startID") != -1)
    $(".querytype option[value='pushid']").attr('selected', 'selected');
}
//decide what query to execute
$('.querytype').change(function () {
  if($('.querytype option:selected').attr('value') == 'date') {
    $('.from').attr('name', 'startdate');
    $('.to').attr('name', 'enddate');
  }
  else if($('.querytype option:selected').attr('value') == 'changeset') {
    $('.from').attr('name', 'fromchange');
    $('.to').attr('name', 'tochange');
  }
  else {
    $('.from').attr('name', 'startID');
    $('.to').attr('name', 'endID');
  }
});
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<form action="{url}pushloghtml">
<div class="search">
<select class="querytype">
<option value="date">Date</option>
<option value="changeset">Changeset</option>
<option value="pushid">pushID</option>
</select>&nbsp;&nbsp;&nbsp;
From:
<input class="from" type="text" name="startdate"/>
To:
<input class="to" type="text" name="enddate"/>
<input class="submitquery" type="submit" value="Search"/>
</div>
</form>

Remembering the previously executed query

Now, this was a bit tricky. I experimented with 2 or 3 methods. There is the obvious method where I just read in whatever is entered and match it against a regex to see what type of query was executed. I decided not to take that approach. Then, I looked at using jquery to read the selected item in the drop down list when the search button gets clicked. That didn’t work for me. I ended up looking at the query string to find out what query got executed.

So in the above code (line 38) I just retrieve the query string and do an indexOf to find the query type. It ended up being pretty simple.

Don’t remove the values entered by the user

To improve usability, ted recommended that I shouldn’t reset the text box value when the drop down selection changes. First of all I decided to remove the default date that you currently find in the text boxes. This is because if I make a changeset query via the new UI, after the page loads the default date values re-appear in the text boxes since they are hard coded.

Now when the change event occurs I don’t set the value and so if the user decides to change the query type the values he entered will not change.

The 3rd pushlog query

There is another pushlog query that takes in a startID and an endID. I’ve added this new query option to the drop down menu as well.

Unfortunately for this patch showing screenshots won’t help at all since you have to try it out for yourself to see whether the implementation works correctly or not. I’ll be putting up the patch soon so whoever is interested can get it from the bug page and try it out for themselves.

,

No Comments

v0.9 Release Goals

The end of the semester is approaching rapidly (only 2 weeks left) and so is my time here at Seneca. I can’t believe 4 years have gone by so fast. No time to think about my time after graduation though. I’m in engulfed in work right now, a typical situation this late in the semester. Anyway, it’s time for yet another release.

This time I’m not going to touch my major bug. Instead, I’ll be making changes to three other bugs this time around. I’ll be revisting one of the bugs that I fixed last semester (files touched). It had been approved for a long time now but the patch never got applied to the repo and it seems to have bitrotted now. The next bug I will be tackling is the changesetUI one for which I need to make some changes. Last but not the least, I’ll will take on a new bug regarding line breaks for long messages. The following are the goals for this release:

  • Files touched - Update the patch to make it work with the new code in hgpoller and hg_templates. Also move the all the css to a stylesheet.
  • Changeset UI - ted reviewed the patch that I submitted for this bug and he doesn’t want me to set the value when the drop down changes. This would mean that whatever the user has already entered would be overwritten. I guess it makes sense, since you want to avoid that from a usability standpoint. Also I will look to re-write the code to take advantage of jquery which has been added to the repo now. Furthermore, there is another query for the pushlog that takes in two pushids. I will be adding that to the drop down list as well.
  • Line breaks turned into spaces - When a long message is displayed in the pushlog the linebreaks are not registered. My goal is to only show the first line and then show an ellipsis link that the user can click to show/hide the rest of the message that has the line breaks.

Fun stuff! Time to get to work!

, , ,

No Comments