cockpit/js/instance.js in cpee-2.1.46 vs cockpit/js/instance.js in cpee-2.1.47
- old
+ new
@@ -15,10 +15,11 @@
function global_init() {
suspended_redrawing = false;
loading = false;
subscription = undefined;
subscription_state = 'less';
+ save['states']= {};
save['state']= undefined;
save['dsl'] = undefined;
save['activity_red_states'] = {}
save['activity_blue_states'] = {}
save['graph'] = undefined;
@@ -290,10 +291,11 @@
$('#trackcolumn').append($('<iframe src="track.html?monitor=' + data.content.received['CPEE-INSTANCE-URL'].replace(/\/*$/,'/') + '"></iframe>'));
$('#graphcolumn').addClass('resize');
}
break;
case 'state':
+ save['states'][data['content']['state']] = Date.parse(data.timestamp);
monitor_instance_state_change(data['content']['state']);
break;
case 'position':
monitor_instance_pos_change(data['content']);
break;
@@ -732,22 +734,25 @@
}
} // }}}
function monitor_instance_state_change(notification) { //{{{
+ // sometimes, out of sheer network routingness, stopping comes after stopped, which fucks the UI hard
+ // thus, we are having none of it
+ if (notification == 'stopping' && save['states']['stopping'] - save['states']['stopped'] < 10)
+ notification = 'stopped';
+ if (notification == 'stopping' && save['state'] == 'stopped')
+ return;
+
if ($('#trackcolumn').length > 0) {
if (notification == "finished" || notification == "abandoned") {
parent.closeIFrame(window.location.search);
}
}
if (notification == "ready" || notification == "stopped" || notification == "running") {
$("#state button").removeAttr('disabled');
}
- // sometimes, out of sheer network routingness, stopping comes after stopped, which fucks the UI hard
- // thus, we are having none of it
- if (notification == 'stopping' && save['state'] == 'stopped')
- return;
if (notification != save['state']) {
save['state'] = notification;
if (notification == "stopped") {
monitor_instance_pos();