Bug 8294 - Layers table is not updated correctly when "all/in project/not in project" filter is applied
Summary: Layers table is not updated correctly when "all/in project/not in project" fi...
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.0
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.0
Assignee: Michael Wood
QA Contact: Alexandru Roman
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-09-14 13:20 UTC by Elliot Smith
Modified: 2015-11-05 14:32 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elliot Smith 2015-09-14 13:20:28 UTC
Bug noted on master @ 75bad1b64bd485a50af69ed1f8663a0dadbb5f9e

Selecting one of the layer state filter options, i.e.

- "All"
- "Layers added to this project"
- "Layers not added to this project"

from the filter button on the "Add | Delete" column does not update the add/remove buttons for the displayed layers correctly. For example:

(1) After the "Layers added to this project" filter is applied, layers in the project still display the "Add layer" button, rather than the "Remove layer" one.

(2) After the "Layers not added to this project" filter is applied, layers not in the project still display the "Remove layer" button rather than the "Add layer" one.

To replicate (1):

* Start Toaster in managed mode.
* Add a new project.
* Click the "Layers" link in the "Compatible metadata" menu (left-hand side).
* Add a layer via its "Add layer" button. NB the layer is added correctly.
* Change the filter (funnel icon in right-most column) to "Layers added to this project".

The layers display correctly in the filtered list, but they have the wrong buttons ("Add layer" rather than "Remove layer"). Refreshing the page shows the correct buttons.

The source of the issue seems to be that the ctx for the page is set when the page is first loaded, including which layers are in the project; however, when you apply the filter, the ctx is not changed, so it contains old information about the project's layers.

Because tableInit() resets the show/hide state of the add/remove layer buttons every time it's called, the information about the current state of the layer is then being overwritten when the filter is applied to the table.
Comment 1 Elliot Smith 2015-09-14 13:22:27 UTC
Note that this superficially appears to be similar to https://bugzilla.yoctoproject.org/show_bug.cgi?id=7660, the source of the error is different: it's not because of history manipulation and/or HTTP caching, as in 7660; but rather because the data used to redraw the table is incorrect, as it is not refreshed when the filter is applied.
Comment 3 Alexandru Roman 2015-11-05 14:32:06 UTC
Verified on master: fc45deac89ef63ca1c44e763c38ced7dfd72cbe1