ADD: sites and architecture module
This commit is contained in:
@@ -34,6 +34,7 @@ from modules.cloud_backup import (
|
||||
r2_delete_backup, r2_upload_async, get_upload_job,
|
||||
r2_is_configured, R2_BUCKET_NAME,
|
||||
)
|
||||
from modules.sites import get_sites_list, get_site_health, get_architecture, SITES, PLATFORM
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = 'navitrends-secret-key-2025'
|
||||
@@ -114,6 +115,33 @@ def dashboard():
|
||||
page_subtitle=MAIN_SERVER_IP)
|
||||
|
||||
|
||||
@app.route('/sites')
|
||||
@login_required
|
||||
def sites_page():
|
||||
return render_template(
|
||||
'pages/sites.html',
|
||||
main_server=MAIN_SERVER_IP,
|
||||
site_count=len(SITES),
|
||||
platform_domain=PLATFORM['domain'],
|
||||
platform_url=f"{PLATFORM['domain_protocol']}://{PLATFORM['domain']}",
|
||||
active_page='sites',
|
||||
page_title='Application Sites',
|
||||
page_subtitle='direct access · health · deployment info'
|
||||
)
|
||||
|
||||
|
||||
@app.route('/architecture')
|
||||
@login_required
|
||||
def architecture_page():
|
||||
return render_template(
|
||||
'pages/architecture.html',
|
||||
main_server=MAIN_SERVER_IP,
|
||||
active_page='architecture',
|
||||
page_title='Architecture',
|
||||
page_subtitle='stacks · containers · networks'
|
||||
)
|
||||
|
||||
|
||||
@app.route('/containers')
|
||||
@login_required
|
||||
def containers_page():
|
||||
@@ -180,6 +208,8 @@ def settings_page():
|
||||
return render_template(
|
||||
'pages/settings.html',
|
||||
main_server=MAIN_SERVER_IP,
|
||||
platform_domain=PLATFORM['domain'],
|
||||
platform_url=f"{PLATFORM['domain_protocol']}://{PLATFORM['domain']}",
|
||||
system=system,
|
||||
running_on_main=RUNNING_ON_MAIN_SERVER,
|
||||
active_page='settings',
|
||||
@@ -238,6 +268,28 @@ def api_containers_all():
|
||||
return jsonify({'containers': all_ctrs, 'running': running})
|
||||
|
||||
|
||||
@app.route('/api/sites')
|
||||
@login_required
|
||||
def api_sites():
|
||||
include_health = request.args.get('health', '0') == '1'
|
||||
return jsonify({'sites': get_sites_list(include_health=include_health)})
|
||||
|
||||
|
||||
@app.route('/api/sites/<site_id>/health')
|
||||
@login_required
|
||||
def api_site_health(site_id):
|
||||
result = get_site_health(site_id)
|
||||
if result is None:
|
||||
return jsonify({'error': 'Site not found'}), 404
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
@app.route('/api/architecture')
|
||||
@login_required
|
||||
def api_architecture():
|
||||
return jsonify(get_architecture())
|
||||
|
||||
|
||||
@app.route('/api/nav-summary')
|
||||
@login_required
|
||||
def api_nav_summary():
|
||||
|
||||
Reference in New Issue
Block a user