wip
This commit is contained in:
parent
097b3dbf09
commit
539d6a6416
6 changed files with 61 additions and 10 deletions
|
@ -1,8 +1,16 @@
|
|||
import ipaddress
|
||||
import markdown as md_package
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('filters', __name__)
|
||||
|
||||
@bp.app_template_filter('markdown')
|
||||
def markdown_filter(text):
|
||||
"""Convert markdown text to HTML"""
|
||||
if text:
|
||||
return md_package.markdown(text, extensions=['tables', 'fenced_code'])
|
||||
return ""
|
||||
|
||||
@bp.app_template_filter('ip_network')
|
||||
def ip_network_filter(cidr):
|
||||
"""Convert a CIDR string to an IP network object"""
|
||||
|
@ -19,14 +27,6 @@ def ip_address_filter(ip):
|
|||
except ValueError:
|
||||
return None
|
||||
|
||||
@bp.app_template_filter('markdown')
|
||||
def markdown_filter(text):
|
||||
"""Convert markdown text to HTML"""
|
||||
import markdown
|
||||
if text:
|
||||
return markdown.markdown(text, extensions=['tables', 'fenced_code'])
|
||||
return ""
|
||||
|
||||
@bp.app_template_global('get_ip_network')
|
||||
def get_ip_network(cidr):
|
||||
"""Global function to get an IP network object from CIDR"""
|
||||
|
|
Binary file not shown.
|
@ -59,7 +59,6 @@ def server_view(server_id):
|
|||
title=f'Server - {server.hostname}',
|
||||
server=server,
|
||||
apps=apps,
|
||||
markdown=markdown.markdown,
|
||||
now=datetime.now()
|
||||
)
|
||||
|
||||
|
@ -263,7 +262,6 @@ def app_view(app_id):
|
|||
title=f'Application - {app.name}',
|
||||
app=app,
|
||||
server=server,
|
||||
markdown=markdown.markdown,
|
||||
now=datetime.now()
|
||||
)
|
||||
|
||||
|
|
26
app/templates/dashboard/app_view.html
Normal file
26
app/templates/dashboard/app_view.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!-- Documentation section -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Documentation</h3>
|
||||
</div>
|
||||
<div class="card-body markdown-content">
|
||||
{% if app.documentation %}
|
||||
{{ app.documentation|markdown|safe }}
|
||||
{% else %}
|
||||
<div class="empty">
|
||||
<div class="empty-icon">
|
||||
<span class="ti ti-file-text"></span>
|
||||
</div>
|
||||
<p class="empty-title">No documentation available</p>
|
||||
<p class="empty-subtitle text-muted">
|
||||
Add documentation to this application to keep track of important information.
|
||||
</p>
|
||||
<div class="empty-action">
|
||||
<a href="{{ url_for('dashboard.app_edit', app_id=app.id) }}" class="btn btn-primary">
|
||||
<span class="ti ti-edit me-2"></span> Add Documentation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
|
@ -204,6 +204,33 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Documentation section -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Documentation</h3>
|
||||
</div>
|
||||
<div class="card-body markdown-content">
|
||||
{% if server.documentation %}
|
||||
{{ server.documentation|markdown|safe }}
|
||||
{% else %}
|
||||
<div class="empty">
|
||||
<div class="empty-icon">
|
||||
<span class="ti ti-file-text"></span>
|
||||
</div>
|
||||
<p class="empty-title">No documentation available</p>
|
||||
<p class="empty-subtitle text-muted">
|
||||
Add documentation to this server to keep track of important information.
|
||||
</p>
|
||||
<div class="empty-action">
|
||||
<a href="{{ url_for('dashboard.server_edit', server_id=server.id) }}" class="btn btn-primary">
|
||||
<span class="ti ti-edit me-2"></span> Add Documentation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue