20032: Fix unnecessary race in test.
[arvados.git] / apps / workbench / app / assets / javascripts / event_log.js
index 10fe5be8f10a024b9bb0133bb18cf9ecd903e663..e576ba97a35785ec72dd4c68c9b7dd69e6cff099 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 /*
  * This js establishes a websockets connection with the API Server.
  */
@@ -56,53 +60,3 @@ $(document).on('ajax:complete ready', function() {
         subscribeToEventLog();
     }
 });
-
-
-function processLogLineForChart( logLine, jobGraphSeries, jobGraphData ) {
-    var match = logLine.match(/(.*)crunchstat:(.*)-- interval(.*)/);
-    if( match ) {
-        var series = match[2].trim().split(' ')[0];
-        if( $.inArray( series, jobGraphSeries) < 0 ) {
-            jobGraphSeries.push(series);
-        }
-        var intervalData = match[3].trim().split(' ');
-        var dt = parseFloat(intervalData[0]);
-        var dsum = 0.0;
-        for(var i=2; i < intervalData.length; i += 2 ) {
-            dsum += parseFloat(intervalData[i]);
-        }
-        var datum = (dsum/dt).toFixed(4);
-        var preamble = match[1].trim().split(' ');
-        var timestamp = preamble[0].replace('_','T');
-        var xpoints = $.grep( jobGraphData, function(e){ return e['t'] === timestamp; });
-        if(xpoints.length) {
-            // xpoints[0] is the x point that that matched the timestamp and so already existed: add the new datum
-            xpoints[0][series] = datum;
-        } else {
-            var entry = { 't': timestamp };
-            entry[series] = datum;
-            jobGraphData.push( entry );
-        }
-    }
-}
-
-$(document).on('arv-log-event', '#log_graph_div', function(event, eventData) {
-    if( eventData.properties.text ) {
-        var series_length = jobGraphSeries.length;
-        processLogLineForChart( eventData.properties.text, jobGraphSeries, jobGraphData);
-        if( series_length < jobGraphSeries.length) {
-            // series have changed, draw entirely new graph
-            $('#log_graph_div').html('');
-            jobGraph = Morris.Line({
-                element: 'log_graph_div',
-                data: jobGraphData,
-                xkey: 't',
-                ykeys: jobGraphSeries,
-                labels: jobGraphSeries
-            });
-        } else {
-            jobGraph.setData( jobGraphData );
-        }
-    }
-
-} );
\ No newline at end of file