fastpluggy-debug-tools 0.0.28__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. fastpluggy_debug_tools-0.1.2/PKG-INFO +32 -0
  2. fastpluggy_debug_tools-0.1.2/README.md +19 -0
  3. fastpluggy_debug_tools-0.1.2/fastpluggy_debug_tools.egg-info/PKG-INFO +32 -0
  4. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/fastpluggy_debug_tools.egg-info/SOURCES.txt +1 -0
  5. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/fastpluggy_debug_tools.egg-info/requires.txt +1 -1
  6. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/pyproject.toml +2 -2
  7. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/plugin.py +18 -11
  8. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/__init__.py +3 -3
  9. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/debug.py +5 -5
  10. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/menu_tools.py +3 -3
  11. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/module_tools.py +4 -4
  12. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/pool_info.py +4 -4
  13. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/requirements.py +5 -5
  14. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/websocket_tool.py +8 -8
  15. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/tasks.py +28 -0
  16. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/templates/widgets/debug/debug_panel.html.j2 +27 -103
  17. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/widgets/debug/debug_panel.py +4 -6
  18. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/widgets/packages_view.py +2 -2
  19. fastpluggy_debug_tools-0.0.28/PKG-INFO +0 -12
  20. fastpluggy_debug_tools-0.0.28/fastpluggy_debug_tools.egg-info/PKG-INFO +0 -12
  21. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/MANIFEST.in +0 -0
  22. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/fastpluggy_debug_tools.egg-info/dependency_links.txt +0 -0
  23. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/fastpluggy_debug_tools.egg-info/entry_points.txt +0 -0
  24. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/fastpluggy_debug_tools.egg-info/top_level.txt +0 -0
  25. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/setup.cfg +0 -0
  26. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/__init__.py +0 -0
  27. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/config.py +0 -0
  28. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/requirements_tools.py +0 -0
  29. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/memory_tools.py +0 -0
  30. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/settings.py +0 -0
  31. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/task_thread_tools.py +0 -0
  32. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/router/uvicorn.py +0 -0
  33. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/static/debug.css +0 -0
  34. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/templates/widgets/packages_view.html.j2 +0 -0
  35. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/widgets/__init__.py +0 -0
  36. {fastpluggy_debug_tools-0.0.28 → fastpluggy_debug_tools-0.1.2}/src/widgets/debug/__init__.py +0 -0
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastpluggy-debug-tools
3
+ Version: 0.1.2
4
+ Summary: Debug Tools plugin for Fastpluggy
5
+ Author: FastPluggy Team
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: FastPluggy>=0.4.0
9
+ Requires-Dist: psutil
10
+ Requires-Dist: packaging
11
+ Provides-Extra: all
12
+ Requires-Dist: pympler; extra == "all"
13
+
14
+ # fastpluggy-debug-tools
15
+
16
+ Debug Tools plugin for FastPluggy — runtime introspection and diagnostics.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install -e .
22
+ ```
23
+
24
+ Optional extras for memory profiling:
25
+
26
+ ```bash
27
+ pip install -e ".[all]"
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Register the plugin in your FastPluggy configuration. Once loaded it provides diagnostic pages for inspecting the running application: loaded plugins, configuration, routes, and memory usage.
@@ -0,0 +1,19 @@
1
+ # fastpluggy-debug-tools
2
+
3
+ Debug Tools plugin for FastPluggy — runtime introspection and diagnostics.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install -e .
9
+ ```
10
+
11
+ Optional extras for memory profiling:
12
+
13
+ ```bash
14
+ pip install -e ".[all]"
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Register the plugin in your FastPluggy configuration. Once loaded it provides diagnostic pages for inspecting the running application: loaded plugins, configuration, routes, and memory usage.
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastpluggy-debug-tools
3
+ Version: 0.1.2
4
+ Summary: Debug Tools plugin for Fastpluggy
5
+ Author: FastPluggy Team
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: FastPluggy>=0.4.0
9
+ Requires-Dist: psutil
10
+ Requires-Dist: packaging
11
+ Provides-Extra: all
12
+ Requires-Dist: pympler; extra == "all"
13
+
14
+ # fastpluggy-debug-tools
15
+
16
+ Debug Tools plugin for FastPluggy — runtime introspection and diagnostics.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install -e .
22
+ ```
23
+
24
+ Optional extras for memory profiling:
25
+
26
+ ```bash
27
+ pip install -e ".[all]"
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Register the plugin in your FastPluggy configuration. Once loaded it provides diagnostic pages for inspecting the running application: loaded plugins, configuration, routes, and memory usage.
@@ -1,4 +1,5 @@
1
1
  MANIFEST.in
