mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
Devide arrays
This commit is contained in:
parent
16a579b9c9
commit
80b7959454
2 changed files with 64 additions and 22 deletions
|
@ -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'))
|
||||
|
|
|
@ -53,6 +53,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
{{super()}}
|
||||
{% endblock %}
|
||||
|
@ -319,8 +320,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</thead>
|
||||
<tbody>
|
||||
{% 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) %}
|
||||
<tr id='{{ rev.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -423,7 +422,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -470,8 +468,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for vod in streams %}
|
||||
{% if (vod.type == 8 or vod.type == 9) %}
|
||||
{% for vod in vods %}
|
||||
<tr id='{{ vod.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -556,7 +553,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -592,8 +588,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for cod in streams %}
|
||||
{% if (cod.type == 10 or cod.type == 11) %}
|
||||
{% for cod in cods %}
|
||||
<tr id='{{ cod.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -696,7 +691,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -723,8 +717,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for proxy in streams %}
|
||||
{% if (proxy.type == 0 or proxy.type == 1) %}
|
||||
{% for proxy in proxies %}
|
||||
<tr id='{{ proxy.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -755,7 +748,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -785,8 +777,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for catchup in streams %}
|
||||
{% if (catchup.type == 6) %}
|
||||
{% for catchup in catchups %}
|
||||
<tr id='{{ catchup.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -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]
|
||||
}}
|
||||
</td>
|
||||
<td>{{ catchup.price }}</td>
|
||||
<td>
|
||||
|
@ -815,9 +807,38 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
onclick="remove_stream('{{ catchup.id }}')">
|
||||
Remove
|
||||
</button>
|
||||
{% if (role == 2) %}
|
||||
<button type="submit"
|
||||
{% if (service.status== service.status.ACTIVE) %}
|
||||
class="btn btn-success btn-xs"
|
||||
{% else %}
|
||||
class="btn btn-success btn-xs" disabled
|
||||
{% endif %}
|
||||
onclick="get_log_stream('{{ catchup.id }}')">
|
||||
Get log
|
||||
</button>
|
||||
<a href="{{ url_for('StreamView:view_log', sid=catchup.id) }}"
|
||||
class="btn btn-info btn-xs"
|
||||
role="button">
|
||||
View log
|
||||
</a>
|
||||
<button type="submit"
|
||||
{% if (service.status== service.status.ACTIVE) %}
|
||||
class="btn btn-success btn-xs"
|
||||
{% else %}
|
||||
class="btn btn-success btn-xs" disabled
|
||||
{% endif %}
|
||||
onclick="get_pipeline_stream('{{ catchup.id }}')">
|
||||
GPL
|
||||
</button>
|
||||
<a href="{{ url_for('StreamView:view_pipeline', sid=catchup.id) }}"
|
||||
class="btn btn-info btn-xs"
|
||||
role="button">
|
||||
VPL
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -850,8 +871,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for event in streams %}
|
||||
{% if (event.type == 12) %}
|
||||
{% for event in events %}
|
||||
<tr id='{{ event.id }}'>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
|
@ -955,7 +975,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1473,5 +1492,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue