Commit 1927dee7 authored by Tomáš Pospíšil's avatar Tomáš Pospíšil
Browse files

fix WebSwitcherUrls

parent 1c6d2f48
......@@ -42,7 +42,7 @@ final class InternalSmartyBarPanel extends BaseBarPanel
private function assignSmarty(): void
{
$variables = $this->currentSmarty->getAssigns();
foreach ($variables as $name => $assigns) {
foreach ($variables as $assigns) {
foreach ($assigns as $assign) {
assert($assign instanceof InternalTrace);
if ($assign->processed) {
......@@ -50,6 +50,10 @@ final class InternalSmartyBarPanel extends BaseBarPanel
}
$assign->backtraces = array_map(
static function ($backtrace) {
if ($backtrace === null) {
return null;
}
return urldecode(Dumper::editorLink($backtrace));
},
$assign->backtraces
......
......@@ -8,6 +8,7 @@ use Nette\Utils\Strings;
final class WebSwitcherUrls
{
private const NORMALIZED = '__NORMALIZED__';
/**
* @var string
......@@ -39,12 +40,11 @@ final class WebSwitcherUrls
$current = $this->currentUrl();
$host = parse_url($current, PHP_URL_HOST) ?? '';
$normalized = Strings::replace(urldecode($current), '/' . preg_quote($host, '/') . '/', self::NORMALIZED, 1);
$normalized = Strings::replace(urldecode($current), '/' . preg_quote($host, '/') . '/', '%s', 1);
$this->local = Strings::replace(sprintf($normalized, $local), '|https|', 'http');
$this->testing = sprintf($normalized, $testing);
$this->live = sprintf($normalized, $live);
$this->local = Strings::replace($this->replaceDomain($normalized, $local), '|https|', 'http');
$this->testing = $this->replaceDomain($normalized, $testing);
$this->live = $this->replaceDomain($normalized, $live);
if (Strings::contains($host, $local)) {
$this->current = 'local';
......@@ -106,4 +106,9 @@ final class WebSwitcherUrls
return $this->local;
}
private function replaceDomain(string $normalized, string $domain): string
{
return Strings::replace($normalized, '|' . self::NORMALIZED . '|', $domain);
}
}
......@@ -14,7 +14,7 @@
</tr>
{foreach $data as $query}
<tr>
<td style="background-color: {if $query.time > 1}red{elseif $query.time >0.1}yellow{else}lightgreen{/if}">{($query.time * 1000)|number_format:2}
<td style="background-color: {if $query.time > 0.1}red{elseif $query.time >0.05}yellow{else}lightgreen{/if}">{($query.time * 1000)|number_format:2}
ms
</td>
<td style="background-color: {if $query.count > 3}red{elseif $query.count >1}yellow{else}lightgreen{/if}">{$query.count}</td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment