Problem/Motivation

We introduced some trivial URI prefixes, named it "collect".

It is resolved to the full URI on mouseover. But it is not clear when just looking at the output.

Proposed resolution

Add a legend listing prefixes (name and URI).

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juanse254’s picture

Status: Active » Needs review
FileSize
1.38 KB

Added Legend for "collect:"

mbovan’s picture

Status: Needs review » Needs work
  1. +++ b/config/install/views.view.collect.yml
    @@ -616,7 +616,20 @@ display:
    +            value: '<b>*collect: = "http://schema.md-systems.ch/collect/0.0.1"</b>'
    

    I think the full schema uri should be http://schema.md-systems.ch/collect/0.0.1/ (with / at the end).

  2. +++ b/config/install/views.view.collect.yml
    @@ -616,7 +616,20 @@ display:
    +            format: full_html
    

    We can use basic_html format here and instead of <b> tags, switch to <strong>.

Also, we should add web tests (in CollectWebTest::testContainerUi()) to assert footer is not visible if there are no containers and visible if there are some captured containers.

Edit: when we make some user interface changes we usually attach a screenshot too. :)

juanse254’s picture

Status: Needs work » Needs review
FileSize
117.6 KB
3.61 KB

URI fixed, changed to strong tags and test added on testContainerUi().

Screenshot as an attachment.

mbovan’s picture

