History log of /external/autotest/frontend/client/src/autotest/common/table/DataSource.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4879914c122f4ed97eae3b08c5af1930fd75b39d 13-Nov-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Fix a bug where hosts in a cloned job weren't removed when deselecting the host from the "browse hosts" table. This again turned out to be a relatively large change for the size of the problem, because I chose to make some refactorings to attack some of the design problems the were behind the issue in the first place.

The core issue was that the ArrayDataSource was using a plain SortedSet<JSONObject> to hold the selected hosts. This is good because we want to keep them sorted, but it's bad because it uses the default object equality for JSONObjects, but we want to use a special equality based on ID or hostname. We normally accomplish that with JSONObjectSet, but that doesn't get us the sorting. JSONObjectSet is sort of a hack in the first place; the proper solution is to use custom objects that override equality.

As a first step towards that approach, I created a Host class under the models autotest.afe.models package. In order to minimize the scope of this change, I made it override JSONObject, so that we can move incrementally. I made it override equality and made HostDataSource convert the results to Host objects before returning them.

Unfortunately, I ran into a second problem. DataSource passes back results in a JSONArray. Since JSONArrays use native JS objects for storage, the objects you get out of them are always real JSONObjects, constructed on the fly -- not just declared type, but actual type. Even if you put Hosts in, they'll effectively be converted back to plain JSONObjects when you take them out. This is a reflection of a second design problem -- we shouldn't use JSONArrays to pass data around within the program. So I changed DataSource to convert results to List<JSONObject> and pass the data back that way. This required minor changes across many files, but nothing drastic anywhere.

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3943 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
b9c6617bdc063b3b4aa760a0a45190ee069139fd 13-Nov-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Modify DynamicTableSelectionListener so that when select "none" is clicked, only deselect items matching the current filters. This turned out to be considerably trickier than i thought, because in order to do this properly and efficiently, it has to work like this: when "none" is clicked, make an RPC call for all the currently filtered items that fall within the currently selected set. We do this by making a new request to the table's active DataSource with the current filtering params plus a list of selected item IDs. There are two problems here:

1) Not all tables show DB objects -- in particular, the host detail view table when "show verifies/repairs/cleanups" is selected, and the TKO table view when grouping is active. For these tables, there's no way to filter on selected items by ID. Fortunately, these tables also happen to not be prone to the original issue, because they can't be filtered. So I added some code to only apply this new logic to tables that have active user-controlled filters. This is pretty ugly from a design point of view, but I had to take a practical approach -- it works, the code is clean, and I couldn't think of any workable alternatives.

2) The DataSource interface was poorly designed such that an RpcDataSource was stateful (and mutated every time a new request was made), so there was no way to make a new request on a DataSource without messing up its state and therefore potentially messing up the table using it. To get around this, I redesigned the interface to use a separate Query objects. Now, both the DataSource and the Query objects are immutable, and making a separate query for the "select none" operation is easy. (This actually also encouraged a change to DynamicTable to be much more efficient by avoiding many unnecessary get_num_*() calls.)

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3941 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
5e2c70db8586bcd4c47fe6e5173357539c84cc57 31-Jul-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> couple of changes needed for new TKO:
-make NotifyManager support direct logging
-make DataSource support an onError method



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1938 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
9865997a354f669584c1cc3ef210efbdefb9a508 17-Jul-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> -fixed url redirection for /tko URLs in debug server, to ease development pain
-changed links in job details table a bit (added status log link and changed text)
-change rpc_utils.py to handle datetime.date objects
-various minor changes needed for new TKO



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1861 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
9f8a27b21824eb4a0f1c977ead46aea269b66e53 14-Jul-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> change DataSource (and subclasses) and DynamicTable to support multi-level sorting (sorting on multiple fields)


git-svn-id: http://test.kernel.org/svn/autotest/trunk@1830 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
e3f6868dac3b4c4714637d12b93d97823011a35c 05-Jun-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> GWT reorg part 3


git-svn-id: http://test.kernel.org/svn/autotest/trunk@1614 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java
ee4baa6495590c14c933f1fafa37d1843bbee996 05-Jun-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> GWT reorg step 1. This is just too difficult to do in one step. This temporarily breaks GWT but we'll just have to accept that. It'll be fixed soon.


git-svn-id: http://test.kernel.org/svn/autotest/trunk@1612 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DataSource.java