Skip to content

Commit b05f469

Browse files
authored
Merge branch 'main' into packet-filters
2 parents ca5e5eb + cc62b39 commit b05f469

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

front/src/configurators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from abc import abstractmethod
22
import json
3-
3+
from celery_app import app
44
from flask import jsonify, make_response, request, Response
55
from flask_login import current_user
66
from miminet_model import Network, Simulate, db
@@ -221,6 +221,7 @@ def __conf_sims_delete(self):
221221
# Remove all previous simulations (after configuration update)
222222
sims = Simulate.query.filter(Simulate.network_id == self._cur_network.id).all()
223223
for s in sims:
224+
app.control.revoke(s.task_guid, terminate=False)
224225
db.session.delete(s)
225226

226227
self._cur_network.network = json.dumps(self._json_network)

front/src/static/netfront_f.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let global_cy = undefined;
33
let global_eh = undefined;
44
var NetworkUpdateTimeoutId = -1;
55
let NetworkCache = [];
6+
let lastSimulationId = 0
67

78
let packetsNotFiltered = null;
89
let packetFilterState = {
@@ -1305,7 +1306,7 @@ const CheckSimulation = function (simulation_id)
13051306
url: '/check_simulation?simulation_id=' + simulation_id + '&network_guid=' + network_guid,
13061307
data: '',
13071308
success: function(data, textStatus, xhr) {
1308-
1309+
lastSimulationId = data.simulation_id
13091310
// If we got 210 (processing) wait 2 sec and call themself again
13101311
if (xhr.status === 210)
13111312
{
@@ -1330,7 +1331,9 @@ const CheckSimulation = function (simulation_id)
13301331
},
13311332
error: function(xhr) {
13321333
console.log('Cannot check simulation id = ' + simulation_id);
1333-
SetNetworkPlayerState(-1);
1334+
if (lastSimulationId == simulation_id){
1335+
SetNetworkPlayerState(-1);
1336+
}
13341337
},
13351338
contentType: "application/json",
13361339
dataType: 'json'
@@ -1386,8 +1389,8 @@ const InsertWaitingTimeHelper = function(time_filter) {
13861389
data: '',
13871390
success: function(data) {
13881391
const queue_size = parseInt(data.size);
1389-
1390-
if ($('#NetworkPlayerLabel').text().startsWith("Шаг:")) {
1392+
if (!$('#NetworkPlayer button:first').prop('disabled')) {
1393+
console.log($('#NetworkPlayer button:first').prop('disabled'))
13911394
return;
13921395
} else if (queue_size <= 1) {
13931396
$('#NetworkPlayerLabel').text("Ожидание 10-15 сек.");

0 commit comments

Comments
 (0)