5493: (thanks to tom) modal paging is awesome.
[arvados.git] / apps / workbench / app / assets / javascripts / event_log.js
index 8f9728afbf81758470dc67cda82953ba5ca88280..36361a17d12e3f295910b87be2ff85a6e6077110 100644 (file)
@@ -56,85 +56,3 @@ $(document).on('ajax:complete ready', function() {
         subscribeToEventLog();
     }
 });
-
-
-function processLogLineForChart( logLine ) {
-    var recreate = false;
-    var rescale = false;
-    // TODO: make this more robust: anything could go wrong in here
-    var match = logLine.match(/(.*)crunchstat:(.*)-- interval(.*)/);
-    if( match ) {
-        var series = match[2].trim().split(' ')[0];
-        if( $.inArray( series, jobGraphSeries) < 0 ) {
-            jobGraphSeries.push(series);
-            jobGraphMaxima[series] = null;
-            recreate = true;
-        }
-        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;
-        if( datum !== 0 && ( jobGraphMaxima[series] === null || jobGraphMaxima[series] < datum ) ) {
-            // use old maximum to get a scale conversion
-            var scaleConversion = jobGraphMaxima[series]/datum;
-            // set new maximum
-            jobGraphMaxima[series] = datum;
-            // rescale
-            $.each( jobGraphData, function( i, entry ) {
-                if( entry[series] !== null && entry[series] !== undefined ) {
-                    entry[series] *= scaleConversion;
-                }
-            });
-        }
-        // scale
-        // FIXME: what about negative numbers?
-        var scaledDatum = null;
-        if( jobGraphMaxima[series] !== null && jobGraphMaxima[series] !== 0 ) {
-            scaledDatum = datum/jobGraphMaxima[series]
-        } else {
-            scaledDatum = datum;
-        }
-        // more parsing
-        var preamble = match[1].trim().split(' ');
-        var timestamp = preamble[0].replace('_','T');
-        // identify x axis point
-        var found = false;
-        for( var i = 0; i < jobGraphData.length; i++ ) {
-            if( jobGraphData[i]['t'] === timestamp ) {
-                found = true;
-                break;
-            }
-        }
-        if(found) {
-            jobGraphData[i][series] = scaledDatum;
-        } else {
-            var entry = { 't': timestamp };
-            entry[series] = scaledDatum;
-            jobGraphData.push( entry );
-        }
-    }
-    return recreate;
-}
-
-$(document).on('arv-log-event', '#log_graph_div', function(event, eventData) {
-    if( eventData.properties.text ) {
-        var recreate = processLogLineForChart( eventData.properties.text );
-        if( recreate ) {
-            // series have changed, draw entirely new graph
-            $('#log_graph_div').html('');
-            window.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