Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Workflow] Add a link to mermaid.live from the profiler #60193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,22 @@
{{ source('@WebProfiler/Script/Mermaid/mermaid-flowchart-v2.min.js') }}
const isDarkMode = document.querySelector('body').classList.contains('theme-dark');
mermaid.initialize({
flowchart: { useMaxWidth: false },
flowchart: {
useMaxWidth: true,
},
securityLevel: 'loose',
'theme': 'base',
'themeVariables': {
theme: 'base',
themeVariables: {
darkMode: isDarkMode,
'fontFamily': 'var(--font-family-system)',
'fontSize': 'var(--font-size-body)',
fontFamily: 'var(--font-family-system)',
fontSize: 'var(--font-size-body)',
// the properties below don't support CSS variables
'primaryColor': isDarkMode ? 'lightsteelblue' : 'aliceblue',
'primaryTextColor': isDarkMode ? '#000' : '#000',
'primaryBorderColor': isDarkMode ? 'steelblue' : 'lightsteelblue',
'lineColor': isDarkMode ? '#939393' : '#d4d4d4',
'secondaryColor': isDarkMode ? 'lightyellow' : 'lightyellow',
'tertiaryColor': isDarkMode ? 'lightSalmon' : 'lightSalmon',
primaryColor: isDarkMode ? 'lightsteelblue' : 'aliceblue',
primaryTextColor: isDarkMode ? '#000' : '#000',
primaryBorderColor: isDarkMode ? 'steelblue' : 'lightsteelblue',
lineColor: isDarkMode ? '#939393' : '#d4d4d4',
secondaryColor: isDarkMode ? 'lightyellow' : 'lightyellow',
tertiaryColor: isDarkMode ? 'lightSalmon' : 'lightSalmon',
}
});

Expand Down Expand Up @@ -275,6 +277,7 @@
click {{ nodeId }} showNodeDetails{{ collector.hash(name) }}
{% endfor %}
</pre>
<a href="{{ collector.buildMermaidLiveLink(name) }}">View on mermaid.live</a>

<h3>Calls</h3>
<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,46 @@ public function getCallsCount(): int
return $i;
}

public function hash(string $string): string
{
return hash('xxh128', $string);
}

public function buildMermaidLiveLink(string $name): string
{
$payload = [
'code' => $this->data['workflows'][$name]['dump'],
'mermaid' => '{"theme": "default"}',
'autoSync' => false,
];

$compressed = zlib_encode(json_encode($payload), ZLIB_ENCODING_DEFLATE);

$suffix = rtrim(strtr(base64_encode($compressed), '+/', '-_'), '=');

return "https://mermaid.live/edit#pako:{$suffix}";
}

protected function getCasters(): array
{
return [
...parent::getCasters(),
TransitionBlocker::class => function ($v, array $a, Stub $s, $isNested) {
unset(
$a[\sprintf(Caster::PATTERN_PRIVATE, $v::class, 'code')],
$a[\sprintf(Caster::PATTERN_PRIVATE, $v::class, 'parameters')],
);
TransitionBlocker::class => static function ($v, array $a, Stub $s) {
unset($a[\sprintf(Caster::PATTERN_PRIVATE, $v::class, 'code')]);
unset($a[\sprintf(Caster::PATTERN_PRIVATE, $v::class, 'parameters')]);

$s->cut += 2;

return $a;
},
Marking::class => function ($v, array $a, Stub $s, $isNested) {
Marking::class => static function ($v, array $a) {
$a[Caster::PREFIX_VIRTUAL.'.places'] = array_keys($v->getPlaces());

return $a;
},
];
}

public function hash(string $string): string
{
return hash('xxh128', $string);
}

private function getEventListeners(WorkflowInterface $workflow): array
{
$listeners = [];
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.