Repository navigation
Expand file tree
/
Copy pathtemplates.html
More file actions
342 lines (322 loc) · 16.7 KB
/
Copy pathtemplates.html
File metadata and controls
342 lines (322 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Templates, Header Injection & HTMX — ProjectCompass Docs</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="assets/docs.css">
</head>
<body>
<header class="top-nav">
<div class="top-nav-inner">
<a href="../index.html" class="brand-link">
<svg class="compass-mini" viewBox="0 0 36 36" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="18" r="15.5" stroke="currentColor" stroke-width="1.6" stroke-dasharray="3 2" opacity="0.6"/>
<circle cx="18" cy="18" r="13" stroke="currentColor" stroke-width="1.5"/>
<path d="M18 7 L18 24" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
<path d="M18 8 L26 22 L18 22 Z" fill="currentColor" fill-opacity="0.32" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/>
<path d="M16.5 10.5 L11 22 L16.5 22 Z" fill="#fbbf24" fill-opacity="0.45" stroke="#fbbf24" stroke-width="1.2" stroke-linejoin="round"/>
<path d="M10 24.5 L26 24.5 L23.5 27.5 L12.5 27.5 Z" fill="currentColor" fill-opacity="0.5" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>
</svg>
<span>ProjectCompass</span>
<span class="brand-tag">⛵ Regatta Docs</span>
</a>
<div class="nav-actions">
<button type="button" id="theme-toggle" class="theme-toggle-btn">
<span aria-hidden="true">⛵</span> <span>Day Sail</span>
</button>
<button type="button" class="nav-toggle" id="nav-toggle" aria-label="Toggle navigation">
<svg class="icon-menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
<svg class="icon-close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="6" x2="18" y2="18"/><line x1="6" y1="18" x2="18" y2="6"/></svg>
<span class="nav-toggle-label-open">Menu</span>
<span class="nav-toggle-label-close">Close</span>
</button>
</div>
</div>
</header>
<nav class="nav-links" id="nav-links" aria-label="Primary Documentation Navigation">
<span class="nav-group-label">Getting Started</span>
<a href="../index.html">Hub</a>
<a href="overview.html">Overview</a>
<a href="user_guide.html">User Guide</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Architecture</span>
<a href="architecture.html">Architecture</a>
<a href="core_classes.html">Core Classes</a>
<a href="templates.html" class="active">Templates</a>
<a href="routes.html">API & CLI</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Infrastructure</span>
<a href="k0s_setup.html">k0s Setup</a>
<a href="kubernetes_console.html">K8s Console</a>
<a href="worker_library.html">Worker Library</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Operations</span>
<a href="configuration.html">Config</a>
<a href="docker.html">Docker</a>
<a href="demo/index.html" class="nav-demo">🚀 Demo</a>
</nav>
<div class="nav-overlay" id="nav-overlay"></div><section class="page-header">
<div class="page-header-inner">
<div class="breadcrumb">
<a href="../index.html">⛵ Command Deck</a>
<span>/</span>
<span>Pillar II: Shipwright's Hull & Rigging</span>
<span>/</span>
<span>Templates, Header Injection & HTMX</span>
</div>
<h1>Frontend Architecture, Templates & HTMX 2.0</h1>
<p class="lead">
How ProjectCompass trims its Web UI canvas: the <code>header.html</code> partial-injection system, global <code>PublicAppSettings</code> context, HTMX 2.0 partial swaps, and the complete reference for all 40+ Jinja2 templates.
</p>
<div class="page-meta-badges">
<span class="badge badge-purple">05 • Sailcloth & Canvas</span>
<span class="badge badge-cyan">Jinja2 + HTMX 2.0</span>
<span class="badge badge-emerald">Zero-Build Assets</span>
</div>
</div>
</section>
<div class="docs-layout">
<main class="docs-content">
<h2 id="header-injection-system">1. The <code>header.html</code> Partial Injection System</h2>
<p>
Rather than relying on deep Jinja2 <code>{% extends %}</code> chains, ProjectCompass uses a fast, deterministic partial-injection mechanism managed by <code>HTMLUtils</code> (`utils/html_utils.py`).
At startup, <code>templates/header.html</code> is parsed via HTML comment markers into three reusable layout segments stored in <code>self.html_parts</code>:
</p>
<pre><code class="language-html"><!-- start head -->
<!-- Global CSS, W3.CSS, HTMX 2.0, Chart.js, theme variables -->
<!-- end head -->
<!-- start top_container -->
<!-- Top navigation bar, demo notice banner, user profile & theme controls -->
<!-- end top_container -->
<!-- start sidebar_menu -->
<!-- Collapsible left navigation drawer respecting FeatureGate toggles -->
<!-- end sidebar_menu --></code></pre>
<p>
Before rendering a view, route handlers call <code>webapp.substitute_html(port=..., project_folder=...)</code> and pass the resulting dictionary into <code>render_template(...)</code>. Every full-page template includes them at the top of the document:
</p>
<pre><code class="language-html">{{ head|safe }}
{{ top_container|safe }}
{{ sidebar_menu|safe }}</code></pre>
<h2 id="global-template-context">2. Global Context Variables & <code>pc</code> Settings</h2>
<p>
In addition to the injected layout strings, <code>app.py</code> registers a Flask context processor (<code>inject_pc_settings</code>) that exposes <code>pc</code> (<code>PublicAppSettings</code>) to every template automatically.
</p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Variable</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>head</code>, <code>top_container</code>, <code>sidebar_menu</code></td>
<td><code>str</code> (HTML)</td>
<td>Rendered layout partials produced by <code>webapp.substitute_html()</code>.</td>
</tr>
<tr>
<td><code>pc</code></td>
<td><code>PublicAppSettings</code></td>
<td>Validated presentation settings from <code>projectcompass.yaml</code>: <code>pc.branding</code> (app name, tagline, logo), <code>pc.theme</code> (accent color, font, dark mode), <code>pc.features</code> (module visibility booleans), <code>pc.notice</code>, and <code>pc.footer</code>.</td>
</tr>
<tr>
<td><code>title</code></td>
<td><code>str</code></td>
<td>Application title loaded from <code>templates/environment_variables/title.txt</code> or overridden by <code>pc.branding.app_name</code>.</td>
</tr>
<tr>
<td><code>links</code></td>
<td><code>dict</code></td>
<td>Sidebar external/useful links loaded from <code>templates/environment_variables/links.yaml</code>.</td>
</tr>
<tr>
<td><code>tool_choices</code></td>
<td><code>dict</code></td>
<td>Dropdown options for products, countries, and output types from <code>tool_choices.yaml</code>.</td>
</tr>
</tbody>
</table>
</div>
<h2 id="template-catalog">3. Complete Jinja2 Template Inventory</h2>
<h3 id="workspace-and-catalog-templates">3.1 Workspace, Catalog & Pipelines</h3>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Template File</th>
<th>Route(s)</th>
<th>Purpose & Key Variables</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>landing.html</code> & <code>index.html</code></td>
<td><code>GET /</code></td>
<td>Main dashboard displaying KPI counters (<code>number_of_analysis</code>, <code>number_of_owners</code>, <code>number_of_structured_analysis</code>, <code>number_of_products</code>) and Chart.js polar/bar breakdowns.</td>
</tr>
<tr>
<td><code>overview.html</code></td>
<td><code>GET /overview/</code></td>
<td>In-app platform overview and quick-navigation launchpad.</td>
</tr>
<tr>
<td><code>analysis.html</code></td>
<td><code>GET /analysis/</code></td>
<td>Full catalog view with instant client-side + FTS5 filtering, favorites toggle, star ratings, comments modal, RAG index status badges, and ⚡ Flow badges with "Edit Code" buttons for analyses that have <code>compass_flow.yaml</code> + <code>Dockerfile</code>.</td>
</tr>
<tr>
<td><code>create_analysis.html</code></td>
<td><code>GET /create_analysis/</code></td>
<td>Unified create/edit form (`new_analysis=True|False`) for uploading HTML, `.ipynb`, or `.py` structured analyses.</td>
</tr>
<tr>
<td><code>import.html</code></td>
<td><code>GET /import/</code></td>
<td>Bulk archive/folder import interface for existing analyses and notebooks.</td>
</tr>
<tr>
<td><code>pipeline_builder.html</code> & <code>pipeline_versions.html</code></td>
<td><code>GET /pipeline_builder/</code>, <code>GET /pipeline_versions/<name></code></td>
<td>Interactive visual studio for wiring <code>scomp-link</code> pipeline blocks, previewing generated Python code, and restoring versioned snapshots.</td>
</tr>
<tr>
<td><code>investigations.html</code></td>
<td><code>GET /investigations/</code></td>
<td>Dynamic parameter input form generated from <code>compass_flow.yaml</code> to execute flows.</td>
</tr>
<tr>
<td><code>versions_single_analysis.html</code>, <code>outputs.html</code>, <code>iframetemplate.html</code></td>
<td><code>GET /versions_single_analysis/</code>, <code>GET /outputs/</code>, <code>GET /iframetemplate/</code></td>
<td>Version manager for physical outputs and dashboard links, plus the iframe/HTML report viewer.</td>
</tr>
<tr>
<td><code>executions.html</code> & <code>schedules.html</code></td>
<td><code>GET /executions/</code>, <code>GET /schedules/</code></td>
<td>Unified execution history console with SSE live log modal and APScheduler cron job manager.</td>
</tr>
</tbody>
</table>
</div>
<h3 id="data-and-ai-templates">3.2 Data Explorer, Connections & AI Chat</h3>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Template File</th>
<th>Route(s)</th>
<th>Purpose & Key Variables</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>query_results.html</code></td>
<td><code>GET|POST /query_results/</code></td>
<td>SQL workbench with connection selector (Local DuckDB vs remote ConnectorX), syntax-highlighted editor, tabular results, CSV export, and RAWGraphs push button.</td>
</tr>
<tr>
<td><code>data_upload.html</code> & <code>data_list.html</code></td>
<td><code>GET /data_upload/</code>, <code>GET /data_list/</code></td>
<td>Delimiter-aware CSV/TSV file uploader and catalog of datasets in <code>Saved_data/</code>.</td>
</tr>
<tr>
<td><code>RAWGraphs.html</code></td>
<td><code>GET|POST /graph_analysis/</code></td>
<td>Embedded RAWGraphs visual studio pre-populated with `input_data` CSV payload from SQL queries.</td>
</tr>
<tr>
<td><code>connections_list.html</code> & <code>connection_form.html</code></td>
<td><code>GET /connections</code>, <code>GET /connections/new</code></td>
<td>Management UI for saved ConnectorX database connections, displaying dialect badges, managed lock icons, and live connection test results.</td>
</tr>
<tr>
<td><code>chat.html</code> & <code>chat_analysis.html</code></td>
<td><code>GET /chat</code>, <code>GET /chat/<name></code></td>
<td>Sandboxed dataset Q&A interface (`chat.html`) and per-analysis hybrid RAG assistant with source citations (`chat_analysis.html`).</td>
</tr>
</tbody>
</table>
</div>
<h3 id="k8s-and-admin-templates">3.3 Kubernetes Console, Admin & HTMX Partials</h3>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Template File</th>
<th>Route(s) / Usage</th>
<th>Purpose & Key Variables</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>workers.html</code></td>
<td><code>GET /workers</code></td>
<td>k0s cluster node console showing `Ready` / `NotReady` / `Removed` status, CPU/Memory capacity, join-token generator, and drain/remove actions.</td>
</tr>
<tr>
<td><code>flows.html</code>, <code>run_detail.html</code></td>
<td><code>GET /flows/<name></code> (from catalog), <code>GET /runs/<id>/view</code></td>
<td>Flow editor (code, image, resources, secrets, node selector) accessed from catalog links, and live Pod log viewer. <code>GET /flows</code> redirects to the catalog.</td>
</tr>
<tr>
<td><code>login_page.html</code> & <code>setup_wizard.html</code></td>
<td><code>GET /login</code>, <code>GET /setup</code></td>
<td>Authentication sign-in screen and first-boot administrator initialization wizard.</td>
</tr>
<tr>
<td><code>settings.html</code>, <code>admin_users.html</code>, <code>admin_metrics.html</code></td>
<td><code>GET /settings/</code>, <code>GET /admin/users</code>, <code>GET /admin/metrics</code></td>
<td>Workspace configuration inspector, RBAC user/token administration, and platform telemetry charts.</td>
</tr>
<tr>
<td><code>components/workers_table.html</code>, <code>components/empty_state.html</code>, <code>components/branding_footer*.html</code></td>
<td>Included / HTMX partial swap targets</td>
<td>Reusable Jinja2 + HTMX 2.0 components for live worker table refreshes (`hx-get="/workers"`), standardized empty states, and configurable footers.</td>
</tr>
</tbody>
</table>
</div>
<div class="page-pager">
<a href="core_classes.html" class="pager-link">
<span class="pager-label">← Previous</span>
<span class="pager-title">Core Classes & Cooperative MRO</span>
</a>
<a href="k0s_setup.html" class="pager-link" style="text-align: right;">
<span class="pager-label">Next →</span>
<span class="pager-title">k0s Master & Worker Setup</span>
</a>
</div>
</main>
<aside class="docs-toc" aria-label="On this page">
<div class="docs-toc-title">🧭 On This Page</div>
<ul id="toc-list"></ul>
</aside>
</div>
<footer class="site-footer">
<div class="site-footer-inner">
<div>
<strong>ProjectCompass</strong> — <em>Organization Is Everything®</em> • By
<a href="https://giacomosaccaggi.github.io/" target="_blank" rel="noopener">Giacomo Saccaggi</a>
</div>
<div class="footer-links">
<a href="../index.html">Hub</a>
<a href="architecture.html">Architecture</a>
<a href="core_classes.html">Core Classes</a>
<a href="k0s_setup.html">k0s Setup</a>
<a href="worker_library.html">Worker Library</a>
<a href="routes.html">API & CLI</a>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-markup.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script src="assets/docs.js"></script>
</body>
</html>