cockpit/js/instance.js in cpee-1.3.120 vs cockpit/js/instance.js in cpee-1.3.121

- old
+ new

@@ -1,5 +1,6 @@ +var ws; var running = false; var load; var graphrealization; var subscription; var subscription_state = 'less'; @@ -133,11 +134,11 @@ }// }}} function monitor_instance() {// {{{ var url = $("input[name=instance-url]").val(); - $('#main .tabbehind button').hide(); + $('.tabbehind button').hide(); $('#dat_details').empty(); $.ajax({ type: "GET", url: url + "/properties/schema/", @@ -153,10 +154,12 @@ ui_tab_click($("#tabinstance")[0]); // Change url to return to current instance when reloading (because new subscription is made) $("input[name=votecontinue]").removeAttr('checked'); + subscription_state = 'less'; + $.ajax({ type: "POST", url: url + "/notifications/subscriptions/", data: sub_less, success: function(res){ @@ -166,10 +169,11 @@ subscription = b[1]; } }); append_to_log("monitoring", "id", subscription); var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket; + if (ws) ws.close(); ws = new Socket(url.replace(/http/,'ws') + "/notifications/subscriptions/" + subscription + "/ws/"); ws.onopen = function() { append_to_log("monitoring", "opened", ""); }; ws.onmessage = function(e) { @@ -375,9 +379,15 @@ but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button>"; } if (notification == "running") { but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");stop_instance();'>stop</button>"; } + + if (notification == "finished") { + $('.tabbehind button').hide(); + } else { + $('#parameters .tabbehind button').show(); + } ctv.append(notification + but); } } //}}} function monitor_instance_pos_change(notification) {// {{{