<commit_before>/*******************************************************************************/
// File name: custom_dashboard.js
// Description: Plots all the graphs for dashboard landing page.
//------------------Configuration functions--------------------------------------
// 1) chartConfig_Bar_SpaceUsage			-	Bar chart configuration for space and inodes graph
// 2) chartConfig_Line_clientConnected		-	Line chart configuration for number of clients connected
// 3) chartConfig_LineBar_CPUMemoryUsage	-	Column chart for cpu usage and line chart for memory usage
// 4) chartConfig_Area_ReadWrite			-	Area graph for disk reads and writes
// 5) chartConfig_Area_Iops					-	Area graph for IOP/s
// 6) chartConfig_HeatMap					-	HeatMap graph
//------------------ Data Loader functions--------------------------------------
// 1) db_Bar_SpaceUsage_Data(isZoom)
// 2) db_Line_connectedClients_Data(isZoom)
// 3) db_LineBar_CpuMemoryUsage_Data(isZoom)
// 4) db_Area_ReadWrite_Data(isZoom)
// 5) db_Area_Iops_Data(isZoom)
// 6) db_HeatMap_Data
/*******************************************************************************/
var spaceUsageFetchMatric = "kbytestotal kbytesfree filestotal filesfree";
var clientsConnectedFetchMatric = "num_exports";
var cpuMemoryFetchMatric = "cpu_usage cpu_total mem_MemFree mem_MemTotal";
var readWriteFetchMatric = "stats_read_bytes stats_write_bytes";
var iopsFetchmatric = "stats_open stats_connect stats_create stats_destroy stats_disconnect stats_commitrw stats_statfs stats_preprw";
var dashboardPollingInterval;

var db_Bar_SpaceUsage_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_Line_connectedClients_Data_Api_Url = "/api/get_fs_stats_for_client/";
var db_LineBar_CpuMemoryUsage_Data_Api_Url = "/api/get_fs_stats_for_server/";
var db_Area_ReadWrite_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_Area_Iops_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_HeatMap_Data_Api_Url = "/api/get_fs_ost_heatmap/";

var chartConfig_Bar_SpaceUsage = {			
    chart:{
    renderTo: '',
	marginLeft: '50',
	width: '300',
	height: '200',
	style:{ width:'100%',  height:'200', position: 'inherit' },
	marginBottom: 35,
	defaultSeriesType: 'column',
	backgroundColor: '#f9f9ff',
    },
    colors: [
		     	'#A6C56D', 
		     	'#C76560', 
		     	'#A6C56D', 
		     	'#C76560', 
		     	'#3D96AE', 
		     	'#DB843D', 
		     	'#92A8CD', 
		     	'#A47D7C', 
		     	'#B5CA92'
		     ],
    plotOptions: {
         column: {
            stacking: 'normal',
         }
    },
    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
    title:{text:'', style: { fontSize: '12px' } },
    zoomType: 'xy',
    xAxis:{ categories: ['Usage'], text: '', labels : { rotation: 310, style:{fontSize:'8px', fontWeight:'regular'} } },
    yAxis:{max:100, min:0, startOnTick:false, title:{text:'Percentage'}, plotLines: [{value: 0,width: 1, color: '#808080' }]},
    credits:{ enabled:false },
    tooltip:
    {
	    formatter: function() 
        {
	        var tooltiptext;
	        if (this.point.name) 
            { 
	            tooltiptext = ''+
		        this.point.name +': '+ this.y +'';
	        } 
            else 
            {
		        tooltiptext = ''+
		        this.x  +': '+ this.y;
	        }
	        return tooltiptext;
	    }  
     },
     labels:{ items:[{html: '',style:{left: '40px',top: '8px',color: 'black'}}]},
     series: []
};

var chartConfig_Line_clientConnected = {
    chart: {
  	    renderTo: 'container3',
	    marginLeft: '50',
  		width: '300',
  	    height: '200',
  		style:{ width:'100%',  height:'210', position: 'inherit' },
  	    marginBottom: 35,
  	    zoomType: 'xy',
  	    backgroundColor: '#f9f9ff',
    },
    title: {
       text: 'Connected Clients',
       style: { fontSize: '12px' },
    },
    xAxis: {
      categories: [],
      labels: {rotation: 310,step: 4,style:{fontSize:'8px', fontWeight:'regular'}}
    },
    yAxis: {
    	min:0, startOnTick:false,
       title: {
          text: 'Clients'
       },
       plotLines: [{
          value: 0,
          width: 1,
          color: '#808080'
       }]
    },
    tooltip: {
       formatter: function() {
                 return 'Time: '+this.x +'No. Of Exports: '+ this.y;
       }
    },
    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
    credits:{ enabled:false },
    series: [{
       name: '',
        data: []
    }],
	    plotOptions: {
series:{marker: {enabled: false}}
},

 };