2
+ README.md
2
3
  pyproject.toml
3
4
  fastpluggy_debug_tools.egg-info/PKG-INFO
4
5
  fastpluggy_debug_tools.egg-info/SOURCES.txt
@@ -1,4 +1,4 @@
1
- FastPluggy>=0.2.50
1
+ FastPluggy>=0.4.0
2
2
  psutil
3
3
  packaging
4
4
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastpluggy-debug-tools"
3
- version = "0.0.28"
3
+ version = "0.1.2"
4
4
  description = "Debug Tools plugin for Fastpluggy"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -8,7 +8,7 @@ authors = [
8
8
  { name = "FastPluggy Team" }
9
9
  ]
10
10
  dependencies = [
11
- "FastPluggy>=0.2.50",
11
+ "FastPluggy>=0.4.0",
12
12
  "psutil",
13
13
  "packaging",
14
14
  ]
@@ -6,14 +6,16 @@ from fastpluggy.core.module_base import FastPluggyBaseModule
6
6
  from fastpluggy.core.tools.inspect_tools import InjectDependency
7
7
  from fastpluggy.core.tools.install import is_installed
8
8
  from fastpluggy.fastpluggy import FastPluggy
9
+
9
10
  from .config import DebugToolsConfig
11
+ from .widgets.debug.debug_panel import DebugPanelWidget
10
12
 
11
13
 
12
14
  def get_debug_router():
13
15
  from .router import debug_plugin_router
14
16
  from .router.uvicorn import uvicorn_router
15
17
 
16
- return [debug_plugin_router,uvicorn_router]
18
+ return [debug_plugin_router, uvicorn_router]
17
19
 
18
20
 
19
21
  class DebugToolsPlugin(FastPluggyBaseModule):
@@ -35,13 +37,18 @@ class DebugToolsPlugin(FastPluggyBaseModule):
35
37
  if not is_installed('pympler'):
36
38
  plugin.add_warning("pympler is not installed. Debug tools will not be available.")
37
39
 
38
- from .widgets.debug.debug_panel import DebugPanelWidget
39
- GlobalRegistry.extend_globals('list_widget_to_inject', items=[{
40
- 'widget': DebugPanelWidget,
41
- 'position': 0,
42
- 'kwargs': {
43
- 'inject_context': True,
44
- 'debug_config': plugin.settings,
45
- },
46
- 'tag': '#ROOT#'
47
- }])
40
+ from fastpluggy.core.topbar import TopbarAction
41
+
42
+ GlobalRegistry.extend_globals('topbar_actions', items=[
43
+ TopbarAction(
44
+ id='fp-debug-toggle',
45
+ icon='ti ti-bug',
46
+ tooltip='Component Debug Panel',
47
+ position=10,
48
+ modal_widgets=[
49
+ {'widget': DebugPanelWidget},
50
+ ],
51
+ modal_body_class='p-0',
52
+ module_name=self.module_name,
53
+ )
54
+ ])
@@ -15,7 +15,7 @@ from fastpluggy.core.tools.fastapi import _extract_route_metadata
15
15
  from fastpluggy.core.tools.install import is_installed
16
16
  from fastpluggy.core.widgets.render_field_tools import RenderFieldTools
17
17
  from fastpluggy.core.widgets import TableWidget
18
- from fastpluggy.core.widgets.categories.data.debug import DebugView
18
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
19
19
  from fastpluggy.core.widgets.categories.input.button import AutoLinkWidget
20
20
  from fastpluggy.core.widgets.categories.input.button_list import ButtonListWidget
21
21
  from .menu_tools import menu_debug_router
