Commit 8b045708 authored by Kento HASEGAWA's avatar Kento HASEGAWA

Improve GUI behavior when stopping solver

parent fe01ca25
......@@ -65,6 +65,7 @@ class StatusView {
show: true
});
_this.container.find('#solver-processing-modal').on('hidden.bs.modal', function(e){
clearInterval(_this.request_refresh_timer);
_this.show_problem();
_this.fire('refresh');
})
......@@ -73,7 +74,10 @@ class StatusView {
_this.stop_solver();
});
_this.get_request_status(request_id, timeout);
_this.request_refresh_timer = setInterval((function _t(){
_this.get_request_status(request_id);
return _t;
}()), 1000);
});
}
......@@ -86,8 +90,7 @@ class StatusView {
dataType: "json",
url: "/api/stop",
}).done((d) => {
_this.request_refresh_timer = 'stopped';
alert(d);
alert('Stopped');
});
}
......@@ -108,7 +111,7 @@ class StatusView {
});
}
get_request_status(request_id, timeout){
get_request_status(request_id){
var _this = this;
$.ajax({
type: 'GET',
......@@ -119,13 +122,8 @@ class StatusView {
_this.container.find('#request-status-container').html(d);
status = $(d).find('#request-status-value').text();
// console.log(status);
if(status == 'done'){
_this.request_refresh_timer = null;
}else if(_this.request_refresh_timer == 'stopped'){
_this.request_refresh_timer = null;
}else{
_this.request_refresh_timer = setTimeout(_this.get_request_status(request_id, timeout), 1000);
clearInterval(_this.request_refresh_timer);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment