diff --git a/app/provider/view.py b/app/provider/view.py index 860987d..453d362 100644 --- a/app/provider/view.py +++ b/app/provider/view.py @@ -3,6 +3,7 @@ from flask import render_template, redirect, url_for from flask_login import login_required, current_user from pyfastocloud_models.service.entry import ServiceSettings +import pyfastocloud_models.constants as constants # routes @@ -14,11 +15,32 @@ class ProviderView(FlaskView): server = current_user.get_current_server() if server: streams = server.get_streams() - front_streams = [] + streams_relay_encoder_timeshifts = [] + vods = [] + cods = [] + proxy = [] + catchups = [] + events = [] for stream in streams: - front_streams.append(stream.to_dict()) + front = stream.to_dict() + type = stream.get_type() + if type == constants.StreamType.PROXY: + proxy.append(front) + elif type == constants.StreamType.VOD_PROXY or type == constants.StreamType.VOD_RELAY or \ + type == constants.StreamType.VOD_ENCODE: + vods.append(front) + elif type == constants.StreamType.COD_RELAY or type == constants.StreamType.COD_ENCODE: + cods.append(front) + elif type == constants.StreamType.CATCHUP: + catchups.append(front) + elif type == constants.StreamType.EVENT: + events.append(front) + else: + streams_relay_encoder_timeshifts.append(front) + role = server.get_user_role_by_id(current_user.id) - return render_template('provider/dashboard.html', streams=front_streams, service=server, + return render_template('provider/dashboard.html', streams=streams_relay_encoder_timeshifts, vods=vods, + cods=cods, proxies=proxy, catchups=catchups, events=events, service=server, servers=current_user.servers, role=role) return redirect(url_for('ProviderView:settings')) diff --git a/app/templates/provider/dashboard.html b/app/templates/provider/dashboard.html index 89e0bc1..5240eb3 100644 --- a/app/templates/provider/dashboard.html +++ b/app/templates/provider/dashboard.html @@ -53,6 +53,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} + {{super()}} {% endblock %} @@ -319,8 +320,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} {% for rev in streams %} - {% if (rev.type != 6 and rev.type != 8 and rev.type != 9 and rev.type != 10 and rev.type != 11 and - rev.type != 0 and rev.type != 1) %} {{ loop.index }} @@ -423,7 +422,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} {% endif %} - {% endif %} {% endfor %} @@ -470,8 +468,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% for vod in streams %} - {% if (vod.type == 8 or vod.type == 9) %} + {% for vod in vods %} {{ loop.index }} @@ -556,7 +553,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% endif %} {% endfor %} @@ -592,8 +588,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% for cod in streams %} - {% if (cod.type == 10 or cod.type == 11) %} + {% for cod in cods %} {{ loop.index }} @@ -696,7 +691,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} {% endif %} - {% endif %} {% endfor %} @@ -723,8 +717,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% for proxy in streams %} - {% if (proxy.type == 0 or proxy.type == 1) %} + {% for proxy in proxies %} {{ loop.index }} @@ -755,7 +748,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% endif %} {% endfor %} @@ -785,8 +777,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% for catchup in streams %} - {% if (catchup.type == 6) %} + {% for catchup in catchups %} {{ loop.index }} @@ -798,7 +789,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} 'TIMESHIFT_RECORDER', 'CATCHUP', 'TEST_LIFE', - 'VOD_RELAY', 'VOD_ENCODE','COD_RELAY', 'COD_ENCODE', 'EVENT'][catchup.type] }} + 'VOD_RELAY', 'VOD_ENCODE','COD_RELAY', 'COD_ENCODE', 'EVENT'][catchup.type] + }} {{ catchup.price }} @@ -815,9 +807,38 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} onclick="remove_stream('{{ catchup.id }}')"> Remove + {% if (role == 2) %} + + + View log + + + + VPL + + {% endif %} - {% endif %} {% endfor %} @@ -850,8 +871,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} - {% for event in streams %} - {% if (event.type == 12) %} + {% for event in events %} {{ loop.index }} @@ -955,7 +975,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} {% endif %} - {% endif %} {% endfor %} @@ -1473,5 +1492,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }} } + {% endblock %}