var chartConfig_LineBar_CPUMemoryUsage = {
    chart: {
	 renderTo: 'avgCPUDiv',
	 marginLeft: '50',
	 width: '300',
	 height: '200',
	 style:{ width:'100%',  height:'210', position: 'inherit' },
	 marginBottom: 35,
	 zoomType: 'xy',
	 backgroundColor: '#f9f9ff',
    },
		
	    title: {
	         text: 'Server CPU and Memory',
	         style: { fontSize: '12px' },
	    },
	    xAxis: {
	    	title: 'Time (hh:mm:ss)',
	        categories: [],
	        labels: {rotation: 310,step: 2,style:{fontSize:'8px', fontWeight:'bold'}}
	    },
	    yAxis: [{
	        title: {
	            text: 'KB'
	        },
	        opposite: true,
	    },{
	        title: {
	            text: 'Percentage'
	        },
	        
	        max:100, min:0, startOnTick:false,  tickInterval: 20
	    }],
	    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
	    credits:{ enabled:false },
	    plotOptions:{series:{marker: {enabled: false}} },
	    series: [{
	        type: 'column',
	        data: [],
	        name: 'CPU Usage',
	        yAxis: 1
	    },{
	        type: 'line',
	        data: [],
	        name: 'Memory',
	    }]
};

