Changeset 6876


Ignore:
Timestamp:
Feb 19, 2018, 6:48:13 PM (20 months ago)
Author:
mabarracus
Message:

Whitelist implementation

Location:
lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php

    r6868 r6876  
    11<?php
     2$USE_CACHE = true;
    23class Cache{
    34    private $cache_file;
     
    6162    }
    6263    function get($key){
     64        global $USE_CACHE;
     65        if (! $USE_CACHE){
     66            return false;
     67        }
    6368        if (! $this->process()){
    6469            return false;
     
    444449     }
    445450
    446      function get_historic_data(){
     451     function get_historic_data($typechart=''){
    447452         $this->load_alias();
    448453         $obj=[];
     
    455460                 $sname=$sabor['name'];
    456461                 $slike=$sabor['like'];
    457                  $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'current');
    458                  $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'old');
    459                  $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'very_old');
     462                 $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'current',$typechart);
     463                 $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'old',$typechart);
     464                 $obj[$dname][$sname][]=$this->get_chart($dlike,$slike,'very_old',$typechart);
    460465             }
    461466         }
     
    467472         return json_encode($obj);
    468473     }
    469     function get_chart($version='',$sabor='',$type='current'){
    470         $cache_key="$version"."_"."$sabor"."_"."$type";
     474   
     475    function get_chart($version='',$sabor='',$type='current',$typechart=''){
     476        if ($typechart == ''){
     477            $cache_key="$version"."_"."$sabor"."_"."$type";
     478            $limit = "limit 10";
     479            $sql_limit=10;
     480            $and = "";
     481        }else{
     482            $cache_key="$version"."_"."$sabor"."_"."$type"."_"."$typechart";
     483            $limit = "";
     484            $sql_limit=1000;
     485            $and = "and string in ( select `name` from `PackagesWhitelist` where status = '1' )";
     486        }
    471487        if ($version != ''){
    472488            $version = " and Releases_name = '$version' ";
     
    475491            $sabor = " and Flavours_name = '$sabor' ";
    476492        }
    477         $order=" order by count desc limit 10 ";
     493        $order=" order by count desc $limit ";
    478494        $group=" group by app ";
    479495
     
    481497        $where_clients=$this->dates['date_'.$type]." $version $sabor ";
    482498
    483         $sql="SELECT string as app,sum(count) as count from RecvPackages where $where $group $order";
     499        $sql="SELECT string as app,sum(count) as count from RecvPackages where $where $and $group $order";
    484500        $sql_clients = "select count(distinct Client_uid) as count from Client_Versions where $where_clients $order";
    485 
    486501        $cache = new Cache;
    487502        $data = $cache->get($cache_key);
     
    489504            return $data;
    490505        }else{
    491             $data=array($this->get_result_from_sql($sql),$this->get_clients_from_sql($sql_clients));
     506            $data=array($this->get_result_from_sql($sql,$sql_limit),$this->get_clients_from_sql($sql_clients));
    492507            $cache->store($data,$cache_key);
    493508            return $data;
     
    510525
    511526     }
    512      function get_result_from_sql($sql){
     527     function get_result_from_sql($sql,$limit){
    513528             $stime=microtime(true);
    514529         if ($result=$this->dbconn->query($sql)){
     
    520535                 if (array_key_exists($row['app'],$this->alias)){
    521536                     if (! empty($this->alias[$row['app']])){
    522                          if ($nobj < 10)
     537                         if ($nobj < $limit)
    523538                             $obj2[$this->alias[$row['app']]]=$row['count'];
    524539                         $nobj++;
    525540                     }
    526541                 }else{
    527                      if ($nobj < 10)
     542                     if ($nobj < $limit)
    528543                         $obj2[$row['app']]=$row['count'];
    529544                     $nobj++;
     
    536551     }
    537552    function get_whitelist_form(){
    538         $sql = "select distinct `string` from `RecvPackages`";
     553        $sql = "select distinct `string` from `RecvPackages` order by `string` asc";
    539554        $sql2 = "select `name`,`status` from `PackagesWhitelist`";
    540555        $result=$this->dbconn->query($sql);
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/functions.php

    r6868 r6876  
    9494                $db = new DB;
    9595                $db->connect();
    96                 echo $db->get_historic_data();
     96                echo $db->get_historic_data('');
     97                $db->disconnect();
     98        };
     99}
     100
     101function call_get_lliurex_stats(){
     102        return function($request,$reponse,$service){
     103
     104                $db = new DB;
     105                $db->connect();
     106                echo $db->get_historic_data('whitelist');
    97107                $db->disconnect();
    98108        };
     
    154164    <script type="text/javascript">
    155165        google.charts.load("current", {packages: ["corechart"],"language":"es"});
    156         google.charts.setOnLoadCallback(doChart);
     166        google.charts.setOnLoadCallback(function(){doChart("")});
    157167    </script>
    158168    <link href="ui/jquery-ui.css" rel="stylesheet">
     
    168178
    169179};
    170 
     180}
     181
     182function call_show_lliurex_stats(){
     183
     184return function($request,$reponse,$service){
     185
     186echo '<html>
     187  <head>
     188    <!--Load the AJAX API-->
     189    <!--<script type="text/javascript" src="https://www.google.com/jsapi"></script>-->
     190    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
     191    <script type="text/javascript" src="jquery.min.js"></script>
     192    <script type="text/javascript" src="graph_min.js"></script>
     193
     194    <script type="text/javascript">
     195        google.charts.load("current", {packages: ["corechart"],"language":"es"});
     196        google.charts.setOnLoadCallback(function(){doChart("whitelist")});
     197    </script>
     198    <link href="ui/jquery-ui.css" rel="stylesheet">
     199    <link href="graph.css" rel="stylesheet">
     200    <script type="text/javascript" src="ui/jquery-ui.js"></script>
     201  </head>
     202  <body>
     203  <div id="header"><span class="title">Lliurex-Analytics <a class="go_to_other" href="ShowExtendedStats">[Extended stats]</a></span><div id="stats_box"></div></div>
     204  <div id="accordion"></div>
     205  </body>
     206</html>
     207';
     208
     209};
    171210}
    172211
     
    240279    <script type='text/javascript' src='jquery.min.js'></script>
    241280    <link href='whitelist.css' rel='stylesheet'>
    242     <script type='text/javascript' src='whitelist.js'></script>
     281    <script type='text/javascript' src='whitelist_min.js'></script>
    243282    <script type='text/javascript'>$(document).ready(start)</script>
    244283  </head>
     
    248287        <div id='nonwhitelist'>
    249288            <span>Not in whitelist</span>
     289            <div id='filternot' class='filter'>Filter:<textarea rows='1'></textarea></div>
    250290            <select name='denied' multiple>
    251291            </select>
     
    257297        <div id='unknown_state_whitelist'>
    258298            <span>New elements</span>
     299            <div id='filterunk' class='filter'>Filter:<textarea rows='1'></textarea></div>
    259300            <select name='nonselected' multiple>
    260301            </select>
     
    266307        <div id='inwhitelist'>
    267308            <span>In whitelist</span>
     309            <div id='filterin' class='filter'>Filter:<textarea rows='1'></textarea></div>
    268310            <select name='accepted' multiple>
    269311            </select>
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.js

    r6767 r6876  
    1 function drawChart(datos,title,id) {
     1function drawChart(datos,title,id,nelements) {
    22  var custom_width=$('#'+id).parent().width()*0.95;
    3   var custom_height=$(window).height()/3*0.75;
     3  if (nelements < 10){
     4    var custom_height=$(window).height()/3*0.75;
     5  }else{
     6    var custom_height=20*nelements;
     7  }
    48
    59  // Set chart options
    610  var options = {title:title,
    711                 width: custom_width,
    8                  height:custom_height,
     12                 height: custom_height,
    913                 fontSize: 10,
    1014                 legend: 'none',
     
    292296    return;
    293297}
    294 function doChart(){
     298function doChart(typechart=""){
    295299    end_load_time=get_time();
    296300    var datos1= new google.visualization.DataTable();
     
    310314    //Gets Data from DB
    311315    $('#accordion').append('<div id="loading"></div>');
    312     $.getJSON( "./GetStats", function( json ) {
    313        
     316    console.log(typechart)
     317    if (typechart == ''){
     318        url="./GetStats"
     319        limit = 10
     320    }else{
     321        url="./GetLliurexStats"
     322        limit = 1000
     323    }
     324    $.getJSON(url, function( json ) {
    314325        end_get_time=get_time();
    315326        start_graph_time=end_get_time;
     
    357368                    //console.log('drawing:'+titles[i]+' into '+divname+i);
    358369                    titles[i]=titles[i]+' (Total clients: '+json[distro][sabor][i][1]['nclients']+')'
    359                     drawChart(obj[obj.length-1],titles[i],divname+i);
     370                    drawChart(obj[obj.length-1],titles[i],divname+i,k);
    360371                }
    361372            }
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph_min.js

    r6767 r6876  
    1 function drawChart(c,a,b){var f=.95*$("#"+b).parent().width(),e=$(window).height()/3*.75;a={title:a,width:f,height:e,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"5%",right:"1%"}};c=new google.visualization.DataView(c);c.setColumns([0,1,{calc:"stringify",sourceColumn:1,type:"string",role:"annotation"}]);b=new google.visualization.BarChart(document.getElementById(b));google.visualization.events.addListener(b,"ready",ready_charts);b.draw(c,a)}
     1function drawChart(c,a,b,e){var f=.95*$("#"+b).parent().width();e=10>e?$(window).height()/3*.75:20*e;a={title:a,width:f,height:e,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"5%",right:"1%"}};c=new google.visualization.DataView(c);c.setColumns([0,1,{calc:"stringify",sourceColumn:1,type:"string",role:"annotation"}]);b=new google.visualization.BarChart(document.getElementById(b));google.visualization.events.addListener(b,"ready",ready_charts);b.draw(c,a)}
    22function get_sizes(c){c=.95*$("#"+c).parent().width();var a=.72*$(window).height()/2;return{width:c,height:a}}
    3 function build_data_per_month_releases(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},c[i]){for(rel in c[i]){if("15"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla];if("16"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var f=[],e=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Release");d.addColumn("number","Total Release 15");d.addColumn({type:"string",role:"style"},"Style Release 15");d.addColumn("number",
    4 "Total Release 16");d.addColumn({type:"string",role:"style"},"Style Release 16");d.addColumn("number","Total ALL Releases");d.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),f.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),e.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",
    5 isStacked:!1,hAxis:{title:"Months",ticks:f,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
    6 function build_data_per_month_flavours(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},c[i])for(rel in c[i])for(fla in c[i][rel])b[i][fla]+=c[i][rel][fla],b[i].all+=c[i][rel][fla];var f=[],e=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Flavour");d.addColumn("number","Total Server");d.addColumn({type:"string",role:"style"},"Style Server");d.addColumn("number","Total Client");d.addColumn({type:"string",role:"style"},"Style Client");
    7 d.addColumn("number","Total Desktop");d.addColumn({type:"string",role:"style"},"Style Desktop");d.addColumn("number","Total Other");d.addColumn({type:"string",role:"style"},"Style Other");d.addColumn("number","Total ALL Flavours");d.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),f.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
    8 b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),e.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:f,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
    9 function build_data_from_array(c,a){var b=[],f=new Date,e=new google.visualization.DataTable;e.addColumn({type:"date",role:"domain"},"Nhosts");e.addColumn("number",a);date_values=[];for(i=1;12>=i;i++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,c[i-1]]),f.setMonth(month-1);e.addRows(date_values);return{data:e,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
     3function build_data_per_month_releases(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},c[i]){for(rel in c[i]){if("15"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla];if("16"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var e=[],f=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Release");d.addColumn("number","Total Release 15");d.addColumn({type:"string",role:"style"},"Style Release 15");d.addColumn("number",
     4"Total Release 16");d.addColumn({type:"string",role:"style"},"Style Release 16");d.addColumn("number","Total ALL Releases");d.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),f.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",
     5isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
     6function build_data_per_month_flavours(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},c[i])for(rel in c[i])for(fla in c[i][rel])b[i][fla]+=c[i][rel][fla],b[i].all+=c[i][rel][fla];var e=[],f=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Flavour");d.addColumn("number","Total Server");d.addColumn({type:"string",role:"style"},"Style Server");d.addColumn("number","Total Client");d.addColumn({type:"string",role:"style"},"Style Client");
     7d.addColumn("number","Total Desktop");d.addColumn({type:"string",role:"style"},"Style Desktop");d.addColumn("number","Total Other");d.addColumn({type:"string",role:"style"},"Style Other");d.addColumn("number","Total ALL Flavours");d.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
     8b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),f.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
     9function build_data_from_array(c,a){var b=[],e=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Nhosts");f.addColumn("number",a);date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,c[i-1]]),e.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
    1010minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"}},legend:{textStyle:{fontSize:10}},chartArea:{left:"10%",right:"10%"},focusTarget:"category",lineWidth:5}}}
    1111function doExtendedChart(){end_load_time=get_time();var c=window.location.search.substr(1);""!=c&&(c="?"+c);var a={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+c,function(b){start_graph_time=end_get_time=get_time();var c=null;for(key in b){if("clients"==key)for(type in b[key])switch(type){case "clients_per_month":a[type]={};a[type].title="Machines";a[type].releases={};a[type].releases.graph=build_data_per_month_releases(b[key][type],
     
    1616chart_type+'">'+a[chart_type].title+'</h3><div id="'+chart_type+'"></div>'):a[chart_type][chart_variant].graph&&($("#"+chart_type).append("<div id="+chart_type+"_"+chart_variant+"></div>"),b=get_sizes(chart_type),a[chart_type][chart_variant].graph.options.width=b.width,a[chart_type][chart_variant].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(chart_type+"_"+chart_variant))).draw(a[chart_type][chart_variant].graph.data,a[chart_type][chart_variant].graph.options));
    1717$("#loading").remove();$("#accordion").accordion({active:!1,collapsible:!0});null!=c&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
    18 function doChart(){end_load_time=get_time();var c=new google.visualization.DataTable;c.addColumn("string","App");c.addColumn("number","Count");c=new google.visualization.DataTable;c.addColumn("string","App");c.addColumn("number","Count");c=new google.visualization.DataTable;c.addColumn("string","App");c.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetStats",function(a){start_graph_time=end_get_time=get_time();count=0;for(key in a)if(!key.startsWith("debug"))for(key2 in a[key])count++;
    19 max_graph=3*count;obj=[];for(distro in a)if(distro.startsWith("debug"))"debug_query_time"==distro&&(query_time=a[distro]),"debug_keep_alive"==distro&&(keep_alive=a[distro]);else for(sabor in a[distro])for(titles=["Top apps este mes","Top apps ultimo mes","Top apps penultimo mes"],divname="chart_"+distro+"_"+sabor,$("#accordion").append("<h3>Distro "+distro+"("+sabor+")</h3>"),$("#accordion").append('<div class="'+divname+'"></h3>'),i=0;3>i;i++){$("div."+divname).append('<div id="'+divname+i+'"></div>');
    20 k=0;var b=new google.visualization.DataTable;b.addColumn("string","App");b.addColumn("number","Count");for($.each(a[distro][sabor][i][0],function(a,c){b.addRow([a,parseInt(c)]);k++});10>k;)b.addRow(["",0]),k++;obj.push(b);titles[i]=titles[i]+" (Total clients: "+a[distro][sabor][i][1].nclients+")";drawChart(obj[obj.length-1],titles[i],divname+i)}end_graph_time=get_time();print_stats(end_graph_time,query_time)})}num_ready=0;
    21 function ready_charts(){num_ready++;num_ready==max_graph&&($("#accordion>#loading").remove(),$("#accordion").accordion({active:!1,collapsible:!0}))}
     18function doChart(c){c=void 0===c?"":c;end_load_time=get_time();var a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(c);""==c?(url="./GetStats",limit=10):(url="./GetLliurexStats",
     19limit=1E3);$.getJSON(url,function(a){start_graph_time=end_get_time=get_time();count=0;for(key in a)if(!key.startsWith("debug"))for(key2 in a[key])count++;max_graph=3*count;obj=[];for(distro in a)if(distro.startsWith("debug"))"debug_query_time"==distro&&(query_time=a[distro]),"debug_keep_alive"==distro&&(keep_alive=a[distro]);else for(sabor in a[distro])for(titles=["Top apps este mes","Top apps ultimo mes","Top apps penultimo mes"],divname="chart_"+distro+"_"+sabor,$("#accordion").append("<h3>Distro "+
     20distro+"("+sabor+")</h3>"),$("#accordion").append('<div class="'+divname+'"></h3>'),i=0;3>i;i++){$("div."+divname).append('<div id="'+divname+i+'"></div>');k=0;var b=new google.visualization.DataTable;b.addColumn("string","App");b.addColumn("number","Count");for($.each(a[distro][sabor][i][0],function(a,c){b.addRow([a,parseInt(c)]);k++});10>k;)b.addRow(["",0]),k++;obj.push(b);titles[i]=titles[i]+" (Total clients: "+a[distro][sabor][i][1].nclients+")";drawChart(obj[obj.length-1],titles[i],divname+i,
     21k)}end_graph_time=get_time();print_stats(end_graph_time,query_time)})}num_ready=0;function ready_charts(){num_ready++;num_ready==max_graph&&($("#accordion>#loading").remove(),$("#accordion").accordion({active:!1,collapsible:!0}))}
    2222function print_stats(c,a){c=void 0===c?0:c;a=void 0===a?0:a;$("#stats_box").append('<span class="stats">Load time: '+((end_load_time-start_load_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Get time: '+parseFloat((end_get_time-start_get_time)/1E3-a).toFixed(3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Graph time: '+((c-start_graph_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Query time: '+parseFloat(a).toFixed(3).toString()+
    2323" sec</span>");$("#stats_box").append('<span class="stats">Updated: '+keep_alive.toString()+"</span>")}function get_time(){return Date.now?Date.now():(new Date).getTime()}var start_graph_time=0,end_graph_time=0,start_load_time=get_time(),end_load_time=0,start_get_time=0,end_get_time=0,query_time="",keep_alive="";
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/reports.php

    r6868 r6876  
    1717$klein->respond('GET','/ShowExtendedStats',call_show_extended_stats());
    1818$klein->respond('GET','/GetExtendedStats',call_get_extended_stats());
     19$klein->respond('GET','/GetLliurexStats',call_get_lliurex_stats());
     20$klein->respond('GET','/ShowLliurexStats',call_show_lliurex_stats());
    1921$klein->respond('GET','/SystemStats',call_get_system_stats());
    2022$klein->respond('GET','/ShowSystemStats',call_show_system_stats());
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/whitelist.css

    r6850 r6876  
    11html,body,#nonwhitelist,#unknown_state_whitelist,#inwhitelist,span,#btn_right,#btn_left {
    22    height: 100%;
     3}
     4#loading{
     5    width: 95%;
     6    height: 90%;
     7    margin: auto;
     8    background:url(load.gif) center center no-repeat;
    39}
    410html,body,#header,#configure_whitelist,select,span,#btn_right,#btn_left{
     
    3440    height: 100%;
    3541    display: grid;
    36     grid-template-rows: 2em;
     42    grid-template-rows: 10fr 10fr 80fr;
    3743    text-align: center;
    3844}
     
    6167    text-decoration: underline;
    6268}
     69.filter{
     70    margin-top: 10px;
     71    font-size: 3ex;
     72    font-style: italic;
     73    border: 1px;
     74    display: inline-flex;
     75}
    6376select{
    6477    margin-top: 10px;
     
    8396    font-size: 4ex;
    8497}
     98textarea{
     99    float:right;
     100    width:100%;
     101    margin-left: 10px;
     102    resize: none;
     103    height: 3ex;
     104}
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/whitelist.js

    r6868 r6876  
    11function put_elements(data){
     2    $('#loading').remove()
     3    $('#send').show()
     4    $('#configure_whitelist').show()
    25    var items = data
    36    if (items != undefined){
     
    7275
    7376function get_dbitems(){
     77    $('#configure_whitelist').hide()
     78    $('#send').hide()
     79    $('body').append('<div id="loading"></div>')
    7480    $.getJSON('GetWhitelistItems',function(data){
    7581        put_elements(data)
     
    8187}
    8288
    83 
     89function filter(elem){
     90    var value=$(this).val().trim().toLowerCase()
     91    var dofilter = false
     92    var opts
     93    if (value != ''){
     94        dofilter = true
     95    }
     96    opts=$(this).parent().next().find('option')
     97    for (var i=0;i<opts.length;i++){
     98        var show = true
     99        if (dofilter){
     100            show = opts[i].value.toLowerCase().includes(value)
     101        }
     102        if (show){
     103            $(opts[i]).show()
     104        }else{
     105            $(opts[i]).hide()
     106        }
     107    }
     108}
    84109function put_triggers(){
    85110    $('#btnleft_to_left').click(function(){move_to('center','left')})
     
    88113    $('#btnright_to_center').click(function(){move_to('right','center')})
    89114    $('#send_btn').click(send_items)
     115    $('.filter>textarea').on("change keyup paste",filter)
    90116}
    91117
Note: See TracChangeset for help on using the changeset viewer.