Status: Needs review » Needs work
  1. +++ b/config/install/views.view.collect.yml
    @@ -616,7 +616,18 @@ display:
    +          plugin_id: text_custom
    

    We had to replace Text area with Unfiltered text as Text area footer is not displayed in tests for some reason.

  2. +++ b/src/Tests/CollectWebTest.php
    @@ -76,13 +76,6 @@ class CollectWebTest extends WebTestBase {
    -    $container = Container::create(array(
    -      'origin_uri' => 'https://drupal.org/project/collect/test',
    -      'type' => 'text/plain',
    -      'data' => 'Hello <strong>World!</strong>',
    -      'date' => (new DrupalDateTime('2014-12-16 09:40'))->getTimestamp(),
    -    ));
    -    $container->save();
     
         $this->drupalGet('admin/content/collect');
    

    After moving this part, we can remove the first blank line too.

  3. +++ b/src/Tests/CollectWebTest.php
    @@ -93,10 +86,18 @@ class CollectWebTest extends WebTestBase {
         $this->drupalLogin($user);
    -
         $this->drupalGet('admin/content');
    
    @@ -174,7 +175,6 @@ class CollectWebTest extends WebTestBase {
         $this->assertNoLink(t('Collect Fetch URL'));
    -
         // Apply Fetch URL model plugin.
    

    But not these two. :)

  4. +++ b/src/Tests/CollectWebTest.php
    @@ -191,6 +191,7 @@ class CollectWebTest extends WebTestBase {
    +    $this->assertText(t('http://schema.md-systems.ch/collect/0.0.1/'));
    

    Here, we assert that text http://schema.md-systems.ch/collect/0.0.1/ is displayed somewhere on the page.
    To make sure that we assert URI legend, what we can do is to assert raw HTML and check the tags too.
    E.g. $this->assertRaw('<strong>*collect: = "http://schema.md-systems.ch/collect/0.0.1/"</strong>'), and same with assertNoRaw(...).

  5. The screenshot should be created on the live page (/admin/content/collect).
juanse254’s picture

Status: Needs work » Needs review
FileSize
1.74 KB
3.36 KB
105.49 KB
miro_dietiker’s picture

Status: Needs review » Needs work
+++ b/config/install/views.view.collect.yml
@@ -616,7 +616,18 @@ display:
+          content: '<strong>*collect: = "http://schema.md-systems.ch/collect/0.0.1/"</strong>'

A legend should be semantically identified as a legend. For other examples see Monitoring or TMGMT - both have a legend.
The quotes are not needed.

BTW the latest screenshot does not show the legend.

juanse254’s picture

Status: Needs work » Needs review
FileSize
113.43 KB
6.26 KB
4.57 KB

Quotes taken, legend is semantically identified now and screenshot is updated.

mbovan’s picture

Status: Needs review » Needs work
  1. +++ b/client/src/Plugin/QueueWorker/CollectClientQueueWorker.php
    @@ -245,12 +245,12 @@ class CollectClientQueueWorker extends QueueWorkerBase implements ContainerFacto
    -      $message = $exception->getMessage();
    +      $message = '';
           // Get a response.
           if ($response = $exception->getResponse()) {
    +        $message = $this->parseResponse($response, 'message') ?: '';
             // In case of server error, suspend further handling of the queue.
             if ($response->getStatusCode()[0] == '5') {
    -          $message = $this->parseResponse($response, 'message') ?: $message;
               throw new SuspendQueueException($message, 0, $exception);
             }
    

    This is the part of the patch #11 committed in #2510612: Filter captured entities before sending to the server. I guess, you didn't pull the latest (Collect) changes on 8.x-1.x.
    Before uploading the patch, make sure that you have the latest version on your head branch and that you rebased properly.

  2. @@ -672,4 +687,8 @@ display:
    diff --git a/interdiff-2472479-3-5.txt b/interdiff-2472479-3-5.txt
    
    diff --git a/interdiff-2472479-3-5.txt b/interdiff-2472479-3-5.txt
    new file mode 100644
    
    new file mode 100644
    index 0000000..2e0f9e3
    
    index 0000000..2e0f9e3
    --- /dev/null
    
    --- /dev/null
    +++ b/interdiff-2472479-3-5.txt
    
    +++ b/interdiff-2472479-3-5.txt
    +++ b/interdiff-2472479-3-5.txt
    @@ -0,0 +1,41 @@
    
    @@ -0,0 +1,41 @@
    +diff --git a/src/Tests/CollectWebTest.php b/src/Tests/CollectWebTest.php
    +index 870e5a2..be075a9 100644
    +--- a/src/Tests/CollectWebTest.php
    ++++ b/src/Tests/CollectWebTest.php
    +@@ -79,17 +79,17 @@ class CollectWebTest extends WebTestBase {
    + ¶
    +     $this->drupalGet('admin/content/collect');
    +     $this->assertResponse(403);
    +-
    +     $user = $this->drupalCreateUser(array(
    +       'administer collect',
    +       'access administration pages',
    +       'access content overview',
    +     ));
    +     $this->drupalLogin($user);
    ++
    +     $this->drupalGet('admin/content');
    +     $this->clickLink('Collect');
    +     $this->assertResponse(200);
    +-    $this->assertNoText(t('http://schema.md-systems.ch/collect/0.0.1/'));
    ++    $this->assertNoRaw('<strong>*collect: = "http://schema.md-systems.ch/collect/0.0.1/"</strong>');
    +     $container = Container::create(array(
    +       'origin_uri' => 'https://drupal.org/project/collect/test',
    +       'type' => 'text/plain',
    +@@ -175,6 +175,7 @@ class CollectWebTest extends WebTestBase {
    +     // Assert no link to the model is displayed.
    +     $this->assertNoText(t('Model'));
    +     $this->assertNoLink(t('Collect Fetch URL'));
    ++
    +     // Apply Fetch URL model plugin.
    +     // Assert a generated web resource is accessible.
    +     $this->clickLink(t('Set up a @plugin model', [
    +@@ -191,7 +192,7 @@ class CollectWebTest extends WebTestBase {
    +     $this->clickLink(t('Show content in a new window'));
    +     $this->assertResponse(200);
    +     $this->drupalGet('admin/content/collect');
    +-    $this->assertText(t('http://schema.md-systems.ch/collect/0.0.1/'));
    ++    $this->assertRaw('<strong>*collect: = "http://schema.md-systems.ch/collect/0.0.1/"</strong>');
    +     $this->clickLink(t('View'));
    +     $this->clickLink(t('Show content in a new window'));
    +     $this->assertResponse(200);
    

    An interdiff should be a separate file, not part of the patch.

juanse254’s picture

Rebased and deleted interdiff from patch.

EDIT: This is working fine, we need to wait until this issue gets solved to apply the patch, until then the patch will fail the tests.

Status: Needs review » Needs work

The last submitted patch, 9: fix_uri_prefix_legend-2472479-9.patch, failed testing.

The last submitted patch, 9: fix_uri_prefix_legend-2472479-9.patch, failed testing.

mbovan’s picture

Status: Needs work » Needs review

#2527148: Adding processors to the model is broken is committed, retesting the latest patch.

mbovan’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.