At the moment there is quite some logic going on, to decide whether to capture the views time etc.

This probably should be all moved into viewUI, so it's not executed on the actual page:

   $config = config('views.settings');

    // Set the response so other parts can alter it.
    $this->response = new Response('', 200);

    $start = microtime(TRUE);
    if (!empty($this->live_preview) && $config->get('ui.show.additional_queries')) {
      $this->startQueryCapture();
    }

    $exposed_form = $this->display_handler->getPlugin('exposed_form');
    $exposed_form->pre_render($this->result);

    // Check for already-cached output.
    if (!empty($this->live_preview)) {
      $cache = FALSE;
    }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Status: Active » Needs review
FileSize
1.95 KB

This patch moves this logic from render on ViewExecutable to renderPreview on the ViewUI object. This is a better place for it I think. We can also lose the check for live_preview.

dawehner’s picture

xjm’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.x-dev
Component: Code » views.module
dawehner’s picture

FileSize
5.67 KB

Let's rerole and clean it up a bit.

dawehner’s picture

Let's rerole and clean it up a bit.

Status: Needs review » Needs work

The last submitted patch, drupal-1811982-4.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
896 bytes
5.59 KB

I think a couple of the calls were on the ViewUI and not executable and vice versa.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1811982-7.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#7: drupal-1811982-7.patch queued for re-testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Cool!

Dries’s picture

Doesn't Drupal core have some timer functionality that may be re-usable here? I kinda forgot, to be honest.

dawehner’s picture

Status: Reviewed & tested by the community » Needs work

dries++ Wow that's pretty cool.

Working on that.

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.6 KB
903 bytes

There we go.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Looks good again to me, it's using the timer stuff that it seems we nearly all forgot about :)

tim.plunkett’s picture

Issue tags: -VDC

#13: drupal-1811982-13.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1811982-13.patch, failed testing.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
6.97 KB

Just another rerole. back to rtbc

dawehner’s picture

FileSize
5.58 KB

Nothing complicated

patch -p1 < drupal-1811982-13.patch 
patching file core/modules/views/lib/Drupal/views/ViewExecutable.php
Hunk #1 succeeded at 1227 with fuzz 2 (offset -3 lines).
Hunk #2 succeeded at 1324 (offset 2 lines).
Hunk #3 succeeded at 1692 (offset 2 lines).
patching file core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
damiankloip’s picture

+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.phpundefined
@@ -579,6 +579,56 @@ public function submitItemAdd($form, &$form_state) {
+    // make a copy of the array so we can manipulate it with array_splice.

Not sure this comment is accurate now?

dawehner’s picture

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

Let's rewrite it, so it does actually work.

damiankloip’s picture

#20: drupal-1811982-20.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Just tested this manually, works great.

catch’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Reviewed & tested by the community » Patch (to be ported)

Ooh much nicer. Committed/pushed to 8.x.