Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
682d0790997f
Commit
2cc7a064
authored
Nov 14, 2019
by
Laurent Peuch
Browse files
[debug-toolbar] add registry panel
Closes #17219866
parent
771c99f16780
Changes
4
Hide whitespace changes
Inline
Side-by-side
cubicweb/debug.py
View file @
682d0790
...
@@ -25,6 +25,7 @@ SUBSCRIBERS = {
...
@@ -25,6 +25,7 @@ SUBSCRIBERS = {
"controller"
:
[],
"controller"
:
[],
"rql"
:
[],
"rql"
:
[],
"sql"
:
[],
"sql"
:
[],
"vreg"
:
[],
}
}
...
...
cubicweb/pyramid/bwcompat.py
View file @
682d0790
...
@@ -93,6 +93,9 @@ class CubicWebPyramidHandler(object):
...
@@ -93,6 +93,9 @@ class CubicWebPyramidHandler(object):
ctrlid
,
req
.
path
,
controller
,
ctrlid
,
req
.
path
,
controller
,
inspect
.
getsourcefile
(
controller
.
__class__
),
inspect
.
getsourcefile
(
controller
.
__class__
),
inspect
.
getsourcelines
(
controller
.
__class__
)[
1
])
inspect
.
getsourcelines
(
controller
.
__class__
)[
1
])
emit_to_debug_channel
(
"vreg"
,
{
"vreg"
:
vreg
,
})
emit_to_debug_channel
(
"controller"
,
{
emit_to_debug_channel
(
"controller"
,
{
"kind"
:
ctrlid
,
"kind"
:
ctrlid
,
"request"
:
req
,
"request"
:
req
,
...
...
cubicweb/pyramid/debug_toolbar_templates/registry.dbtmako
0 → 100644
View file @
682d0790
% if vreg:
<div id="registry-store">
<div class="row">
<div class="col-md-3">
<nav id="registry-store-categories">
<ul class="nav nav-pills nav-stacked">
% for category in sorted(vreg.keys()):
<li role="presentation"><a href="#detail-${category}">${category}</a></li>
% endfor
</ul>
</nav>
</div>
<div class="col-md-9">
% for category, data in sorted(vreg.items(), key=lambda x: x[0]):
<div class="anchor">
<a class="anchor" id="detail-${category}"></a>
<h4>${category.title()}</h4>
<table class="table table-bordered table-striped">
% for key, values in sorted(data.items(), key=lambda x: x[0]):
<tr>
<th>${key}</th>
<td>
<ul>
% for value in values:
<li>
% if isinstance(value, type):
${value.__module__}.${value.__name__}
% else:
${value}
% endif
<ul>
% if hasattr(value, "cw_etype"):
<li>regid: '${value.cw_etype}'</li>
% elif hasattr(value, "__regid__"):
<li>regid: '${value.__regid__}'</li>
% endif
% if hasattr(value, "__select__"):
<li>select: '${value.__select__}'</li>
% if hasattr(value.__select__, "func_name"):
<li>select name: '${value.__select__.func_name}'</li>
% endif
% if hasattr(value.__select__, "score"):
<li>select score: '${value.__select__.score}'</li>
% endif
% endif
<li>registries: ${value.__registries__}</li>
% if hasattr(value, "rest_attr"):
<li>rest_attr: '${value.rest_attr}'</li>
% endif
% if hasattr(value, "fetch_attrs"):
<li>fetch_attrs: '${value.fetch_attrs}'</li>
% endif
% if hasattr(value, "cw_skip_copy_for"):
<li>cw_skip_copy_for: '${value.cw_skip_copy_for}'</li>
% endif
% if hasattr(value, "e_schema"):
<li>e_schema: '${value.e_schema}'</li>
% endif
</ul>
</li>
% endfor
</ul>
</td>
</tr>
% endfor
</table>
</div>
% endfor
</div>
</div>
</div>
% else:
<p>No registry store got collected, is it a bug?</p>
% endif
<style>
a.anchor {
display: block;
position: relative;
top: -150px;
visibility: hidden;
}
</style>
cubicweb/pyramid/debugtoolbar_panels.py
View file @
682d0790
...
@@ -54,6 +54,29 @@ class CubicWebDebugPanel(DebugPanel):
...
@@ -54,6 +54,29 @@ class CubicWebDebugPanel(DebugPanel):
unsubscribe_to_debug_channel
(
"controller"
,
self
.
collect_controller
)
unsubscribe_to_debug_channel
(
"controller"
,
self
.
collect_controller
)
class
RegistryDebugPanel
(
DebugPanel
):
"""
CubicWeb registry content and decisions debug panel
"""
name
=
'Registry'
title
=
'Registry Store'
nav_title
=
'Registry Store'
has_content
=
True
template
=
'cubicweb.pyramid:debug_toolbar_templates/registry.dbtmako'
def
__init__
(
self
,
request
):
self
.
data
=
{
'vreg'
:
None
}
subscribe_to_debug_channel
(
"vreg"
,
self
.
collect_vreg
)
def
collect_vreg
(
self
,
message
):
self
.
data
[
"vreg"
]
=
message
[
"vreg"
]
def
process_response
(
self
,
response
):
unsubscribe_to_debug_channel
(
"vreg"
,
self
.
collect_vreg
)
class
RQLDebugPanel
(
DebugPanel
):
class
RQLDebugPanel
(
DebugPanel
):
"""
"""
CubicWeb RQL debug panel
CubicWeb RQL debug panel
...
@@ -167,5 +190,6 @@ class SQLDebugPanel(DebugPanel):
...
@@ -167,5 +190,6 @@ class SQLDebugPanel(DebugPanel):
def
includeme
(
config
):
def
includeme
(
config
):
config
.
add_debugtoolbar_panel
(
CubicWebDebugPanel
)
config
.
add_debugtoolbar_panel
(
CubicWebDebugPanel
)
config
.
add_debugtoolbar_panel
(
RegistryDebugPanel
)
config
.
add_debugtoolbar_panel
(
RQLDebugPanel
)
config
.
add_debugtoolbar_panel
(
RQLDebugPanel
)
config
.
add_debugtoolbar_panel
(
SQLDebugPanel
)
config
.
add_debugtoolbar_panel
(
SQLDebugPanel
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment