Sunday, September 8, 2013

Twelfth week report - Unit testing and improvements

By the start of the last week most of the scheduled developments were over as planned initially. What I planned for the last week was adding new unit tests for the code written in the second half of GSoC. With the experience of writing unit tests from the first half adding new unit tests were not very hard and I submitted a pull request with new unit tests.

While adding a new table level tab for table specific privileges I realized a limitation in the was I implemented configurable menus. In the system table that stores the allowed menus I had a column for each menu to indicate whether that tab is allowed. However this resulted in the need to change table structure whenever a new tab is added to phpMyAdmin. Hence I went on to change the table structure and submitted a pull request for that too.

With the last weeks work my planned tasks for GSoC come to an end. I've asked my mentor whether there is anything else I need to do before the deadline and would attend to any work he might pointed out. All in all it has been a very good experience and I learned a lot.  :)

Sunday, September 1, 2013

Eleventh week report - Navigation panel improvements and table specific privileges

First half of the eleventh week of GSoC was spent on followup work on the 'Navigation panel and current table' feature request. By the time I submitted the pull request for the above feature request another developer has implemented a feature that would open the corresponding database in the navigation panel when a database is selected. I previously had this implemented as a part of the pull request and I had to merge the two implementations. Further I was asked to port the merged changes to the QA4 branch so it would be released sooner than the other features.

With these changes
1. Database node is opened and highlighted when the user goes to a database. Database groups created based on the defined separator is handled.
2. Table/view is highlighted in the navigation when the user goes to a table/view. Table and view containers are handled. Table groups created base on the defined separator is also handled.

Second half of the week was spent on creating a privileges tab for table level. This feature is in lieu of 'reCAPTCHA support on login panel' feature which has already been implemented. Borrowing the idea form database level privilege tab, this tab displays all the granted privileges related the current table. While implementing I was able to reuse some of the code between database level and new table level privileges tabs.

During the next week I plan to add documentation and write unit tests for the features implemented in the second half of GSoC.

Monday, August 26, 2013

Tenth week report - Navigation panel and current table

During the tenth week of coding I implemented the feature request '#1398 - Navigation panel and current table'. Even though I personally loved the navigation tree improvement it seems that people find it not so user friendly due to some of its shortcomings. One of them is that it does not indicate the current database or table/view when navigation was done without using it.

When implementing the feature request I used PMA_commonParams.get() function which makes the current database and table available for JavaScript level. With these variables the navigation decides where the user had navigated and open the database or table/view appropriately.

What this feature request does is,
1. When  the user is in the database level, current database is highlighted in the navigation panel. If the database is grouped under a database group the groups is opened to highlight the database.
2. When the user is in the table/view level, current table/view is highlighted in the navigation panel. Following situations are handled here.
    a. Tables/views could be directly under the database or inside 'Tables'/'Views' containers.
    b. Tables/views could be grouped based on their names.
    c. A combination of the above two.

The last two feature requests I planned to implement have already been implemented and I plan to write to the developers' mailing list to get approval for some feature requests I'm going to implement in place of them.

Sunday, August 18, 2013

Ninth week report - 'Single Row Editor: Value column too small' & 'Change icon in the left pane to based on the link target'

During the ninth week of coding I went on to implement two feature requests, namely
1. Single Row Editor: Value column too small and
2. Change icon in the left pane to based on the link target

The first one requires that a text area is provided to edit binary values when the size of the value exceeds the size that can easily be edited with an input field. The seconds feature request was to change the icon shown before the table name be adjusted based on the target of the icon. By default clicking on the icon takes the user to table structure page and the icon should be the 'structure' icon to represent that. Similarly the icon needs to be changed to reflect the link target if it is configured to something else.

Implementation wise both these feature requests were much easier than I anticipated and I was left with extra time to work on something else. Hence I started working on 'Navigation panel and current table' which was originally planned for the next week and seems to take more time than I anticipated earlier. During the next week I will work on completing it.

Saturday, August 10, 2013

Eighth week report - Unit testing ctd. and fractional seconds in time

During the eighth week of GSoC I continued to add unit tests for the new code written in the first half of the program. Specifically I added unit tests for navigation item hiding feature implemented quite closer to the mid term evaluation. Writing unit test cases was not as challenging as the previous week due to the experienced gain writing unit tests.

During the same week I implemented the feature request that requested phpMyAdmin extend its support for time, datetime and timestamp data types with fractional seconds. The major problem for implementation was jQuery timepicker not supporting micro seconds. I looked into this problem earlier and had submitted a solution to jQuery timepicker project which got integrated. So I updated the plugin to its latest stable version and went on to add fractional seconds for time data types.

Sunday, August 4, 2013

Seventh week report - Unit testing and documentation

Undoubtedly this was the most challenging week of GSoC I've had so far. This was mainly due to unit testing and I added tests for the functionality implemented by me during the first half of GSoC. I already had some experiences in unit testing using PHPUnit. However this was the first time I used mocking. I was familiar with the concept and went through a couple of online resources to make myself familiar with mocking in PHPUnit. The best resource was the existing phpMyAdmin tests and it had quite a number of instances where resources such as database connection were mocked.

Mocking in PHPUnit allows setting expectations and these expectations can be set based on the method being invoked and the index of method invocation.
For ex:
I interpreted the above as setting expectation for the first invocation of 'fetchAssoc' and spend a good amount of time trying to figure out why my tests fail. After a bit of reading online I figured out that the index is not related to the method, but relates to the number of time 'any' method is invoked on the mocked object. There seemed to quite a lot of people who had interpreted it in that way; see this and this.

I did most of the documentation while implementing the features, such as documenting new configurations. So documentation wise what I did during this week was porting these updates from the code to the phpMyAdmin wiki.

Sunday, July 28, 2013

Sixth week report - Export view as it was a table

Sixth week of coding was spent mostly on two tasks. The first one was extending hiding tables in navigation panel to other top level items under a database and polishing up the implementation. There were couple of suggestions by my mentor as well as other phpMyAdmin team members about the wordings and tables names I corrected them in my subsequent commits. The second task for the week was implementing 'rfe #1321 - Export view as it was a table'.

Implementing the new feature I introduced a new checkbox at the export page for the users to specify whether views should be exported as they were tables. This is not checked by default, leading to exporting view definitions as earlier, not to surprise users who are used to the old behavior. Here is a screenshot of it.

To derive a suitable structure for the table I used the output from getColumns() method of DatabaseInterface and the data returned by the method were sufficient to identify the properties of each column of the view.

The feature works at 3 levels
1. Exporting a view using the export tab at table level
2. Exporting the results of a query on a view
3. Exporting rows of a view by selecting the with checkboxes that are displayed against each row.

As indicated in my schedule I plan to use this week to write test cases and documentation for the development carried out in the first iteration. I have updated most of the documentation alongside feature implementation. So documentation would mostly be on updating the wiki.