Problem/Motivation

#2574767-36: Views listing page displays too few items on a page removed the "Tags" column from the list of views at /admin/structure/views, because it was rarely used.

I don't personally use Views Tags on every project, so I understand with, and largely agree with the reasoning in that issue. Also I couldn't find any other issues asking for it to be re-added, which probably also indicates that the feature is not used that often.

That being said, I do find Views tags very useful in specific situations, e.g.: for managing technical debt on a site with multiple developers and a tight timeline... I tag views by their base table, contextual filters, whether they use aggregation, and where they are used; so that it is easy for developers to find an existing view they can add a new display to (rather than creating an entirely new view), and it is easy to see which views could be combined when they are already a mess.

Ideally, the list of views at /admin/structure/views would become a view of its own (e.g.: as part of #1823450: [Meta] Convert core listings to Views), which would allow me to simply add a tags column on the sites that required it; and leave it at the default everywhere else.

However, in the meantime, it would be handy to have a patch to apply to add the tags column back.

Proposed resolution

Write a patch to re-add the tags column.

Remaining tasks

  1. Write a patch.

I'll leave it to others to determine whether this is something we want to add back to Drupal core; or just leave here for people to apply when they need it.

User interface changes

Adds a "tags" column between Description and Displays to the list of views at /admin/structure/views

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#63 after-patch.png536.77 KBsmustgrave
#63 before-patch.png226.54 KBsmustgrave
#60 2929931-after-patch.png49.39 KBDevashish Jangid
#60 2929931-before-patch.png49.3 KBDevashish Jangid
#59 reroll_diff_2929931_56-59.txt2.44 KBankithashetty
#59 2929931-59.patch5.7 KBankithashetty
#56 views-ui-tags-2929931-56.patch6.84 KBChi
#50 after_rerolled_patch.PNG124.3 KBdilliganesh
#50 2929931-50.patch6.08 KBdilliganesh
#49 2929931-48.patch6.08 KBdilliganesh
#48 after_rerolled_patch.PNG124.3 KBdilliganesh
#47 2929931-47.patch6.08 KBdilliganesh
#47 after_rerolled_patch.PNG124.3 KBdilliganesh
#42 afterpatch.png100.76 KBRinku Jacob 13
#42 beforepatch.png104.41 KBRinku Jacob 13
#40 Screen Shot 2021-04-30 at 3.33.40 PM.png80.91 KBSKAUGHT
#38 After--patch.jpg374.02 KBranjith_kumar_k_u
#36 interdiff_34_36.txt1.35 KBanmolgoyal74
#36 2929931-36.patch6.06 KBanmolgoyal74
#34 2929931-34.patch6.04 KBAbhijith S
#27 2929931-27.patch6.19 KBLendude
#27 Screenshot 2019-10-09 at 17.38.12.png359.7 KBLendude
#22 no_update.PNG21.47 KBsameeran joshi
#20 2929931-19-20.txt2.5 KBAnonymous (not verified)
#20 2929931-20.patch6.41 KBAnonymous (not verified)
#19 views_ui_update_screen.png11.49 KBAnonymous (not verified)
#19 interdiff-10-19.txt2.67 KBAnonymous (not verified)
#19 2929931-20.patch5.54 KBAnonymous (not verified)
#12 unable_to_get_in_searchbar.PNG39.46 KBsameeran joshi
#10 interdiff-7-10.txt786 bytesAnonymous (not verified)
#10 2929931-10.patch4.96 KBAnonymous (not verified)
#10 2929931-10-test-only.patch1.72 KBAnonymous (not verified)
#7 interdiff-2-6.txt4.31 KBAnonymous (not verified)
#7 2929931-6.patch4.95 KBAnonymous (not verified)
#7 2929931-6-test-only.patch1.71 KBAnonymous (not verified)
#6 show-view-tags-on-admin-list.png17.11 KBAnonymous (not verified)
#2 2929931-2-show-view-tags-on-admin-list.patch2.94 KBmparker17
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Assigned: mparker17 » Unassigned
Issue summary: View changes
Status: Active » Needs review
FileSize
2.94 KB

Here's a patch; reviews welcome.

At time-of-writing, this patch can be applied to 8.4.x HEAD (commit 6372cc36bc) and 8.3.x HEAD (commit dda95265df); it applies cleanly using git apply --index but applies with offset notices in ViewListBuilder.php using patch -p1.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Anonymous’s picture

The #2 patch is perfectly applied to the current 8.6.x too. And it works fine (after cleaning the cache). Do we need to add any tests here, or is it just a matter of community approval?

The tags do sometimes help a lot. Especially for filtering a large number of views. See also #2477115: Views UI no longer allows filtering the list by tag, display, or type.

Therefore, deleting tags was probably an extra step in simplification in #2574767: Views listing page displays too few items on a page.

Lendude’s picture

Priority: Minor » Normal
Issue tags: +Needs tests, +Needs screenshots, +Needs usability review

Do we need to add any tests here, or is it just a matter of community approval?

Yes, tests please! why do you think I went through the trouble of adding them? :-) See #2753791: Add javascript testing for the Views listing page.

