Add examples for all typical channels / types or provide a more user-friendly select

Created on 18 April 2024, 5 months ago
Updated 1 August 2024, about 1 month ago

Soft-postponed on 📌 [3.x] Follow-up: Integrate multiple notification objects with AJAX Active

Problem/Motivation

We can presumably only make types selectable that already "happened" to watchdog, as the filter list at /admin/reports/dblog is generated dynamically based on the existing entries.

There is no global list, because each module may define its own channels.

Still it would be very helpful to have a list of the selectable channels.

So we should perhaps keep the textarea, but should list all the currently logged types in the description below (as HTML list) to copy & paste into the textarea.
This still allows the user to enter further, custom channels / types he knows about, that have not been logged yet.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇩🇪Germany LRWebks Porta Westfalica

    I see two options here:

    1. We gather all different message types used in Core and list them in the description
    2. We use the function below from the Database Logging module which provides a neat SQL query result for us and list them as "Message Channels that have appeared so far" or something like that, in the description. (Better Option in my opinion)
    function _dblog_get_message_types() {
        return \Drupal::database()->query('SELECT DISTINCT([type]) FROM {watchdog} ORDER BY [type]')
            ->fetchAllKeyed(0, 0);
    }
    

    I would however refrain from using an HTML list, as there can sometimes be a lot of different channels and that would just make the Form a bit long... Maybe just a comma separated paragraph?

  • 🇩🇪Germany Anybody Porta Westfalica

    Yeah or a combination of both!

    Important for (2): We'd then have to add this, if core's dblog module is enabled by using:

    $moduleHandler = \Drupal::service('module_handler');
    if ($moduleHandler->moduleExists('dblog')) {
      // Code Here
    }
    

    Feel free to implement a clever combination of both. I think for the static textual representation it would be enough to list some typical examples:

    • access denied
    • content
    • cron
    • form
    • locale
    • php
    • system
    • user

    This could then be extended dynamically by the result from the dblog query, if the module is installed.

    All in all we shouldn't invest > 1H here.

    Go for it @LRWebks :)

  • Assigned to LRWebks
  • Status changed to Needs work about 2 months ago
  • 🇩🇪Germany LRWebks Porta Westfalica
  • Merge request !28Resolve #3441730 "Add examples for" → (Merged) created by LRWebks
  • Status changed to Needs review about 2 months ago
  • 🇩🇪Germany LRWebks Porta Westfalica

    I have a feeling that you might like this :)
    Unfortunately, the Database Logging module does not provide this function via a service, so I wrote a helper function to get the SELECT myself (this also removes the dependency on DBLog entirely) and I also added your suggestions for the "Commonly used channels" as I think they are pretty reasonable to be listed at all times.
    What do you think?

  • Pipeline finished with Failed
    about 2 months ago
    Total: 192s
    #227601
  • Pipeline finished with Success
    about 2 months ago
    Total: 156s
    #227640
  • Status changed to Needs work about 2 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Final improvements (documentation). Then this is ready! You've tested it manually?
    We don't need a test for this.

  • Status changed to Needs review about 2 months ago
  • 🇩🇪Germany LRWebks Porta Westfalica
  • Issue was unassigned.
  • Status changed to RTBC about 2 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Well done, thank you! Let's merge this :)

  • Status changed to Fixed about 2 months ago
  • 🇩🇪Germany Anybody Porta Westfalica
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024