Use WebSocket classes
This commit is contained in:
parent
360c442a4e
commit
e051631a34
3 changed files with 3 additions and 24 deletions
|
@ -13,7 +13,6 @@
|
|||
<script type="text/javascript" src="{% static 'kfet/js/moment-fr.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'kfet/js/moment-timezone-with-data-2010-2020.js' %}"></script>
|
||||
<script type="text/javascript" src="{% url 'js_reverse' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'kfet/js/kfet.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'kfet/js/kfet.api.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
|
||||
{% if account.user == request.user %}
|
||||
|
@ -115,16 +114,7 @@ $(document).ready(function() {
|
|||
// Synchronization
|
||||
// -----
|
||||
|
||||
var websocket_msg_default = {'opegroups':[],'opes':[]}
|
||||
|
||||
var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
|
||||
var location_host = window.location.host;
|
||||
var location_url = window.location.pathname.startsWith('/gestion/') ? location_host + '/gestion' : location_host;
|
||||
var socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
|
||||
socket.onmessage = function(e) {
|
||||
var data = $.extend({}, websocket_msg_default, JSON.parse(e.data));
|
||||
history.update_data(data);
|
||||
}
|
||||
OperationWebSocket.add_handler((data) => history.update_data(data));
|
||||
|
||||
Config.reset(history.reset.bind(history));
|
||||
});
|
||||
|
|
|
@ -63,18 +63,7 @@ $(document).ready(function() {
|
|||
// Synchronization
|
||||
// -----
|
||||
|
||||
|
||||
var websocket_msg_default = {'opes':[]}
|
||||
|
||||
var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
|
||||
var location_host = window.location.host;
|
||||
var location_url = window.location.pathname.startsWith('/gestion/') ? location_host + '/gestion' : location_host;
|
||||
var socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
|
||||
socket.onmessage = function(e) {
|
||||
var data = $.extend({}, websocket_msg_default, JSON.parse(e.data));
|
||||
history.update_data(data);
|
||||
|
||||
}
|
||||
OperationWebSocket.add_handler((data) => history.update_data(data));
|
||||
|
||||
Config.reset(history.reset.bind(history));
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ from django.http import JsonResponse, Http404
|
|||
from django.forms import formset_factory
|
||||
from django.forms.models import model_to_dict
|
||||
from django.db import transaction
|
||||
from django.db.models import F, Sum, Prefetch, Count
|
||||
from django.db.models import Q, F, Sum, Prefetch, Count
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.utils import timezone
|
||||
from django.utils.crypto import get_random_string
|
||||
|
|
Loading…
Reference in a new issue