Should be easy enough to add some assertions to \Drupal\Tests\views_ui\FunctionalJavascript\ViewsListingTest

Some screenshots of how this will look would be nice and it probably needs a usability review (i think?).

Anonymous’s picture

@Lendude, big thanks for hints! Some assertions added. ViewsListingTest is a very comfortable place indeed!

However, I'm afraid not to collect total approval with one input field for filtering names, descriptions, tags...:
 EMBED show-view-tags-on-admin-list
But as a first step may not be so bad? The second step - creating a more complex filtering system in #2477115: Views UI no longer allows filtering the list by tag, display, or type (?)

Anonymous’s picture

The last submitted patch, 7: 2929931-6-test-only.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 7: 2929931-6.patch, failed testing. View results

Anonymous’s picture

Status: Needs work » Needs review
FileSize
1.72 KB
4.96 KB
786 bytes

Oops.

The last submitted patch, 10: 2929931-10-test-only.patch, failed testing. View results

sameeran joshi’s picture

  1. after patch
  2. image after patch

thanku @vaplas but,I am unable to get the "tags" quote in the searchbar. for the patch

2929931-10.patch

Does anyone know about the reason?

sameeran joshi’s picture

Anonymous’s picture

@sameeran joshi, clear cache ;)

sameeran joshi’s picture

I have cleared it using Administration > Configuration > Development > Performance.

Anonymous’s picture

After applying the patch, I have an absolutely identical screen like you in #12. And using "Clear all cache" (Administration > Configuration > Development > Performance) fixed it.

Another way: go to /update.php and press "Continue" (empty update also triggering clear cache).

Try also remove twig-cache (just remove folder sites/default/files/php/twig)

Try also refresh page via Ctrl+F5 (sometimes Chrome likes to hold a cache)

No other ideas.

Lendude’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -77,6 +78,27 @@ public function testFilterViewsListing() {
    +    // Ensure that some View contains 'default' tag.
    +    View::load('content')->set('tag', 'default')->save();
    +    // Ensure that some View contains not 'default' tag.
    +    View::load('user_admin_people')->set('tag', 'my first tag')->save();
    ...
    +    $this->drupalGet('admin/structure/views');
    

    It would be better to do this in setUp() I think, mixing API calls and functional testing feels a bit wrong.
    It also means we don't need the extra drupalGet to reload the page.

  2. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -77,6 +78,27 @@ public function testFilterViewsListing() {
    +      if ($row->isVisible()) {
    +        $this->assertContains('default', $tag);
    +      }
    +      else {
    +        $this->assertNotContains('default', $tag);
    +      }
    

    Currently we have no assertion that the else actually gets hit. If the setting of 'my first tag' somehow failed (or we take that line out) this would still pass. So maybe also filter on 'my first tag' and make sure we get the right results?

sameeran joshi’s picture

thanku @vaplas for all suggestions.1,3,4 didn't work well.but could you please elaborate the 2nd one in simple and detailed steps,as i am a newbie to drupal,please

Anonymous’s picture

Status: Needs work » Needs review
FileSize
5.54 KB
2.67 KB
11.49 KB

@Lendude, thanks for these tips! Done + added hook_update.

@sameeran joshi, try using this new patch (#19). Then go to the /update.php page and click Continue. You should see the following screenshot:
views_ui_update_screen
Click "Apply pending updates". Should help.

I also want to caution that until the issue has not received approval, so there is a risk that it will be closed. Therefore, while Need review means "to check if it is necessary at all" :)

In fact, I can easily understand that returning a tag as it is can cause a negative reaction among some developers.

But someone uses it. And the tags also allow to remove the default view, a large number of which sometimes interfere with the work (#2945073: Way To Hide system views).

But from the filter through the general input field on several columns it is not enough sense for that :(

I've already looked at a couple of interesting table filters, I'll add information about them to the #2477115: Views UI no longer allows filtering the list by tag, display, or type later.

The last submitted patch, 19: 2929931-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sameeran joshi’s picture

FileSize
21.47 KB

it seems that the steps are followed but isn't working well.thanks for support.

dddbbb’s picture

I'd love to see this back in core. Top work folks! :D

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Status: Needs review » Needs work

Also issue summary needs update with screenshots - before/after to get usability review

+++ b/core/modules/views_ui/views_ui.install
@@ -0,0 +1,8 @@
+function views_ui_update_8500() {
+  // Empty update to cause a cache flush.
+}

It should be post_update hook https://www.drupal.org/node/2960601

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Lendude’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs tests, -Needs screenshots
FileSize
359.7 KB
6.19 KB

Reroll (so no interdiff) and changed update to post update, and added screenshot to the IS.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

AdamPS’s picture

Patch works for me thanks.

However the issue summary indicates that an earlier commit removed the tags column so it's not necessarily acceptable to put it back. If you don't have a wide screen this patch makes the columns narrow and the page becomes difficult to use.

The ability to filter by tags is useful and has no disadvantage that I can see, so we could likely commit that. We could make the tag column visually hidden by default (CSS?) in a way that would be easy for sites to override. Sites could also choose to hide a different column (most likely machine name) to make room to reveal the tags.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jrearick’s picture

This is pretty neat, however, it might not be the greatest to suddenly add it back into the interface. As @AdamPS mentioned, it was removed for a valid reason. Perhaps, in the view settings page, we add a checkbox to show/hide the column with the default off? Adding it to the filter, I think, is fine all the time.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Abhijith S’s picture

Patch #27 can't be applied on 9.2.x .Needs reroll

Checking patch core/modules/views_ui/src/ViewListBuilder.php...
Hunk #1 succeeded at 99 (offset -5 lines).
Hunk #2 succeeded at 141 (offset -5 lines).
Hunk #3 succeeded at 221 (offset -3 lines).
Checking patch core/modules/views_ui/templates/views-ui-views-listing-table.html.twig...
Checking patch core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php...
Hunk #2 succeeded at 34 (offset 5 lines).
Hunk #3 succeeded at 88 (offset 5 lines).
error: while searching for:
   * Removes any non-visible elements from the passed array.
   *
   * @param array $elements
   * @return array
   */
  protected function filterVisibleElements($elements) {
    $elements = array_filter($elements, function ($element) {

error: patch failed: core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php:128
error: core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php: patch does not apply
Checking patch core/modules/views_ui/views_ui.post_update.php...
Checking patch core/themes/stable/templates/admin/views-ui-views-listing-table.html.twig...
Abhijith S’s picture

Added reroll for patch #27.Please check it.

Status: Needs review » Needs work

The last submitted patch, 34: 2929931-34.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anmolgoyal74’s picture

Updated CS and deprecation test failure.

anmolgoyal74’s picture

Status: Needs work » Needs review
ranjith_kumar_k_u’s picture

FileSize
374.02 KB

I have tested the last patch.The patch adds the Tags column ,but it did not show the view tags.

after patch

Bohus Ulrych’s picture

Hi all,
very useful functionality for me, I'm voting to have this back.
And I was confused - I can set Administrative tags, but I can't use them anywhere for filtering? Sound like inconsistency.

@anmolgoyal74 Patch #36 is not working - tags are not displayed, because you are adding {{ row.data.tag.data }} in core/modules/views_ui/templates/views-ui-views-listing-table.html.twig, but is should be actually {{ row.data.tags.data }}

It is correct for core/themes/stable/templates/admin/views-ui-views-listing-table.html.twig, but this template is not used in my case.

Thanks

SKAUGHT’s picture

patch36 works as expected. patched tested against D8.9.x. using contrib admin theme. simple cache clear.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Rinku Jacob 13’s picture

FileSize
104.41 KB
100.76 KB

Verified and tested patch#36 for drupal 9.3.x-dev version. Patch applied successfully but table columns are misplaced after applying the patch.Adding screenshot for the Reference

xaa’s picture

looking at Rinku #42 image afterpatch.png it seems there is an issue on the table headings if tags column is empty.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Bohus Ulrych’s picture

FYI patch is not #36 is not fully successfully applied with Drupal 9.3.0 - but problem is only with patching test file core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php

I'm still facing issues described in my previous post #39. No one else has same problem?

vikashsoni’s picture

Patch #36 not applying in drupal-9.3.x-dev showing error while going to apply the patch
Needs to re-roll

dilliganesh’s picture

Assigned: Unassigned » dilliganesh
Status: Needs review » Reviewed & tested by the community
FileSize
124.3 KB
6.08 KB

1. I’ve re-rolled the patch #36 and it is working fine in drupal 9.4.x
2. I am able to see the tags with associated values. The TAG column is placed after the column for Description.
3. I added an additional tag for the existing view and it is also getting displayed.
4. Also I am able to filter by Tags.
5. Find below screenshot for the newly applied re-rolled patch

dilliganesh’s picture

FileSize
124.3 KB

1. I’ve re-rolled the patch #36 and it is working fine in drupal 9.4.x
2. I've fixed the custom command failed

dilliganesh’s picture

1. I’ve re-rolled the patch #36 and it is working fine in drupal 9.4.x
2. I've fixed the custom command failed

dilliganesh’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
6.08 KB
124.3 KB

1. I’ve re-rolled the patch #36 and it is working fine in drupal 9.4.x.
2. I am able to see the tags with associated values. The TAG column is placed after the column for Description.
3. I added an additional tag for the existing view and it is also getting displayed.
4. Also I am able to filter by Tags.
5. I've changed the status to 'Needs Review'.
5. Find below screenshot for the newly applied re-rolled patch.

Bohus Ulrych’s picture

Great job @dilliganesh !
Works like charm - tested with 9.3.0

mkindred’s picture

I tested 2929931-50.patch against 9.3.2, and it's working for me.

SKAUGHT’s picture

Status: Needs review » Reviewed & tested by the community

changing status as per #51, #52

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 50: 2929931-50.patch, failed testing. View results

Chi’s picture

The patch needs to update Claro's template for the view listing.
core/themes/claro/templates/admin/views-ui-views-listing-table.html.twig

Chi’s picture

SKAUGHT’s picture

Status: Needs review » Reviewed & tested by the community

The newest kid/theme on the block has been left out (: thanks

quietone’s picture

Assigned: dilliganesh » Unassigned
Status: Reviewed & tested by the community » Needs work

This is changing the UI so before and after screenshots are needed in the Issue Summary.

Patch does not apply, setting to NW. Un-assigning since others have been working on this for the last two months or so.

+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
@@ -133,9 +154,10 @@ public function testFilterViewsListing() {
+   *   Elements for filter.
...
+   *   Visible elements.

These changes appear to be out of scope.

ankithashetty’s picture

Here is a rerolled patch. Removed changes made to file core/themes/claro/templates/admin/views-ui-views-listing-table.html.twig since #3264220: Remove Claro's views-ui-views-listing-table.html.twig template got in. Also addressed the reviews made by @quietone in #58.

Thanks!

Devashish Jangid’s picture

Drupal 9.4.x-dev
Verified and tested patch #59.
Sharing screenshots for the reference.

Chi’s picture

Another thing that needs to be fixed is storage schema for the tags. "tag" property actually stores multiple tags. And for that reason should be stored as array not as comma separated strings. This also means it needs to be renamed to "tags". I am not sure if this should belong to this ticket though.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
226.54 KB
536.77 KB

Tested #59. Posted screenshots. @chi should there be a follow up ticket for your comment #61

quietone’s picture

Status: Reviewed & tested by the community » Needs work

There are a lot of rerolls and screenshots in the issue when instead what should have happened is action on the Usability review asked for in for in Feb 2018 in #5. This was also pointed out in See #25 with a brief explanation of what needs to be done. And again in #58.

Also, there is a suggestion in #31 that has not been addressed as well as a potential follow up needed for #61 (pointed out in #63).

I also do not see a code review since Feb 2018. Let's get a set of eyes on the code and the test.

A reminder to all to read all the comments and review the issue tags.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.