var chartConfig_Area_ReadWrite = {
		      chart: {
		         renderTo: 'avgMemoryDiv',
		         defaultSeriesType: 'area',
		         marginLeft: '50',
		     	 width: '300',
		         height: '200',
		     	 style:{ width:'100%',  height:'210', position: 'inherit' },
		         marginRight: 0,
		         marginBottom: 35,
		         backgroundColor: '#f9f9ff',
		         zoomType: 'xy'
		      },
		      colors: [
				     	'#6285AE', 
				     	'#AE3333', 
				     	'#A6C56D', 
				     	'#C76560', 
				     	'#3D96AE', <commit_msg>Skinny bars on CPU+mem chart so that CPU actually shows up<commit_after>/*******************************************************************************/
// File name: custom_dashboard.js
// Description: Plots all the graphs for dashboard landing page.
//------------------Configuration functions--------------------------------------
// 1) chartConfig_Bar_SpaceUsage			-	Bar chart configuration for space and inodes graph
// 2) chartConfig_Line_clientConnected		-	Line chart configuration for number of clients connected
// 3) chartConfig_LineBar_CPUMemoryUsage	-	Column chart for cpu usage and line chart for memory usage
// 4) chartConfig_Area_ReadWrite			-	Area graph for disk reads and writes
// 5) chartConfig_Area_Iops					-	Area graph for IOP/s
// 6) chartConfig_HeatMap					-	HeatMap graph
//------------------ Data Loader functions--------------------------------------
// 1) db_Bar_SpaceUsage_Data(isZoom)
// 2) db_Line_connectedClients_Data(isZoom)
// 3) db_LineBar_CpuMemoryUsage_Data(isZoom)
// 4) db_Area_ReadWrite_Data(isZoom)
// 5) db_Area_Iops_Data(isZoom)
// 6) db_HeatMap_Data
/*******************************************************************************/
var spaceUsageFetchMatric = "kbytestotal kbytesfree filestotal filesfree";
var clientsConnectedFetchMatric = "num_exports";
var cpuMemoryFetchMatric = "cpu_usage cpu_total mem_MemFree mem_MemTotal";
var readWriteFetchMatric = "stats_read_bytes stats_write_bytes";
var iopsFetchmatric = "stats_open stats_connect stats_create stats_destroy stats_disconnect stats_commitrw stats_statfs stats_preprw";
var dashboardPollingInterval;

var db_Bar_SpaceUsage_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_Line_connectedClients_Data_Api_Url = "/api/get_fs_stats_for_client/";
var db_LineBar_CpuMemoryUsage_Data_Api_Url = "/api/get_fs_stats_for_server/";
var db_Area_ReadWrite_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_Area_Iops_Data_Api_Url = "/api/get_fs_stats_for_targets/";
var db_HeatMap_Data_Api_Url = "/api/get_fs_ost_heatmap/";

var chartConfig_Bar_SpaceUsage = {			
    chart:{
    renderTo: '',
	marginLeft: '50',
	width: '300',
	height: '200',
	style:{ width:'100%',  height:'200', position: 'inherit' },
	marginBottom: 35,
	defaultSeriesType: 'column',
	backgroundColor: '#f9f9ff',
    },
    colors: [
		     	'#A6C56D', 
		     	'#C76560', 
		     	'#A6C56D', 
		     	'#C76560', 
		     	'#3D96AE', 
		     	'#DB843D', 
		     	'#92A8CD', 
		     	'#A47D7C', 
		     	'#B5CA92'
		     ],
    plotOptions: {
         column: {
            stacking: 'normal',
         }
    },
    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
    title:{text:'', style: { fontSize: '12px' } },
    zoomType: 'xy',
    xAxis:{ categories: ['Usage'], text: '', labels : { rotation: 310, style:{fontSize:'8px', fontWeight:'regular'} } },
    yAxis:{max:100, min:0, startOnTick:false, title:{text:'Percentage'}, plotLines: [{value: 0,width: 1, color: '#808080' }]},
    credits:{ enabled:false },
    tooltip:
    {
	    formatter: function() 
        {
	        var tooltiptext;
	        if (this.point.name) 
            { 
	            tooltiptext = ''+
		        this.point.name +': '+ this.y +'';
	        } 
            else 
            {
		        tooltiptext = ''+
		        this.x  +': '+ this.y;
	        }
	        return tooltiptext;
	    }  
     },
     labels:{ items:[{html: '',style:{left: '40px',top: '8px',color: 'black'}}]},
     series: []
};

var chartConfig_Line_clientConnected = {
    chart: {
  	    renderTo: 'container3',
	    marginLeft: '50',
  		width: '300',
  	    height: '200',
  		style:{ width:'100%',  height:'210', position: 'inherit' },
  	    marginBottom: 35,
  	    zoomType: 'xy',
  	    backgroundColor: '#f9f9ff',
    },
    title: {
       text: 'Connected Clients',
       style: { fontSize: '12px' },
    },
    xAxis: {
      categories: [],
      labels: {rotation: 310,step: 4,style:{fontSize:'8px', fontWeight:'regular'}}
    },
    yAxis: {
    	min:0, startOnTick:false,
       title: {
          text: 'Clients'
       },
       plotLines: [{
          value: 0,
          width: 1,
          color: '#808080'
       }]
    },
    tooltip: {
       formatter: function() {
                 return 'Time: '+this.x +'No. Of Exports: '+ this.y;
       }
    },
    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
    credits:{ enabled:false },
    series: [{
       name: '',
        data: []
    }],
	    plotOptions: {
series:{marker: {enabled: false}}
},

 };

var chartConfig_LineBar_CPUMemoryUsage = {
    chart: {
	 renderTo: 'avgCPUDiv',
	 marginLeft: '50',
	 width: '300',
	 height: '200',
	 style:{ width:'100%',  height:'210', position: 'inherit' },
	 marginBottom: 35,
	 zoomType: 'xy',
	 backgroundColor: '#f9f9ff',
    },
		
	    title: {
	         text: 'Server CPU and Memory',
	         style: { fontSize: '12px' },
	    },
	    xAxis: {
	    	title: 'Time (hh:mm:ss)',
	        categories: [],
	        labels: {rotation: 310,step: 2,style:{fontSize:'8px', fontWeight:'bold'}}
	    },
	    yAxis: [{
	        title: {
	            text: 'KB'
	        },
	        opposite: true,
	    },{
	        title: {
	            text: 'Percentage'
	        },
	        
	        max:100, min:0, startOnTick:false,  tickInterval: 20
	    }],
	    legend:{enabled:false, layout: 'vertical', align: 'right', verticalAlign: 'top', x: 0, y: 10, borderWidth: 0},
	    credits:{ enabled:false },
      plotOptions:{
        series:{marker: {enabled: false}},
        column:{
          pointPadding: 0.0,
          shadow: false,
          groupPadding: 0.0,
          borderWidth: 0.0
        }
      },
	    series: [{
	        type: 'column',
	        data: [],
	        name: 'CPU Usage',
	        yAxis: 1
	    },{
	        type: 'line',
	        data: [],
	        name: 'Memory',
	    }]
};

var chartConfig_Area_ReadWrite = {
		      chart: {
		         renderTo: 'avgMemoryDiv',
		         defaultSeriesType: 'area',
		         marginLeft: '50',
		     	 width: '300',
		         height: '200',
		     	 style:{ width:'100%',  height:'210', position: 'inherit' },
		         marginRight: 0,
		         marginBottom: 35,
		         backgroundColor: '#f9f9ff',
		         zoomType: 'xy'
		      },
		      colors: [
				     	'#6285AE', 
				     	'#AE3333', 
				     	'#A6C56D', 
				     	'#C76560', 
				     	'#3D96AE', 
{'fraction_non_alphanumeric': 0.18235064427957828, 'fraction_numerical': 0.03155017571261226, 'mean_word_length': 2.371774618220116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2259295', 'n_tokens_mistral': 4739, 'n_tokens_neox': 4147, 'n_words': 878}