mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [chats] fix templates, chat subtype
This commit is contained in:
parent
87dc619171
commit
38d71e97dd
8 changed files with 26 additions and 26 deletions
|
@ -58,7 +58,7 @@ def chats_explorer_networks():
|
||||||
networks = chats_viewer.get_chat_service_instances_by_protocol(protocol)
|
networks = chats_viewer.get_chat_service_instances_by_protocol(protocol)
|
||||||
if len(networks) == 1:
|
if len(networks) == 1:
|
||||||
instance_uuid = list(networks.values())[0]
|
instance_uuid = list(networks.values())[0]
|
||||||
return redirect(url_for('chats_explorer.chats_explorer_instance', uuid=instance_uuid))
|
return redirect(url_for('chats_explorer.chats_explorer_instance', subtype=instance_uuid))
|
||||||
else:
|
else:
|
||||||
return render_template('chats_networks.html', protocol=protocol, networks=networks)
|
return render_template('chats_networks.html', protocol=protocol, networks=networks)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ def chats_explorer_networks():
|
||||||
@login_required
|
@login_required
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def chats_explorer_instance():
|
def chats_explorer_instance():
|
||||||
intance_uuid = request.args.get('uuid')
|
intance_uuid = request.args.get('subtype')
|
||||||
chat_instance = chats_viewer.api_get_chat_service_instance(intance_uuid)
|
chat_instance = chats_viewer.api_get_chat_service_instance(intance_uuid)
|
||||||
if chat_instance[1] != 200:
|
if chat_instance[1] != 200:
|
||||||
return create_json_response(chat_instance[0], chat_instance[1])
|
return create_json_response(chat_instance[0], chat_instance[1])
|
||||||
|
@ -80,7 +80,7 @@ def chats_explorer_instance():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def chats_explorer_chat():
|
def chats_explorer_chat():
|
||||||
chat_id = request.args.get('id')
|
chat_id = request.args.get('id')
|
||||||
instance_uuid = request.args.get('uuid')
|
instance_uuid = request.args.get('subtype')
|
||||||
target = request.args.get('target')
|
target = request.args.get('target')
|
||||||
if target == "Don't Translate":
|
if target == "Don't Translate":
|
||||||
target = None
|
target = None
|
||||||
|
@ -125,7 +125,7 @@ def chats_explorer_messages_stats_week_all():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def objects_subchannel_messages():
|
def objects_subchannel_messages():
|
||||||
subchannel_id = request.args.get('id')
|
subchannel_id = request.args.get('id')
|
||||||
instance_uuid = request.args.get('uuid')
|
instance_uuid = request.args.get('subtype')
|
||||||
target = request.args.get('target')
|
target = request.args.get('target')
|
||||||
if target == "Don't Translate":
|
if target == "Don't Translate":
|
||||||
target = None
|
target = None
|
||||||
|
@ -144,7 +144,7 @@ def objects_subchannel_messages():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def objects_thread_messages():
|
def objects_thread_messages():
|
||||||
thread_id = request.args.get('id')
|
thread_id = request.args.get('id')
|
||||||
instance_uuid = request.args.get('uuid')
|
instance_uuid = request.args.get('subtype')
|
||||||
target = request.args.get('target')
|
target = request.args.get('target')
|
||||||
if target == "Don't Translate":
|
if target == "Don't Translate":
|
||||||
target = None
|
target = None
|
||||||
|
@ -178,7 +178,7 @@ def chats_explorer_chat_participants():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def chats_explorer_chat_download():
|
def chats_explorer_chat_download():
|
||||||
chat_id = request.args.get('id')
|
chat_id = request.args.get('id')
|
||||||
chat_subtype = request.args.get('uuid')
|
chat_subtype = request.args.get('subtype')
|
||||||
chat = chats_viewer.api_chat_messages(chat_subtype, chat_id)
|
chat = chats_viewer.api_chat_messages(chat_subtype, chat_id)
|
||||||
if chat[1] != 200:
|
if chat[1] != 200:
|
||||||
if chat[1] == 404:
|
if chat[1] == 404:
|
||||||
|
@ -193,7 +193,7 @@ def chats_explorer_chat_download():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def objects_subchannel_messages_download():
|
def objects_subchannel_messages_download():
|
||||||
subchannel_id = request.args.get('id')
|
subchannel_id = request.args.get('id')
|
||||||
instance_uuid = request.args.get('uuid')
|
instance_uuid = request.args.get('subtype')
|
||||||
subchannel = chats_viewer.api_subchannel_messages(instance_uuid, subchannel_id)
|
subchannel = chats_viewer.api_subchannel_messages(instance_uuid, subchannel_id)
|
||||||
if subchannel[1] != 200:
|
if subchannel[1] != 200:
|
||||||
return create_json_response(subchannel[0], subchannel[1])
|
return create_json_response(subchannel[0], subchannel[1])
|
||||||
|
@ -206,7 +206,7 @@ def objects_subchannel_messages_download():
|
||||||
@login_read_only
|
@login_read_only
|
||||||
def objects_thread_messages_download():
|
def objects_thread_messages_download():
|
||||||
thread_id = request.args.get('id')
|
thread_id = request.args.get('id')
|
||||||
instance_uuid = request.args.get('uuid')
|
instance_uuid = request.args.get('subtype')
|
||||||
thread = chats_viewer.api_thread_messages(instance_uuid, thread_id)
|
thread = chats_viewer.api_thread_messages(instance_uuid, thread_id)
|
||||||
if thread[1] != 200:
|
if thread[1] != 200:
|
||||||
return create_json_response(thread[0], thread[1])
|
return create_json_response(thread[0], thread[1])
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
{% for thread in subchannel['threads'] %}
|
{% for thread in subchannel['threads'] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?uuid={{ thread['subtype'] }}&id={{ thread['id'] }}">{{ thread['name'] }} <i class="far fa-comment"></i> {{ thread['nb_messages'] }} Messages</a>
|
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?subtype={{ thread['subtype'] }}&id={{ thread['id'] }}">{{ thread['name'] }} <i class="far fa-comment"></i> {{ thread['nb_messages'] }} Messages</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ thread["created_at"] }}</td>
|
<td>{{ thread["created_at"] }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
<span class="mt-3">
|
<span class="mt-3">
|
||||||
{% include 'objects/image/block_blur_img_slider.html' %}
|
{% include 'objects/image/block_blur_img_slider.html' %}
|
||||||
</span>
|
</span>
|
||||||
{% with translate_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), obj_id=subchannel['id'], pagination=subchannel['pagination'] %}
|
{% with translate_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), obj_id=subchannel['id'], pagination=subchannel['pagination'] %}
|
||||||
{% include 'chats_explorer/block_translation.html' %}
|
{% include 'chats_explorer/block_translation.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with obj_subtype=subchannel['subtype'], obj_id=subchannel['id'], url_endpoint=url_for("chats_explorer.objects_subchannel_messages"), nb=subchannel['pagination']['nb'] %}
|
{% with obj_subtype=subchannel['subtype'], obj_id=subchannel['id'], url_endpoint=url_for("chats_explorer.objects_subchannel_messages"), nb=subchannel['pagination']['nb'] %}
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
{% set date_to=subchannel['last_seen'] %}
|
{% set date_to=subchannel['last_seen'] %}
|
||||||
{% include 'block_obj_time_search.html' %}
|
{% include 'block_obj_time_search.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), pagination=subchannel['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), pagination=subchannel['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
@ -238,7 +238,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', uuid=subchannel['subtype']), pagination=subchannel['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.objects_subchannel_messages', subtype=subchannel['subtype']), pagination=subchannel['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + subchannel['id'] + "&nb=" + subchannel['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
<span class="mt-3">
|
<span class="mt-3">
|
||||||
{% include 'objects/image/block_blur_img_slider.html' %}
|
{% include 'objects/image/block_blur_img_slider.html' %}
|
||||||
</span>
|
</span>
|
||||||
{% with translate_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), obj_id=meta['id'], pagination=meta['pagination'] %}
|
{% with translate_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), obj_id=meta['id'], pagination=meta['pagination'] %}
|
||||||
{% include 'chats_explorer/block_translation.html' %}
|
{% include 'chats_explorer/block_translation.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with obj_subtype=meta['subtype'], obj_id=meta['id'], url_endpoint=url_for("chats_explorer.objects_thread_messages"), nb=meta['pagination']['nb'] %}
|
{% with obj_subtype=meta['subtype'], obj_id=meta['id'], url_endpoint=url_for("chats_explorer.objects_thread_messages"), nb=meta['pagination']['nb'] %}
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
{% set date_to=meta['last_seen'] %}
|
{% set date_to=meta['last_seen'] %}
|
||||||
{% include 'block_obj_time_search.html' %}
|
{% include 'block_obj_time_search.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), pagination=meta['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), pagination=meta['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
@ -178,7 +178,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', uuid=meta['subtype']), pagination=meta['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.objects_thread_messages', subtype=meta['subtype']), pagination=meta['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + meta['id'] + "&nb=" + meta['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
{% if message['thread'] %}
|
{% if message['thread'] %}
|
||||||
<hr class="mb-1">
|
<hr class="mb-1">
|
||||||
<div class="my-2 text-center">
|
<div class="my-2 text-center">
|
||||||
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?uuid={{ message['thread']['subtype'] }}&id={{ message['thread']['id'] }}"><i class="far fa-comment"></i> {{ message['thread']['nb'] }} Messages</a>
|
<a href="{{ url_for('chats_explorer.objects_thread_messages')}}?subtype={{ message['thread']['subtype'] }}&id={{ message['thread']['id'] }}"><i class="far fa-comment"></i> {{ message['thread']['nb'] }} Messages</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for tag in message['tags'] %}
|
{% for tag in message['tags'] %}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function filter_by_time() {
|
function filter_by_time() {
|
||||||
let parameter = "?uuid={{ obj_subtype }}&id={{ obj_id }}";
|
let parameter = "?subtype={{ obj_subtype }}&id={{ obj_id }}";
|
||||||
//let date_from = $('#date-range-from-input').val();
|
//let date_from = $('#date-range-from-input').val();
|
||||||
//let date_to = $('#date-range-to-input').val();
|
//let date_to = $('#date-range-to-input').val();
|
||||||
let nb_messages = $('#nb_messages').val();
|
let nb_messages = $('#nb_messages').val();
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
class="rounded-circle mr-1" alt="{{ chat['id'] }}" width="40" height="40">
|
class="rounded-circle mr-1" alt="{{ chat['id'] }}" width="40" height="40">
|
||||||
</td>
|
</td>
|
||||||
<td><b>{{ chat['name'] }}</b></td>
|
<td><b>{{ chat['name'] }}</b></td>
|
||||||
<td><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?uuid={{ chat_instance['uuid'] }}&id={{ chat['id'] }}">{{ chat['id'] }}</a></td>
|
<td><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?subtype={{ chat_instance['uuid'] }}&id={{ chat['id'] }}">{{ chat['id'] }}</a></td>
|
||||||
<td>{{ chat['created_at'] }}</td>
|
<td>{{ chat['created_at'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if chat['first_seen'] %}
|
{% if chat['first_seen'] %}
|
||||||
|
|
|
@ -116,10 +116,6 @@
|
||||||
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }} <span class="badge badge-light">{{ chat['tags_messages'][tag] }}</span></span>
|
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }} <span class="badge badge-light">{{ chat['tags_messages'][tag] }}</span></span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% with translate_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), obj_id=chat['id'], pagination=chat['pagination'] %}
|
|
||||||
{% include 'chats_explorer/block_translation.html' %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
{% if chat['subchannels'] %}
|
{% if chat['subchannels'] %}
|
||||||
<h4 class="mt-2">Sub-Channels:</h4>
|
<h4 class="mt-2">Sub-Channels:</h4>
|
||||||
<table id="tablesubchannels" class="table">
|
<table id="tablesubchannels" class="table">
|
||||||
|
@ -146,7 +142,7 @@
|
||||||
<div class="text-secondary">{{ meta['translation_name'] }}</div>
|
<div class="text-secondary">{{ meta['translation_name'] }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><a href="{{ url_for('chats_explorer.objects_subchannel_messages') }}?uuid={{ meta['subtype'] }}&id={{ meta['id'] }}">{{ meta['id'] }}</a></td>
|
<td><a href="{{ url_for('chats_explorer.objects_subchannel_messages') }}?subtype={{ meta['subtype'] }}&id={{ meta['id'] }}">{{ meta['id'] }}</a></td>
|
||||||
<td>{{ meta['created_at'] }}</td>
|
<td>{{ meta['created_at'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if meta['first_seen'] %}
|
{% if meta['first_seen'] %}
|
||||||
|
@ -174,6 +170,10 @@
|
||||||
<div id="heatmapweekhour"></div>
|
<div id="heatmapweekhour"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% with translate_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), obj_id=chat['id'], pagination=chat['pagination'] %}
|
||||||
|
{% include 'chats_explorer/block_translation.html' %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% if chat['messages'] %}
|
{% if chat['messages'] %}
|
||||||
|
|
||||||
<span class="mt-3">
|
<span class="mt-3">
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
{% set date_to=chat['last_seen'] %}
|
{% set date_to=chat['last_seen'] %}
|
||||||
{% include 'block_obj_time_search.html' %}
|
{% include 'block_obj_time_search.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), pagination=chat['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), pagination=chat['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', uuid=chat['subtype']), pagination=chat['pagination'] %}
|
{% with endpoint_url=url_for('chats_explorer.chats_explorer_chat', subtype=chat['subtype']), pagination=chat['pagination'] %}
|
||||||
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
|
{% set endpoint_url = endpoint_url + "&id=" + chat['id'] + "&nb=" + chat['pagination']['nb'] | string %}
|
||||||
{% if translation_target %}
|
{% if translation_target %}
|
||||||
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
{% set endpoint_url = endpoint_url + "&target=" + translation_target %}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
{% for instance_uuid in networks[network] %}
|
{% for instance_uuid in networks[network] %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a class="nav-link" href="{{url_for('chats_explorer.chats_explorer_instance')}}?uuid={{ instance_uuid }}">
|
<a class="nav-link" href="{{url_for('chats_explorer.chats_explorer_instance')}}?subtype={{ instance_uuid }}">
|
||||||
<span>{{ instance_uuid }}</span>
|
<span>{{ instance_uuid }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue