|
266 | 266 | .content-table tbody tr:hover { |
267 | 267 | background-color: #f7f6f3; |
268 | 268 | } |
| 269 | + .template-header { |
| 270 | + position: relative; |
| 271 | + cursor: help; |
| 272 | + } |
| 273 | + .template-header .tooltip-text { |
| 274 | + visibility: hidden; |
| 275 | + background-color: #37352f; |
| 276 | + color: #fff; |
| 277 | + text-align: center; |
| 278 | + border-radius: 6px; |
| 279 | + padding: 8px 12px; |
| 280 | + position: absolute; |
| 281 | + z-index: 1; |
| 282 | + bottom: 125%; |
| 283 | + left: 50%; |
| 284 | + transform: translateX(-50%); |
| 285 | + white-space: nowrap; |
| 286 | + font-size: 12px; |
| 287 | + font-weight: 400; |
| 288 | + opacity: 0; |
| 289 | + transition: opacity 0.2s; |
| 290 | + } |
| 291 | + .template-header .tooltip-text::after { |
| 292 | + content: ""; |
| 293 | + position: absolute; |
| 294 | + top: 100%; |
| 295 | + left: 50%; |
| 296 | + margin-left: -5px; |
| 297 | + border-width: 5px; |
| 298 | + border-style: solid; |
| 299 | + border-color: #37352f transparent transparent transparent; |
| 300 | + } |
| 301 | + .template-header:hover .tooltip-text { |
| 302 | + visibility: visible; |
| 303 | + opacity: 1; |
| 304 | + } |
269 | 305 | """ |
270 | 306 |
|
271 | 307 | def fetch_all_prometheus_metrics(url: str) -> Dict[str, List[Tuple[Dict[str, str], float]]]: |
@@ -347,14 +383,28 @@ def get_oauth_association_metrics(metrics: Dict) -> Dict: |
347 | 383 |
|
348 | 384 | if template not in matrix: |
349 | 385 | matrix[template] = {} |
350 | | - matrix[template][auth_type] = int(value) |
| 386 | + matrix[template][auth_type] = int(value) |
351 | 387 |
|
352 | 388 | return { |
353 | 389 | 'matrix': matrix, |
354 | 390 | 'templates': sorted(templates), |
355 | 391 | 'auth_types': sorted(auth_types) |
356 | 392 | } |
357 | 393 |
|
| 394 | +def get_integration_count_by_template(metrics: Dict) -> Dict[str, int]: |
| 395 | + """Sum integration_count by template.""" |
| 396 | + integration_count = metrics.get('integrations_count', []) |
| 397 | + result = {} |
| 398 | + |
| 399 | + for labels, value in integration_count: |
| 400 | + template = labels.get('integration_template') |
| 401 | + if template: |
| 402 | + if template not in result: |
| 403 | + result[template] = 0 |
| 404 | + result[template] += int(value) |
| 405 | + |
| 406 | + return result |
| 407 | + |
358 | 408 | def get_system_info(client): |
359 | 409 | response = client.get("server_settings") |
360 | 410 | settings = response.json() |
@@ -534,7 +584,7 @@ def get_server_base_url() -> str: |
534 | 584 | class_="section-grid-4" |
535 | 585 | ), |
536 | 586 | ui.div( |
537 | | - ui.div("Content items with OAuth integration stats", class_="card-title"), |
| 587 | + ui.div("Content items with OAuth integrations", class_="card-title"), |
538 | 588 | ui.output_ui("oauth_association_metrics_table"), |
539 | 589 | class_="content-card" |
540 | 590 | ), |
@@ -700,10 +750,21 @@ def oauth_association_metrics_table(): |
700 | 750 | matrix = associations_data['matrix'] |
701 | 751 | templates = associations_data['templates'] |
702 | 752 | auth_types = associations_data['auth_types'] |
| 753 | + integration_counts = get_integration_count_by_template(metrics) |
| 754 | + |
| 755 | + def create_template_header(template): |
| 756 | + count = integration_counts.get(template, 0) |
| 757 | + return ui.tags.th( |
| 758 | + ui.span( |
| 759 | + template, |
| 760 | + ui.span(f"Unique Integrations: {count}", class_="tooltip-text"), |
| 761 | + class_="template-header" |
| 762 | + ) |
| 763 | + ) |
703 | 764 |
|
704 | 765 | header_row = ui.tags.tr( |
705 | 766 | ui.tags.th(""), |
706 | | - *[ui.tags.th(template) for template in templates], |
| 767 | + *[create_template_header(template) for template in templates], |
707 | 768 | ui.tags.th("Total") |
708 | 769 | ) |
709 | 770 |
|
|
0 commit comments