@@ -270,7 +270,7 @@ async def list_session(
270
270
  request,
271
271
  title="List session",
272
272
  widgets=[
273
- DebugView(
273
+ DebugWidget(
274
274
  data=request.session,
275
275
  )
276
276
  ]
@@ -286,7 +286,7 @@ async def list_global_registry(
286
286
  request,
287
287
  title="List global registry",
288
288
  widgets=[
289
- DebugView(
289
+ DebugWidget(
290
290
  data=FastPluggy.get_all_globals(),
291
291
  )
292
292
  ]
@@ -9,7 +9,7 @@ from fastpluggy.core.database import get_db
9
9
  from fastpluggy.core.dependency import get_view_builder
10
10
  from fastpluggy.core.widgets.render_field_tools import RenderFieldTools
11
11
  from fastpluggy.core.widgets import ButtonListWidget, AutoLinkWidget, TableWidget
12
- from fastpluggy.core.widgets.categories.data.debug import DebugView
12
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
13
13
  from fastpluggy.core.widgets.categories.layout.tabbed import TabbedWidget
14
14
 
15
15
  # Set custom /proc path if provided
@@ -59,10 +59,10 @@ async def list_threads(
59
59
  ]
60
60
  ),
61
61
  TabbedWidget(tabs=[
62
- DebugView(data=threads_enum, title="Thread Enum"),
63
- DebugView(data=clean_threads_dict, title="Clean threads dict"),
64
- DebugView(data=process_dict, title="Process"),
65
- DebugView(data=threads_dict, title="Thread"),
62
+ DebugWidget(data=threads_enum, title="Thread Enum"),
63
+ DebugWidget(data=clean_threads_dict, title="Clean threads dict"),
64
+ DebugWidget(data=process_dict, title="Process"),
65
+ DebugWidget(data=threads_dict, title="Thread"),
66
66
  ]),
67
67
  ButtonListWidget(buttons=[
68
68
  AutoLinkWidget(label="Back to Task Dashboard", route_name="list_tools"),
@@ -3,7 +3,7 @@ from fastapi.routing import APIRoute
3
3
  from starlette.requests import Request
4
4
 
5
5
  from fastpluggy.core.dependency import get_view_builder, get_fastpluggy
6
- from fastpluggy.core.widgets.categories.data.debug import DebugView
6
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
7
7
 
8
8
  menu_debug_router = APIRouter()
9
9
 
@@ -17,7 +17,7 @@ async def list_menu(
17
17
  request,
18
18
  title="List menu",
19
19
  widgets=[
20
- DebugView(
20
+ DebugWidget(
21
21
  data=fast_pluggy.menu_manager.menus,
22
22
  )
23
23
  ]
@@ -40,7 +40,7 @@ async def list_menu_entry(
40
40
  request,
41
41
  title="List _menu_entry",
42
42
  widgets=[
43
- DebugView(
43
+ DebugWidget(
44
44
  data=list_entry,
45
45
  )
46
46
  ]
@@ -5,8 +5,8 @@ from fastapi.responses import HTMLResponse
5
5
  from fastpluggy.core.dependency import get_view_builder, get_fastpluggy
6
6
  from fastpluggy.core.plugin.dependency_resolver import PluginDependencyResolver
7
7
  from fastpluggy.core.widgets import TableWidget
8
- from fastpluggy.core.widgets.categories.data.debug import DebugView
9
- from fastpluggy.core.view_builer.components.model import ModelView
8
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
9
+ from fastpluggy.core.widgets.categories.data.model import ModelWidget
10
10
 
11
11
  debug_module_router = APIRouter()
12
12
 
@@ -26,11 +26,11 @@ def list_modules_dependencies(
26
26
  return view_builder.generate(
27
27
  request,
28
28
  widgets=[
29
- ModelView(
29
+ ModelWidget(
30
30
  model=dependency['modules'],
31
31
  title="Modules Dependencies"
32
32
  ),
33
- DebugView(data=dependency)
33
+ DebugWidget(data=dependency)
34
34
  ]
35
35
  )
36
36
 
@@ -4,8 +4,8 @@ from starlette.responses import HTMLResponse
4
4
 
5
5
  from fastpluggy.core.database import get_engine
6
6
  from fastpluggy.core.dependency import get_view_builder
7
- from fastpluggy.core.view_builer.components.model import ModelView
8
- from fastpluggy.core.widgets.categories.data.debug import DebugView
7
+ from fastpluggy.core.widgets.categories.data.model import ModelWidget
8
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
9
9
 
10
10
 
11
11
  # Create a FastAPI router for pool inspection
@@ -50,8 +50,8 @@ def pool_info_html(
50
50
  return view_builder.generate(
51
51
  request,
52
52
  widgets=[
53
- ModelView(model=metrics, title="Connection Pool Metrics"),
54
- DebugView(data={
53
+ ModelWidget(model=metrics, title="Connection Pool Metrics"),
54
+ DebugWidget(data={
55
55
  "raw_pool_connections": len(raw_pool),
56
56
  "raw_pool": raw_pool
57
57
  })
@@ -5,8 +5,8 @@ from starlette.responses import HTMLResponse
5
5
  from ..requirements_tools import get_requirements_files, get_installed_packages, \
6
6
  check_multiple_requirements_files
7
7
  from fastpluggy.core.dependency import get_view_builder, get_fastpluggy
8
- from fastpluggy.core.widgets.categories.data.debug import DebugView
9
- from ..widgets.packages_view import PackagesView
8
+ from fastpluggy.core.widgets.categories.data.debug import DebugWidget
9
+ from ..widgets.packages_view import PackagesWidget
10
10
 
11
11
  requirements_router = APIRouter()
12
12
 
@@ -21,15 +21,15 @@ def list_requirements(
21
21
  installed_packages = get_installed_packages()
22
22
  missing_packages = check_multiple_requirements_files(list_requirements)
23
23
  widgets = [
24
- DebugView(
24
+ DebugWidget(
25
25
  title="Missing Requirements",
26
26
  data=missing_packages,
27
27
  ),
28
- DebugView(
28
+ DebugWidget(
29
29
  title="Requirements Files",
30
30
  data=list_requirements, collapsed=True
31
31
  ),
32
- PackagesView(
32
+ PackagesWidget(
33
33
  packages=installed_packages,
34
34
  title="Installed Packages",
35
35
  collapsed=False
@@ -8,7 +8,7 @@ def websocket_notification_button(request: Request):
8
8
  """
9
9
 
10
10
  try:
11
- url_ws_send_message = request.url_for('send_message', method='json')
11
+ url_ws_send_message = str(request.url_for('send_message')) + "?method=json"
12
12
 
13
13
  content = """
14
14
  fetch('__url_ws_send_message__', {
@@ -16,7 +16,7 @@ def websocket_notification_button(request: Request):
16
16
  headers: {
17
17
  'Content-Type': 'application/json'
18
18
  },
19
- body: JSON.stringify({type: 'message', content: 'test notification'})
19
+ body: JSON.stringify({type: 'notification', content: 'Test notification from debug tools', meta: {}})
20
20
  })
21
21
  .then(response => {
22
22
  if (!response.ok) {
@@ -24,21 +24,21 @@ def websocket_notification_button(request: Request):
24
24
  }
25
25
  return response.json();
26
26
  })
27
- .then(data => console.log(data))
27
+ .then(data => console.log('Notification sent:', data))
28
28
  .catch(error => console.error('Error sending message:', error));
29
29
  """.replace('__url_ws_send_message__', url_ws_send_message)
30
30
 
31
31
  return ButtonWidget(
32
- url= "#", # No direct URL needed since we use JavaScript
33
- label= "Send WebSocket Notification",
34
- css_class= "btn btn-primary",
35
- onclick=content ,
32
+ url="#",
33
+ label="Send WebSocket Notification",
34
+ css_class="btn btn-primary",
35
+ onclick=content,
36
36
  )
37
37
  except Exception as e:
38
38
  error_message = f"Error creating WebSocket notification button: {e}"
39
39
  print(error_message)
40
40
  return ButtonWidget(
41
- url="#", # Dummy URL since the button is disabled
41
+ url="#",
42
42
  label="Send WebSocket Notification (Error)",
43
43
  css_class="btn btn-danger",
44
44
  disabled=True,
@@ -6,6 +6,7 @@ import asyncio
6
6
  import logging
7
7
  import random
8
8
  import time
9
+ from enum import Enum
9
10
  from typing import Optional
10
11
 
11
12
  from fastpluggy_plugin.tasks_worker import TaskWorker
@@ -467,6 +468,33 @@ def task_mixed_operations(
467
468
  return results
468
469
 
469
470
 
471
+ # ============================================================================
472
+ # Simple/Basic Tasks - Test basic functionality
473
+ # ============================================================================
474
+
475
+ class ExampleEnum(Enum):
476
+ VALUE_A = "value_a"
477
+ VALUE_B = "value_b"
478
+ VALUE_C = "value_c"
479
+
480
+
481
+ @TaskWorker.register(
482
+ name="test.simple.enum_param",
483
+ description="Task that takes an Enum as a parameter",
484
+ tags=["test", "simple", "enum"],
485
+ topic="test_simple",
486
+ allow_concurrent=True,
487
+ )
488
+ def task_with_enum_param(example_value: ExampleEnum = ExampleEnum.VALUE_A):
489
+ """Task that takes an Enum as a parameter."""
490
+ log.info(f"Executing task with value: {example_value} (type: {type(example_value)})")
491
+ return {
492
+ "value_name": example_value.name,
493
+ "value_internal": example_value.value,
494
+ "type": str(type(example_value))
495
+ }
496
+
497
+
470
498
  @TaskWorker.register(
471
499
  name="test.simple.success",
472
500
  description="Simple task that always succeeds",
@@ -125,38 +125,9 @@
125
125
  {% endmacro %}
126
126
 
127
127
  {# Main template #}
128
- <div class="card {{ css_class }} border-info mb-4" id="{{ widget.widget_id }}">
129
- {# Custom header with gear icon for settings #}
130
- {% if widget.title and widget.hide_header == False %}
131
- <div class="card-header d-flex justify-content-between align-items-center pt-1 pb-1 {{ widget.title_css_class }}">
132
- <h3 class="card-title">
133
- <i class="{{ widget.title_icon }}"></i>
134
- {{ widget.title }}
135
- </h3>
136
- <div>
137
- <button
138
- class="btn btn-icon m-1"
139
- type="button"
140
- onclick="openDebugPanelSettings('{{ widget.widget_id }}')"
141
- title="Widget Settings"
142
- >
143
- <i class="ti ti-settings"></i>
144
- </button>
145
- <button
146
- class="btn btn-icon m-1"
147
- type="button"
148
- data-bs-toggle="collapse"
149
- data-bs-target="#collapse-{{ widget.widget_id }}"
150
- aria-expanded="{% if not widget.collapsed %}true{% else %}false{% endif %}"
151
- aria-controls="collapse-{{ widget.widget_id }}"
152
- >
153
- <i class="ti ti-chevron-{{ 'down' if widget.collapsed else 'up' }}"></i>
154
- </button>
155
- </div>
156
- </div>
157
- {% endif %}
128
+ <div class="{{ css_class }} mb-4" id="{{ widget.widget_id }}">
158
129
 
159
- <div class="card-body collapse {% if not widget.collapsed %}show{% endif %}" id="collapse-{{ widget.widget_id }}">
130
+ <div class="card-body" id="collapse-{{ widget.widget_id }}">
160
131
  {# Statistics dashboard #}
161
132
  <div class="border-bottom pb-3 mb-3">
162
133
  <h6 class="mb-3">
@@ -247,97 +218,50 @@
247
218
  </div>
248
219
  </div>
249
220
 
250
- {# Settings Modal #}
251
- <div class="modal fade" id="debugPanelSettingsModal-{{ widget.widget_id }}" tabindex="-1" aria-labelledby="debugPanelSettingsModalLabel-{{ widget.widget_id }}" aria-hidden="true">
252
- <div class="modal-dialog">
253
- <div class="modal-content">
254
- <div class="modal-header">
255
- <h5 class="modal-title" id="debugPanelSettingsModalLabel-{{ widget.widget_id }}">
256
- <i class="ti ti-settings me-2"></i>Debug Panel Widget Settings
257
- </h5>
258
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
259
- </div>
260
- <div class="modal-body">
261
- <div class="mb-3">
262
- <div class="form-check form-switch">
263
- <input class="form-check-input" type="checkbox" id="showDebugPanelWidget-{{ widget.widget_id }}" checked>
264
- <label class="form-check-label" for="showDebugPanelWidget-{{ widget.widget_id }}">
265
- Show Debug Panel Widget
266
- </label>
267
- </div>
268
- <small class="text-muted">Disable this to hide the debug panel widget from the interface.</small>
269
- </div>
270
- <div id="settingsMessage-{{ widget.widget_id }}" class="alert d-none" role="alert"></div>
271
- </div>
272
- <div class="modal-footer">
273
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
274
- <button type="button" class="btn btn-primary" onclick="saveDebugPanelSettings('{{ widget.widget_id }}')">Save Changes</button>
275
- </div>
221
+ {# Settings inline panel (collapse) — avoids nested-modal issues with Bootstrap 5 #}
222
+ <div class="collapse border-top" id="debugSettings-{{ widget.widget_id }}">
223
+ <div class="px-3 py-2 d-flex align-items-center gap-3 flex-wrap">
224
+ <div class="form-check form-switch mb-0">
225
+ <input class="form-check-input" type="checkbox" id="showDebugPanelWidget-{{ widget.widget_id }}" checked>
226
+ <label class="form-check-label small" for="showDebugPanelWidget-{{ widget.widget_id }}">
227
+ Show Debug Panel Widget
228
+ </label>
276
229
  </div>
230
+ <button type="button" class="btn btn-sm btn-primary"
231
+ onclick="saveDebugPanelSettings('{{ widget.widget_id }}')">
232
+ Save
233
+ </button>
234
+ <div id="settingsMessage-{{ widget.widget_id }}" class="alert py-1 px-2 mb-0 d-none small" role="alert"></div>
277
235
  </div>
278
236
  </div>
279
237
 
280
- {# Enhanced JavaScript for better interaction #}
238
+ {# JavaScript — guarded against duplicate execution when widget renders multiple times #}
281
239
  <script>
282
- function toggleAllSections(widgetId, expand) {
240
+ window.toggleAllSections = window.toggleAllSections || function(widgetId, expand) {
283
241
  const treeContainer = document.getElementById(`tree-${widgetId}`);
284
242
  if (!treeContainer) return;
285
243
 
286
- // 1) Toggle all <details> inside this widget
287
- const allDetails = treeContainer.querySelectorAll('details');
288
- allDetails.forEach(detailEl => {
244
+ // Toggle all <details> inside this widget
245
+ treeContainer.querySelectorAll('details').forEach(detailEl => {
289
246
  detailEl.open = expand;
290
247
  });
291
248
 
292
- // 2) Toggle any Bootstrap .collapse elements if still in use
293
- const collapseEls = treeContainer.querySelectorAll('.collapse');
294
- collapseEls.forEach(collapseEl => {
295
- const bsCollapse = new bootstrap.Collapse(collapseEl, {toggle: false});
296
- if (expand) {
297
- bsCollapse.show();
298
- } else {
299
- bsCollapse.hide();
300
- }
301
- });
302
-
303
- // 3) Update chevron icons on any expand‐buttons
304
- const headerButtons = treeContainer.querySelectorAll('.expand-btn i');
305
- headerButtons.forEach(icon => {
249
+ // Update chevron icons on any expand-buttons
250
+ treeContainer.querySelectorAll('.expand-btn i').forEach(icon => {
306
251
  icon.className = expand ? 'fas fa-chevron-down' : 'fas fa-chevron-right';
307
252
  });
308
- }
253
+ };
309
254
 
310
- function toggleChildren(widgetId, expand) {
255
+ window.toggleChildren = window.toggleChildren || function(widgetId, expand) {
311
256
  const treeContainer = document.getElementById(`tree-${widgetId}`);
312
257
  if (!treeContainer) return;
313
-
314
- // Only toggle <details> elements with class="children-section"
315
- const childrenDetails = treeContainer.querySelectorAll('details.children-section');
316
- childrenDetails.forEach(detailEl => {
258
+ treeContainer.querySelectorAll('details.children-section').forEach(detailEl => {
317
259
  detailEl.open = expand;
318
260
  });
319
- }
320
-
321
- // Keep chevron icons in sync when a <details> is toggled manually
322
- document.addEventListener('DOMContentLoaded', function () {
323
- document.querySelectorAll('details').forEach(detailEl => {
324
- detailEl.addEventListener('toggle', function () {
325
- // If you want to swap the icon in <summary>, do it here.
326
- // For example:
327
- // let icon = detailEl.querySelector('summary i');
328
- // icon.className = detailEl.open ? 'fas fa-chevron-down' : 'fas fa-chevron-right';
329
- });
330
- });
331
- });
332
-
333
- // Open debug panel settings modal
334
- function openDebugPanelSettings(widgetId) {
335
- const modal = new bootstrap.Modal(document.getElementById(`debugPanelSettingsModal-${widgetId}`));
336
- modal.show();
337
- }
261
+ };
338
262
 
339
263
  // Save debug panel settings
340
- async function saveDebugPanelSettings(widgetId) {
264
+ window.saveDebugPanelSettings = window.saveDebugPanelSettings || async function saveDebugPanelSettings(widgetId) {
341
265
  const checkbox = document.getElementById(`showDebugPanelWidget-${widgetId}`);
342
266
  const messageDiv = document.getElementById(`settingsMessage-${widgetId}`);
343
267
  const showDebugPanel = checkbox.checked;
@@ -374,7 +298,7 @@
374
298
  messageDiv.textContent = `Error: ${error.message}`;
375
299
  messageDiv.classList.remove('d-none');
376
300
  }
377
- }
301
+ };
378
302
  </script>
379
303
 
380
304
  <style>
@@ -50,9 +50,8 @@ class DebugPanelWidget(AbstractWidget):
50
50
 
51
51
  def __init__(
52
52
  self,
53
- items: Annotated[List[AbstractWidget], InjectDependency],
53
+ items: Annotated[List[AbstractWidget], InjectDependency] = None,
54
54
  debug_config: Annotated[Optional[DebugToolsConfig], InjectDependency] = None,
55
- title: str = "Component Debug Panel",
56
55
  max_depth: int = 10,
57
56
  show_attributes: bool = True,
58
57
  show_warnings: bool = True,
@@ -64,21 +63,20 @@ class DebugPanelWidget(AbstractWidget):
64
63
  Initialize the debug panel.
65
64
 
66
65
  Args:
67
- items: List of components to analyze
68
- title: Panel title
66
+ items: List of components to analyze (injected from context when available)
69
67
  max_depth: Maximum tree depth to analyze
70
68
  show_attributes: Whether to show component attributes
71
69
  show_warnings: Whether to show warnings and issues
72
70
  auto_expand: Whether to auto-expand all tree nodes
73
71
  """
74
- kwargs['collapsed'] = True
72
+ kwargs.setdefault('title', 'Component Debug Panel')
73
+ kwargs['collapsed'] = False
75
74
  kwargs['title_css_class'] = 'bg-info text-white'
76
75
  kwargs['title_icon'] = 'fas fa-bug me-2'
77
76
 
78
77
  super().__init__(**kwargs)
79
78
  self.debug_config = debug_config
80
79
  self.items = items or []
81
- self.title = title
82
80
  self.max_depth = max_depth
83
81
  self.show_attributes = show_attributes
84
82
  self.show_warnings = show_warnings
@@ -2,7 +2,7 @@ from typing import Any, Optional, Dict
2
2
  from fastpluggy.core.widgets import AbstractWidget
3
3
 
4
4
 
5
- class PackagesView(AbstractWidget):
5
+ class PackagesWidget(AbstractWidget):
6
6
  """
7
7
  A widget to display installed packages with search and filter capabilities.
8
8
  """
@@ -11,7 +11,7 @@ class PackagesView(AbstractWidget):
11
11
 
12
12
  def __init__(self, packages: Dict[str, Dict[str, Any]], title: Optional[str] = None, **kwargs):
13
13
  """
14
- Initialize the PackagesView widget.
14
+ Initialize the PackagesWidget widget.
15
15
 
16
16
  Args:
17
17
  packages (Dict[str, Dict[str, Any]]): Dictionary of packages with metadata
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastpluggy-debug-tools
3
- Version: 0.0.28
4
- Summary: Debug Tools plugin for Fastpluggy
5
- Author: FastPluggy Team
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: FastPluggy>=0.2.50
9
- Requires-Dist: psutil
10
- Requires-Dist: packaging
11
- Provides-Extra: all
12
- Requires-Dist: pympler; extra == "all"
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastpluggy-debug-tools
3
- Version: 0.0.28
4
- Summary: Debug Tools plugin for Fastpluggy
5
- Author: FastPluggy Team
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: FastPluggy>=0.2.50
9
- Requires-Dist: psutil
10
- Requires-Dist: packaging
11
- Provides-Extra: all
12
- Requires-Dist: pympler; extra == "all"