Skip to content

Commit 960d7df

Browse files
committed
Fix adminhtml render
1 parent 3d158ce commit 960d7df

File tree

15 files changed

+103
-80
lines changed

15 files changed

+103
-80
lines changed

Helper/Data.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22
namespace ADM\QuickDevBar\Helper;
33

4-
use Magento\Customer\Model\Session;
4+
5+
use Magento\Framework\Session\Generic as QdbSession;
56
use Magento\Framework\App\Config\ScopeConfigInterface;
67
use Magento\Framework\App\Filesystem\DirectoryList;
78
use Magento\Framework\App\State;
@@ -42,7 +43,8 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
4243
/**
4344
* @var Session
4445
*/
45-
private $session;
46+
private $qdbSession;
47+
4648
private array $ideList;
4749

4850
/**
@@ -55,7 +57,7 @@ public function __construct(
5557
\Magento\Framework\Filesystem $filesystem,
5658
array $ideList,
5759
State $appState,
58-
Session $session
60+
QdbSession $qdbSession
5961
) {
6062
parent::__construct($context);
6163
$this->cacheFrontendPool = $cacheFrontendPool;
@@ -64,7 +66,7 @@ public function __construct(
6466

6567
$this->filesystem = $filesystem;
6668
$this->appState = $appState;
67-
$this->session = $session;
69+
$this->qdbSession = $qdbSession;
6870
$this->ideList = $ideList;
6971
}
7072

@@ -316,8 +318,8 @@ public function getModuleVersion($moduleName)
316318

317319
protected function getWrapperBaseFilename($ajax = false)
318320
{
319-
$sessionId = $this->appState->getAreaCode().$this->session->getSessionId();
320-
return 'qdb_register_' . (!$ajax ? 'std' : 'xhr') . '_' . $sessionId;
321+
$qdbSessionId = $this->appState->getAreaCode().$this->qdbSession->getSessionId();
322+
return 'qdb_register_' . (!$ajax ? 'std' : 'xhr') . '_' . $qdbSessionId;
321323
}
322324

323325

@@ -344,7 +346,7 @@ public function getWrapperContent($ajax = false)
344346
}
345347

346348
if(empty($wrapperFiles)) {
347-
throw new LocalizedException(__('No files for wrapper'));
349+
throw new LocalizedException(__('No files for wrapper'.$filename));
348350
}
349351

350352
if(count($wrapperFiles)>1 && $ajax) {
@@ -372,7 +374,7 @@ public function getWrapperContent($ajax = false)
372374
// /** @var \SplFileInfo $fileInfo */
373375
// foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
374376
// if($fileInfo->isFile()) {
375-
// //TODO: unlink only files starting with 'qdb_register_' . $sessionId
377+
// //TODO: unlink only files starting with 'qdb_register_' . $qdbSessionId
376378
// //unlink($fileInfo->getPathname());
377379
// }
378380
// }
@@ -386,7 +388,7 @@ protected function cleanOldFiles()
386388
/** @var \SplFileInfo $fileInfo */
387389
foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
388390
if($fileInfo->isFile() && time() - $fileInfo->getMTime() > 20) {
389-
//TODO: unlink only files starting with 'qdb_register_' . $sessionId
391+
//TODO: unlink only files starting with 'qdb_register_' . $qdbSessionId
390392
unlink($fileInfo->getPathname());
391393
}
392394
}

Observer/UpdateLayoutObserver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ public function __construct(\ADM\QuickDevBar\Helper\Data $qdbHelper)
2626
public function execute(Observer $observer)
2727
{
2828
if(!$this->qdbHelper->isAjaxLoading()) {
29+
/** @var \Magento\Framework\View\Layout $layout */
2930
$layout = $observer->getData('layout');
3031
$layout->getUpdate()->addHandle('quickdevbar');
3132
}
3233
return $this;
3334
}
34-
}
35+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ The structure of this toolbar is extremely simple you just need to add a new blo
5959
- Queries Tab
6060
![](doc/images/qdb_screen_queries.png)
6161

62+
- Profile Tab
63+
![](doc/images/qdb_screen_dispatch.png)
64+
6265
- Theme chooser
6366
![](doc/images/qdb_screen_dark.png)
6467

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"OSL-3.0",
77
"AFL-3.0"
88
],
9-
"version": "0.3.1",
9+
"version": "0.3.2",
1010
"require": {
1111
"magento/magento-composer-installer": "*"
1212
},

