This commit is contained in:
pika 2025-03-31 10:27:46 +02:00
parent 94ededdf69
commit 7dafc3c1e4
4 changed files with 178 additions and 52 deletions

View file

@ -1,22 +1,38 @@
/* Custom styles for the app */ /* Custom styles for the app */
:root { :root {
--background-color: #f5f8fa; /* Light mode (default) variables - Github inspired */
--text-color: #333; --background-color: #f6f8fa;
--card-bg: #fff; --text-color: #24292f;
--border-color: #e3e8ee; --card-bg: #ffffff;
--sidebar-bg: #f0f2f5; --border-color: #d0d7de;
--sidebar-hover-bg: #e0e5ee; --sidebar-bg: #f6f8fa;
--highlight-color: #3b82f6; --sidebar-hover-bg: #eaeef2;
--highlight-color: #0969da;
/* Markdown specific colors for light mode */
--markdown-bg: #ffffff;
--markdown-text: #24292f;
--markdown-code-bg: #f6f8fa;
--markdown-border: #d0d7de;
--markdown-table-header: #f6f8fa;
} }
[data-bs-theme="dark"] { [data-bs-theme="dark"] {
--background-color: #1a2234; /* Dark mode variables - Github dark inspired */
--text-color: #e6e8eb; --background-color: #0d1117;
--card-bg: #24304d; --text-color: #c9d1d9;
--border-color: #374564; --card-bg: #161b22;
--sidebar-bg: #151a27; --border-color: #30363d;
--sidebar-hover-bg: #1c2133; --sidebar-bg: #010409;
--highlight-color: #3f8cff; --sidebar-hover-bg: #161b22;
--highlight-color: #58a6ff;
/* Markdown specific colors for dark mode */
--markdown-bg: #0d1117;
--markdown-text: #c9d1d9;
--markdown-code-bg: #161b22;
--markdown-border: #30363d;
--markdown-table-header: #161b22;
} }
body { body {
@ -28,27 +44,31 @@ body {
.markdown-body { .markdown-body {
padding: 1rem; padding: 1rem;
background-color: var(--card-bg); background-color: var(--markdown-bg);
border: 1px solid var(--border-color); color: var(--markdown-text);
border: 1px solid var(--markdown-border);
border-radius: 4px; border-radius: 4px;
} }
.markdown-body h1 { .markdown-body h1 {
font-size: 1.75rem; font-size: 1.75rem;
margin-top: 0; margin-top: 0;
color: var(--markdown-text);
} }
.markdown-body h2 { .markdown-body h2 {
font-size: 1.5rem; font-size: 1.5rem;
color: var(--markdown-text);
} }
.markdown-body h3 { .markdown-body h3 {
font-size: 1.25rem; font-size: 1.25rem;
color: var(--markdown-text);
} }
.markdown-body pre { .markdown-body pre {
background-color: #f6f8fa; background-color: var(--markdown-code-bg);
border-radius: 3px; border-radius: 6px;
padding: 16px; padding: 16px;
overflow: auto; overflow: auto;
} }
@ -62,11 +82,11 @@ body {
.markdown-body th, .markdown-body th,
.markdown-body td { .markdown-body td {
padding: 8px; padding: 8px;
border: 1px solid #ddd; border: 1px solid var(--markdown-border);
} }
.markdown-body th { .markdown-body th {
background-color: #f8f9fa; background-color: var(--markdown-table-header);
} }
/* IP Grid for subnet visualization */ /* IP Grid for subnet visualization */

View file

@ -319,10 +319,9 @@
.markdown-alert { .markdown-alert {
padding: 0.85rem 1rem; padding: 0.85rem 1rem;
margin: 1rem 0; margin: 1rem 0;
border-radius: 0.375rem; border-radius: 6px;
border-left-width: 4px; border-left-width: 4px;
border-left-style: solid; border-left-style: solid;
color: inherit;
} }
.markdown-alert-title { .markdown-alert-title {
@ -340,15 +339,14 @@
font-weight: normal; font-weight: normal;
} }
/* Individual alert types */ /* Note styling - GitHub colors */
/* Note styling */
.markdown-alert-note { .markdown-alert-note {
background-color: rgba(66, 153, 225, 0.1); background-color: #eef6ff;
border-left-color: #4299e1; border-left-color: #58a6ff;
} }
.markdown-alert-note .markdown-alert-title { .markdown-alert-note .markdown-alert-title {
color: #2b6cb0; color: #0969da;
} }
.markdown-alert-note .markdown-alert-title::before { .markdown-alert-note .markdown-alert-title::before {
@ -356,14 +354,14 @@
/* ti-info-circle */ /* ti-info-circle */
} }
/* Tip styling */ /* Tip styling - GitHub colors */
.markdown-alert-tip { .markdown-alert-tip {
background-color: rgba(72, 187, 120, 0.1); background-color: #dafbe1;
border-left-color: #48bb78; border-left-color: #2da44e;
} }
.markdown-alert-tip .markdown-alert-title { .markdown-alert-tip .markdown-alert-title {
color: #2f855a; color: #1a7f37;
} }
.markdown-alert-tip .markdown-alert-title::before { .markdown-alert-tip .markdown-alert-title::before {
@ -371,14 +369,14 @@
/* ti-bulb */ /* ti-bulb */
} }
/* Important styling */ /* Important styling - GitHub colors */
.markdown-alert-important { .markdown-alert-important {
background-color: rgba(118, 106, 240, 0.1); background-color: #fff8c5;
border-left-color: #766af0; border-left-color: #bf8700;
} }
.markdown-alert-important .markdown-alert-title { .markdown-alert-important .markdown-alert-title {
color: #5046e4; color: #9a6700;
} }
.markdown-alert-important .markdown-alert-title::before { .markdown-alert-important .markdown-alert-title::before {
@ -386,14 +384,14 @@
/* ti-star */ /* ti-star */
} }
/* Warning styling */ /* Warning styling - GitHub colors */
.markdown-alert-warning { .markdown-alert-warning {
background-color: rgba(246, 173, 85, 0.1); background-color: #fff8c5;
border-left-color: #f6ad55; border-left-color: #bf8700;
} }
.markdown-alert-warning .markdown-alert-title { .markdown-alert-warning .markdown-alert-title {
color: #c05621; color: #9a6700;
} }
.markdown-alert-warning .markdown-alert-title::before { .markdown-alert-warning .markdown-alert-title::before {
@ -401,14 +399,14 @@
/* ti-alert-triangle */ /* ti-alert-triangle */
} }
/* Caution styling */ /* Caution styling - GitHub colors */
.markdown-alert-caution { .markdown-alert-caution {
background-color: rgba(245, 101, 101, 0.1); background-color: #ffebe9;
border-left-color: #f56565; border-left-color: #cf222e;
} }
.markdown-alert-caution .markdown-alert-title { .markdown-alert-caution .markdown-alert-title {
color: #c53030; color: #cf222e;
} }
.markdown-alert-caution .markdown-alert-title::before { .markdown-alert-caution .markdown-alert-title::before {
@ -416,25 +414,50 @@
/* ti-alert-octagon */ /* ti-alert-octagon */
} }
/* Dark mode adjustments */ /* Dark mode adjustments using GitHub Dark colors */
[data-bs-theme="dark"] .markdown-alert-note { [data-bs-theme="dark"] .markdown-alert-note {
background-color: rgba(56, 127, 187, 0.15); background-color: rgba(56, 139, 253, 0.15);
border-left-color: #58a6ff;
}
[data-bs-theme="dark"] .markdown-alert-note .markdown-alert-title {
color: #58a6ff;
} }
[data-bs-theme="dark"] .markdown-alert-tip { [data-bs-theme="dark"] .markdown-alert-tip {
background-color: rgba(56, 161, 105, 0.15); background-color: rgba(46, 160, 67, 0.15);
border-left-color: #3fb950;
}
[data-bs-theme="dark"] .markdown-alert-tip .markdown-alert-title {
color: #3fb950;
} }
[data-bs-theme="dark"] .markdown-alert-important { [data-bs-theme="dark"] .markdown-alert-important {
background-color: rgba(102, 92, 209, 0.15); background-color: rgba(219, 171, 9, 0.15);
border-left-color: #d29922;
}
[data-bs-theme="dark"] .markdown-alert-important .markdown-alert-title {
color: #d29922;
} }
[data-bs-theme="dark"] .markdown-alert-warning { [data-bs-theme="dark"] .markdown-alert-warning {
background-color: rgba(221, 155, 76, 0.15); background-color: rgba(219, 171, 9, 0.15);
border-left-color: #d29922;
}
[data-bs-theme="dark"] .markdown-alert-warning .markdown-alert-title {
color: #d29922;
} }
[data-bs-theme="dark"] .markdown-alert-caution { [data-bs-theme="dark"] .markdown-alert-caution {
background-color: rgba(224, 92, 92, 0.15); background-color: rgba(248, 81, 73, 0.15);
border-left-color: #f85149;
}
[data-bs-theme="dark"] .markdown-alert-caution .markdown-alert-title {
color: #f85149;
} }
/* Fix content inside alerts */ /* Fix content inside alerts */
@ -448,14 +471,14 @@
/* Ensure proper spacing for code in alerts */ /* Ensure proper spacing for code in alerts */
.markdown-alert code { .markdown-alert code {
background-color: rgba(0, 0, 0, 0.07); background-color: rgba(27, 31, 35, 0.05);
border-radius: 3px; border-radius: 3px;
padding: 0.2em 0.4em; padding: 0.2em 0.4em;
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
} }
[data-bs-theme="dark"] .markdown-alert code { [data-bs-theme="dark"] .markdown-alert code {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(240, 246, 252, 0.15);
} }
/* Fix port display in accordion headers */ /* Fix port display in accordion headers */
@ -468,4 +491,11 @@
/* Add compatibility classes for GitHub markdown */ /* Add compatibility classes for GitHub markdown */
.markdown-content .markdown-reading-view { .markdown-content .markdown-reading-view {
width: 100%; width: 100%;
color: var(--markdown-text);
background-color: var(--markdown-bg);
}
[data-bs-theme="dark"] .markdown-content .markdown-reading-view {
color: var(--markdown-text);
background-color: var(--markdown-bg);
} }

View file

@ -412,5 +412,27 @@
.card-body .markdown-content { .card-body .markdown-content {
padding: 0; padding: 0;
} }
/* Ensure consistent coloring across application and server markdown views */
.accordion-body {
background-color: var(--card-bg);
border-top: 1px solid var(--border-color);
}
.documentation-wrapper .markdown-content {
color: var(--markdown-text);
}
/* Make accordion headers match the theme better */
.accordion-button.collapsed {
background-color: var(--card-bg);
color: var(--text-color);
}
/* Port badges styling */
.accordion-button .badge {
background-color: var(--highlight-color);
color: white;
}
</style> </style>
{% endblock %} {% endblock %}

View file

@ -62,3 +62,57 @@
}); });
}); });
</script> </script>
<!-- Find where application documentation is displayed -->
<div class="card mt-3">
<div class="card-header">
<h3 class="card-title">Applications in this Subnet</h3>
</div>
<div class="card-body p-0">
{% for app in subnet.applications %}
<div class="app-card mb-3">
<div class="app-card-header d-flex justify-content-between align-items-center p-3">
<span class="app-link">
<strong>{{ app.name }}</strong>
{% if app.server %}
<span class="text-muted fs-sm">on {{ app.server.hostname }} ({{ app.server.ip_address }})</span>
{% endif %}
</span>
<a href="{{ url_for('dashboard.app_view', app_id=app.id) }}" class="btn btn-sm btn-primary">View</a>
</div>
{% if app.documentation %}
<div class="app-card-body p-3">
<div class="markdown-content">
{{ app.documentation|markdown|safe }}
</div>
</div>
{% else %}
<div class="app-card-body p-3 text-muted">
No documentation available for this application.
</div>
{% endif %}
<div class="app-card-footer p-2">
<div class="d-flex justify-content-between align-items-center">
<div class="usage-info">
<small class="text-muted">Usage</small>
<div class="progress" style="width: 100px; height: 6px;">
<div class="progress-bar bg-primary" style="width: {{ app.host_usage if app.host_usage else 0 }}%"></div>
</div>
</div>
<div class="port-info">
{% if app.ports %}
<small class="text-muted">{{ app.ports|length }} ports</small>
{% else %}
<small class="text-muted">No ports</small>
{% endif %}
</div>
</div>
</div>
</div>
{% else %}
<div class="p-3 text-muted">
No applications found in this subnet.
</div>
{% endfor %}
</div>
</div>