Files
SmartScanProbeTrack/app/routes/channels.py
2025-07-29 10:51:42 -04:00

28 lines
974 B
Python

from flask import Blueprint, render_template, redirect, url_for, flash, session
from app.models import Channel, Calibration
from app.routes.auth import role_required
channels_bp = Blueprint('channels', __name__)
@channels_bp.route('/<channel_id>')
@role_required('review')
def view_channel(channel_id):
"""View details of a single channel"""
channel = Channel.get_by_id(channel_id)
if not channel:
flash('Channel not found', 'danger')
return redirect(url_for('probes.list_probes'))
# Get calibration history for this channel
calibrations = Calibration.get_by_channel(channel_id)
user = {
'user_name': session.get('user_name'),
'can_calibrate': session.get('can_calibrate'),
'can_review': session.get('can_review')
}
return render_template('channel_view.html',
channel=channel,
calibrations=calibrations,
user=user)