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 flask_login import login_required, current_user
|
||||||
|
|
||||||
from pyfastocloud_models.service.entry import ServiceSettings
|
from pyfastocloud_models.service.entry import ServiceSettings
|
||||||
|
import pyfastocloud_models.constants as constants
|
||||||
|
|
||||||
|
|
||||||
# routes
|
# routes
|
||||||
|
@ -14,11 +15,32 @@ class ProviderView(FlaskView):
|
||||||
server = current_user.get_current_server()
|
server = current_user.get_current_server()
|
||||||
if server:
|
if server:
|
||||||
streams = server.get_streams()
|
streams = server.get_streams()
|
||||||
front_streams = []
|
streams_relay_encoder_timeshifts = []
|
||||||
|
vods = []
|
||||||
|
cods = []
|
||||||
|
proxy = []
|
||||||
|
catchups = []
|
||||||
|
events = []
|
||||||
for stream in streams:
|
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)
|
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)
|
servers=current_user.servers, role=role)
|
||||||
|
|
||||||
return redirect(url_for('ProviderView:settings'))
|
return redirect(url_for('ProviderView:settings'))
|
||||||
|
|
|
@ -53,6 +53,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
{{super()}}
|
{{super()}}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -319,8 +320,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for rev in streams %}
|
{% 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 }}'>
|
<tr id='{{ rev.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -423,7 +422,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -470,8 +468,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for vod in streams %}
|
{% for vod in vods %}
|
||||||
{% if (vod.type == 8 or vod.type == 9) %}
|
|
||||||
<tr id='{{ vod.id }}'>
|
<tr id='{{ vod.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -556,7 +553,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -592,8 +588,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for cod in streams %}
|
{% for cod in cods %}
|
||||||
{% if (cod.type == 10 or cod.type == 11) %}
|
|
||||||
<tr id='{{ cod.id }}'>
|
<tr id='{{ cod.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -696,7 +691,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -723,8 +717,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for proxy in streams %}
|
{% for proxy in proxies %}
|
||||||
{% if (proxy.type == 0 or proxy.type == 1) %}
|
|
||||||
<tr id='{{ proxy.id }}'>
|
<tr id='{{ proxy.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -755,7 +748,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -785,8 +777,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for catchup in streams %}
|
{% for catchup in catchups %}
|
||||||
{% if (catchup.type == 6) %}
|
|
||||||
<tr id='{{ catchup.id }}'>
|
<tr id='{{ catchup.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -798,7 +789,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
'TIMESHIFT_RECORDER',
|
'TIMESHIFT_RECORDER',
|
||||||
'CATCHUP',
|
'CATCHUP',
|
||||||
'TEST_LIFE',
|
'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>
|
||||||
<td>{{ catchup.price }}</td>
|
<td>{{ catchup.price }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -815,9 +807,38 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
onclick="remove_stream('{{ catchup.id }}')">
|
onclick="remove_stream('{{ catchup.id }}')">
|
||||||
Remove
|
Remove
|
||||||
</button>
|
</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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -850,8 +871,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for event in streams %}
|
{% for event in events %}
|
||||||
{% if (event.type == 12) %}
|
|
||||||
<tr id='{{ event.id }}'>
|
<tr id='{{ event.id }}'>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -955,7 +975,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1473,5 +1492,6 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue