Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

category-list: Separate presentation and control #2588

Merged
merged 6 commits into from
Dec 26, 2023

Conversation

TrimmingFool
Copy link
Contributor

@TrimmingFool TrimmingFool commented Nov 5, 2023

Unfortunately, this PR got bigger than I initially planned #2535 (comment). However, it is fairly well tested and limited to replacing the category-list (and quick-search).

With the aim of simplifying js/webui.js and improving code quality, presentation and control of the category-list have been separated and moved out of theWebUI. Additionally, explicit model classes for PanelLabelSelection, CategoryListStatistic and TorrentLabelTree have been created.

The presentation is controlled by attributes of a custom category-list element which consists of category-panel and panel-label elements. Plugins can inject custom attribute implementations to modify these components with the injectCustomElementAttribute function.

As the components use shadow DOMs, dedicated stylesheets for category-panel and panel-label have been added.
The components expose CSS variables to support theming.

Further, I changed the panel and label IDs to be more consistent:

pview_cont -> pview
pstate_cont -> pstate
plabel_cont -> plabel
flabel -> psearch
flabel_cont -> psearch
teg_{} -> psearch_{}
ptrackers_cont -> ptrackers
prss_cont -> prss

Upgrading existing IDs is not a problem but downgrading will require category-list: Support downgrade for panel/label IDs which maps new IDs to old IDs.

Non-Functional Changes

  • Control category list in js/category-list.js

    • The CategoryList instance is accessible by theWebUI.categoryList
    • Legacy panel/label IDs are mapped to new IDs
    • There are jest tests for category-list and panel
  • Render category list component in js/category-list-elements.js

    • category-list contains category-panels which in turn contains panel-labels components
    • There is jest test for category-list-elements
  • Adjust category list dependent plugins: extsearch, rss, tracklabels

  • Adjust themes to use the custom components CSS variables

  • (Make "New View" translatable)

Functional Changes

  • Show a modal dialog for renaming a view
  • Refresh category list when one of its display settings changes
  • Ctrl-Click on a All label toggles the selection of the corresponding category
  • RSS plugin: Indication of delayed errors with now floats right

@stickz
Copy link
Collaborator

stickz commented Nov 5, 2023

@TrimmingFool Develop is rebased now if you would like to resolve conflicts. I just want to review the code quickly before merging.

@TrimmingFool
Copy link
Contributor Author

@TrimmingFool Develop is rebased now if you would like to resolve conflicts. I just want to review the code quickly before merging.

There is no need to hurry. BTW it would be best to merge #2562, first.

@stickz
Copy link
Collaborator

stickz commented Nov 5, 2023

@TrimmingFool Develop is rebased now if you would like to resolve conflicts. I just want to review the code quickly before merging.

There is no need to hurry. BTW it would be best to merge #2562, first.

Done and versions bumped to 4.3.0. Conflicts need resolved again.

@stickz
Copy link
Collaborator

stickz commented Nov 7, 2023

Thank You. I'm going to merge this on the weekend and start testing it. I already tested #2562. Works great.

@stickz
Copy link
Collaborator

stickz commented Nov 16, 2023

Thanks for the revisions these are noted. I didn't have time to test last weekend because I released v4.2.8.

@TrimmingFool
Copy link
Contributor Author

@stickz Some fixes in v4.2 now conflict with this PR. If you merge the v4.2 branch into develop then I would/could rebase this PR again (and resolve the merge conflicts).

@stickz
Copy link
Collaborator

stickz commented Nov 18, 2023

@stickz Some fixes in v4.2 now conflict with this PR. If you merge the v4.2 branch into develop then I would/could rebase this PR again (and resolve the merge conflicts).

Yes we will rebase before merging. Let's wait anther week until v4.2.9 rolls out on the majority of platforms.

@stickz
Copy link
Collaborator

stickz commented Nov 26, 2023

@TrimmingFool I have cherry picked all 6 commits from v4.2 to develop. Conflicts can be resolved now.

This allows reading new panel and label IDs of the category-list
from the settings. For instance, `pstate` is interpreted as `flabel_cont`.
With the aim of improving code quality,
presentation and control of the category-list have been separated.
Additionally, explicit classes for model logic `PanelLabelSelection`,
`CategoryListStatistic` and `TorrentLabelTree` have been created.

The presentation is controlled by attributes of a custom `category-list`
element which consists of `category-panel` and `panel-label` elements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants