Provide a block for running cron from a dashboard

Created on 17 December 2022, almost 2 years ago
Updated 1 March 2024, 9 months ago

Problem/Motivation

As part of the Dashboard initiative 🌱 Enhance user experience with customizable dashboards Active one of the needs detected was the ability to run cron from the dashboard for admin users.

Would be great to have a block in the admin dashboard for running cron to make it more simple and intuitive for admin users..

Proposed resolution

As the dashboard concept is developed, provide the ability to run cron from a block in the dashboard.

Remaining tasks

  • Patch
  • Tests

User interface changes

  • New block available.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Postponed

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated 35 minutes ago

Created by

πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs product manager review

    It is used to alert the product manager core committer(s) that an issue represents a significant new feature, UI change, or change to the "user experience" of Drupal, and their signoff is needed. If an issue significantly affects the usability of Drupal, use Needs usability review instead (see the governance policy draft for more information).

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    The block itself might need tests.

    1. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      + * Provides a block to display 'Site branding' elements.
      

      Fix comment.

    2. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      + *   forms = {
      + *     "settings_tray" = "Drupal\system\Form\SystemBrandingOffCanvasForm",
      + *   },
      

      This needs to be removed.

    3. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +    $cron_last = \Drupal::state()->get('system.cron_last');
      ...
      +      $cron_last = \Drupal::state()->get('install_time', 0);
      

      Inject state?

    4. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +    $request_time = \Drupal::time()->getRequestTime();
      

      Inject time()?

    5. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +    $summary = t('Last run @time ago', ['@time' => \Drupal::service('date.formatter')->formatTimeDiffSince($cron_last)]);
      

      Inject date.formatter?

    6. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +    $x['cron'] = [
      

      This needs to be $data, or to be removed.

    7. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +        '#title' => t('more information'),
      ...
      +        '#title' => t('Run cron'),
      

      We need StringTranslationTrait and $this->t()

    8. +++ b/core/modules/system/src/Plugin/Block/CronStatusBlock.php
      @@ -0,0 +1,159 @@
      +    return Cache::mergeTags(
      +      parent::getCacheTags(),
      +      $this->configFactory->get('system.cron')->getCacheTags()
      +    );
      

      We need CacheableMetadata->createFrom() to ensure we don't leave anything behind.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Discussed with @lauriii. Splitting the big status report template into smaller pieces it's useful no matter what happens with dashboards. They eventually might become sdc components. So it makes sense to propose that change in core already.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    On second thoughts, we agreed that it's not that important atm, and we can avoid that for now. Probably by the time we plan to integrate this that might have been converted to SDC already.

  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid
  • Pipeline finished with Failed
    10 months ago
    Total: 186s
    #92929
  • Pipeline finished with Failed
    10 months ago
    Total: 1078s
    #92934
  • Pipeline finished with Failed
    10 months ago
    Total: 2939s
    #92951
  • Pipeline finished with Canceled
    10 months ago
    Total: 262s
    #93016
  • Pipeline finished with Running
    10 months ago
    #93021
  • Pipeline finished with Success
    10 months ago
    Total: 559s
    #93034
  • Status changed to Needs review 10 months ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Update status.

  • Status changed to RTBC 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Tested this out by manually verifying the block appears in the block layout list
    Placed the block at the top of the content region.
    Verified it worked as expect

    CR reads well.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Double checked in CronForm whether it includes the cron status/last stufff, and it does. This looks good to me.

  • Status changed to Needs work 9 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Added some comments to the MR.

  • Pipeline finished with Success
    9 months ago
    Total: 578s
    #107080
  • Status changed to Needs review 9 months ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Thank you for your review @alexpott.

    Addressed the comments MR.

    Moving it back to Needs Review.

  • Pipeline finished with Success
    9 months ago
    Total: 525s
    #107113
  • Status changed to RTBC 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Feedback appears to be addressed.

  • πŸ‡¬πŸ‡§United Kingdom catch

    🌱 Enhance user experience with customizable dashboards Active is still waiting for product manager approval, and this block will only make sense with that, so tagging for product managers.

  • Status changed to Postponed 9 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch
Production build 0.71.5 2024