doc/Changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Changelog: Quick Developer Toolbar for Magento2
22
====================================
3+
0.3.2
4+
* Fix adminhtml renderer
5+
* Add doc screenshots
6+
7+
8+
0.3.1
9+
* Fix the typo in the XML closing tag within the comment, thanks to [hgati](https://github.com/vpietri/magento2-developer-quickdevbar/pull/86)
10+
311
0.3.0
412
* Compatibility Magento 2.4.7 with strict CSP policy
513
* Hyva and Breeze compatibility (vanilla JS)

doc/images/qdb_screen_dispatch.png

-2.34 KB
Loading

doc/images/qdb_screen_queries.png

-8.89 KB
Loading

doc/images/qdb_screen_request.png

8.26 KB
Loading

view/base/layout/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<body>
33
<referenceContainer name="before.body.end">
44
<block class="ADM\QuickDevBar\Block\Toolbar" name="quick.dev.toolbar" as="quick.dev.toolbar" template="ADM_QuickDevBar::toolbar.phtml" after="-">
5-
<container name="quick.dev.toolbar.content"></container>
5+
<container name="quick.dev.toolbar.content" label="QuickDevBAr content container" ></container>
66
</block>
77
</referenceContainer>
88
</body>

view/base/templates/tab/action.phtml

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,46 @@
44
?>
55

66
<table class="qdb_table">
7-
<tr>
8-
<th>Change QDB theme</th>
9-
<td>
10-
<select id="qdb-theme-selector">
11-
<option value="">Standard</option>
12-
<option value="dark">Dark</option>
13-
<option value="kawaii">Kawaii UwU</option>
14-
</select>
15-
</td>
16-
<td id="process-template_hints_storefront"></td>
17-
</tr>
18-
<tr>
19-
<th>Template Path Hints for Storefront</th>
20-
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_storefront"}, "target":"process-template_hints_storefront"}' class="qdb-action">Toggle</button></td>
21-
<td id="process-template_hints_storefront"></td>
22-
</tr>
23-
<tr>
24-
<th>Template Path Hints for Admin</th>
25-
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_admin"}, "target":"process-template_hints_admin"}' class="qdb-action">Toggle</button></td>
26-
<td id="process-template_hints_admin"></td>
27-
</tr>
28-
<tr>
29-
<th>Add Block Names to Hints</th>
30-
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_blocks"}, "target":"process-template_hints_blocks"}' class="qdb-action">Toggle</button></td>
31-
<td id="process-template_hints_blocks"></td>
32-
</tr>
33-
<tr>
34-
<th>Translate inline</th>
35-
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"translate"}, "target":"process-translate"}' class="qdb-action">Toggle</button></td>
36-
<td id="process-translate"></td>
37-
</tr>
38-
<tr>
39-
<th>Flush Cache Storage</th>
40-
<td><button type="button" data-qdbAction='{"path":"action/cache", "target":"process-cache"}' class="qdb-action">Flush</button></td>
41-
<td id="process-cache"></td>
42-
</tr>
7+
<thead>
8+
<tr>
9+
<th>Change QDB theme</th>
10+
<td>
11+
<select id="qdb-theme-selector">
12+
<option value="">Standard</option>
13+
<option value="dark">Dark</option>
14+
<option value="kawaii">Kawaii UwU</option>
15+
</select>
16+
</td>
17+
<td id="process-template_hints_storefront"></td>
18+
</tr>
19+
</thead>
20+
<tbody>
21+
<tr>
22+
<th>Template Path Hints for Storefront</th>
23+
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_storefront"}, "target":"process-template_hints_storefront"}' class="qdb-action">Toggle</button></td>
24+
<td id="process-template_hints_storefront"></td>
25+
</tr>
26+
<tr>
27+
<th>Template Path Hints for Admin</th>
28+
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_admin"}, "target":"process-template_hints_admin"}' class="qdb-action">Toggle</button></td>
29+
<td id="process-template_hints_admin"></td>
30+
</tr>
31+
<tr>
32+
<th>Add Block Names to Hints</th>
33+
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"template_hints_blocks"}, "target":"process-template_hints_blocks"}' class="qdb-action">Toggle</button></td>
34+
<td id="process-template_hints_blocks"></td>
35+
</tr>
36+
<tr>
37+
<th>Translate inline</th>
38+
<td><button type="button" data-qdbAction='{"path":"action/configUpdate", "params":{"config[key]":"translate"}, "target":"process-translate"}' class="qdb-action">Toggle</button></td>
39+
<td id="process-translate"></td>
40+
</tr>
41+
<tr>
42+
<th>Flush Cache Storage</th>
43+
<td><button type="button" data-qdbAction='{"path":"action/cache", "target":"process-cache"}' class="qdb-action">Flush</button></td>
44+
<td id="process-cache"></td>
45+
</tr>
46+
</tbody>
4347
</table>
4448

4549
<script type="text/javascript">

0 commit comments

Comments
 (0)