Back to home page

EIC code displayed by LXR

 
 

    


Warning, /iDDS/monitor/data/js/pages/dashboards/dashboard2.js.back is written in an unsupported language. File is not indexed.

0001 /*
0002 Template Name: Admin Pro Admin
0003 Author: Wrappixel
0004 Email: niravjoshi87@gmail.com
0005 File: js
0006 */
0007 $(function () {
0008     "use strict";
0009     // ============================================================== 
0010     // Newsletter
0011     // ============================================================== 
0012 
0013     function draw_chartist(group_types, group_types_name, chartist_name, labels, num_monthly) {
0014         
0015 
0016         $(group_types_name).empty();
0017         $.each(group_types, function(i) {
0018             var new_li = '<li class="ps-3"><h5><i class="fa fa-circle me-1 ';
0019             new_li += 'view_chartist_lable_' + i + '"></i>' + group_types[i]+ '</h5>';
0020             new_li += '</li>';
0021             $(group_types_name).append(new_li);
0022         });
0023 
0024         new Chartist.Line(chartist_name, {
0025             labels: labels,
0026             series: num_monthly
0027             },
0028             {top: 0,
0029              low: 1,
0030              showPoint: true,
0031              fullWidth: true,
0032              plugins: [
0033                  Chartist.plugins.tooltip()
0034              ],
0035             axisY: {
0036                 labelInterpolationFnc: function (value) {
0037                     // return (value / 1) + 'k';
0038                     return value;
0039                 }
0040             },
0041             showArea: false
0042         });
0043     }
0044 
0045     function draw_chartist_status(data) {
0046 
0047         // alert(Object.keys(data.month_acc_status.Total));
0048         var labels = Object.keys(data.month_acc_status.Total);
0049         var statuses = Object.keys(data.month_acc_status);
0050         var num_monthly = Object.keys(data.month_acc_status).map(function(key){
0051             var mnum_monthly_status = Object.keys(data.month_acc_status[key]).map(function(key1){
0052                 return data.month_acc_status[key][key1];
0053             });
0054             return mnum_monthly_status;
0055         });
0056 
0057         draw_chartist(statuses, '#view_chartist_labels_status', '#view_chartist_status', labels, num_monthly);
0058     }
0059 
0060     function draw_chartist_files(data) {
0061 
0062         var labels = Object.keys(data.month_acc_processed_files.Total);
0063         var statuses = Object.keys(data.month_acc_processed_files);
0064         var num_monthly = Object.keys(data.month_acc_processed_files).map(function(key){
0065             var mnum_monthly_status = Object.keys(data.month_acc_processed_files[key]).map(function(key1){
0066                 return Math.round(data.month_acc_processed_files[key][key1]/1000);
0067                 // return data.month_acc_processed_files[key][key1];
0068             });
0069             return mnum_monthly_status;
0070         });
0071 
0072         draw_chartist(statuses, '#view_chartist_labels_files', '#view_chartist_files', labels, num_monthly);
0073     }
0074 
0075     function draw_chartist_bytes(data) {
0076 
0077         // alert(Object.keys(data.month_acc_status.Total));
0078         var labels = Object.keys(data.month_acc_processed_bytes.Total);
0079         var statuses = Object.keys(data.month_acc_processed_bytes);
0080         var num_monthly = Object.keys(data.month_acc_processed_bytes).map(function(key){
0081             var mnum_monthly_status = Object.keys(data.month_acc_processed_bytes[key]).map(function(key1){
0082                 var n_value = data.month_acc_processed_bytes[key][key1];
0083                 n_value = Math.round(n_value/1000/1000/1000/1000);
0084                 return n_value;
0085             });
0086             return mnum_monthly_status;
0087         });
0088 
0089         draw_chartist(statuses, '#view_chartist_labels_bytes', '#view_chartist_bytes', labels, num_monthly);
0090     }
0091 
0092     function draw_chartist_status_type(data) {
0093 
0094         var labels = Object.keys(data.month_acc_status.Total);
0095         var g_types = Object.keys(data.month_acc_status_dict_by_type);
0096 
0097         var select_option = $("#view_chartist_labels_type_select option").filter(':selected').text();
0098         select_option = $.trim(select_option);
0099 
0100         $("#view_chartist_labels_type_select").empty();
0101         if (select_option === 'All'){
0102             var all_option = '<option value="All" selected="selected">All</option>';
0103             $("#view_chartist_labels_type_select").append(all_option);
0104         } else {
0105             var all_option = '<option value="All">All</option>';
0106             $("#view_chartist_labels_type_select").append(all_option);
0107         }
0108         $.each(g_types, function(i) {
0109             if (select_option === g_types[i]){
0110                 var new_opt = '<option value="' + g_types[i] + '" selected="selected">' + g_types[i] + '</option>';
0111                 $("#view_chartist_labels_type_select").append(new_opt);
0112             } else {
0113                 var new_opt = '<option value="' + g_types[i] + '">' + g_types[i] + '</option>';
0114                 $("#view_chartist_labels_type_select").append(new_opt);
0115             }
0116         });
0117 
0118         if (select_option === 'All'){
0119             var num_monthly = Object.keys(data.month_acc_status_dict_by_type).map(function(key){
0120                 var mnum_monthly_status = Object.keys(data.month_acc_status_dict_by_type[key].Total).map(function(key1){
0121                     return data.month_acc_status_dict_by_type[key].Total[key1];
0122                 });
0123                 return mnum_monthly_status;
0124             });
0125             draw_chartist(g_types, '#view_chartist_labels_type', '#view_chartist_type', labels, num_monthly);
0126         } else {
0127             var num_monthly = Object.keys(data.month_acc_status_dict_by_type[select_option].Total).map(function(key){
0128                 return data.month_acc_status_dict_by_type[select_option].Total[key];
0129             });
0130             num_monthly = [num_monthly];
0131             draw_chartist(g_types, '#view_chartist_labels_type', '#view_chartist_type', labels, num_monthly);
0132         }
0133 
0134     }
0135 
0136     function draw_chartist_files_type(data) {
0137 
0138         var labels = Object.keys(data.month_acc_status.Total);
0139         var g_types = Object.keys(data.month_acc_processed_files_by_type);
0140         var num_monthly = Object.keys(data.month_acc_processed_files_by_type).map(function(key){
0141             var mnum_monthly_status = Object.keys(data.month_acc_processed_files_by_type[key].Total).map(function(key1){
0142                 return data.month_acc_processed_files_by_type[key].Total[key1];
0143             });
0144             return mnum_monthly_status;
0145         });
0146 
0147         draw_chartist(g_types, '#view_chartist_labels_files_type', '#view_chartist_files_type', labels, num_monthly);
0148     }
0149 
0150     function draw_chartist_bytes_type(data) {
0151 
0152         var labels = Object.keys(data.month_acc_status.Total);
0153         var g_types = Object.keys(data.month_acc_processed_bytes_by_type);
0154         var num_monthly = Object.keys(data.month_acc_processed_bytes_by_type).map(function(key){
0155             var mnum_monthly_status = Object.keys(data.month_acc_processed_bytes_by_type[key].Total).map(function(key1){
0156                 return Math.round(data.month_acc_processed_bytes_by_type[key].Total[key1]/1000/1000/1000/1000);
0157             });
0158             return mnum_monthly_status;
0159         });
0160 
0161         draw_chartist(g_types, '#view_chartist_labels_bytes_type', '#view_chartist_bytes_type', labels, num_monthly);
0162     }
0163 
0164 
0165     var sparklineLogin = function () {
0166         var iddsAPI_request = appConfig.iddsAPI_request;
0167         var iddsAPI_transform = appConfig.iddsAPI_transform;
0168         var iddsAPI_processing = appConfig.iddsAPI_processing;
0169 
0170         $.getJSON(iddsAPI_transform, function(data){ 
0171             $('#totaltransforms span').text(data.total);
0172             var month_transforms = Object.keys(data.month_status.Total).map(function(key){
0173                 return data.month_status.Total[key];
0174             });
0175             $('#totaltransformslinedash').sparkline(month_transforms, {
0176                 type: 'bar',
0177                 height: '30',
0178                 barWidth: '4',
0179                 resize: true,
0180                 barSpacing: '5',
0181                 barColor: '#7460ee'
0182             });
0183 
0184             $('#totalfiles span').text(data.total_files);
0185             var month_files = Object.keys(data.month_processed_files.Total).map(function(key){
0186                 return data.month_processed_files.Total[key];
0187             });
0188             $('#totalfileslinedash').sparkline(month_files, {
0189                 type: 'bar',
0190                 height: '30',
0191                 barWidth: '4',
0192                 resize: true,
0193                 barSpacing: '5',
0194                 barColor: '#7460ee'
0195             });
0196 
0197             $('#totalbytes span').text(Math.round(data.total_bytes/1000/1000/1000/1000));
0198             var month_bytes = Object.keys(data.month_processed_bytes.Total).map(function(key){
0199                 return data.month_processed_bytes.Total[key];
0200             });
0201             $('#totalbyteslinedash').sparkline(month_bytes, {
0202                 type: 'bar',
0203                 height: '30',
0204                 barWidth: '4',
0205                 resize: true,
0206                 barSpacing: '5',
0207                 barColor: '#7460ee'
0208             });
0209 
0210             draw_chartist_status(data);
0211             draw_chartist_files(data);
0212             draw_chartist_bytes(data);
0213             draw_chartist_status_type(data);
0214             draw_chartist_files_type(data);
0215             draw_chartist_bytes_type(data);
0216         });
0217 
0218     }
0219 
0220     var sparkResize;
0221     $(window).on("resize", function (e) {
0222         clearTimeout(sparkResize);
0223         sparkResize = setTimeout(sparklineLogin, 500);
0224     });
0225     sparklineLogin();
0226 
0227     $("select").on("change", function() {
0228         // alert( "Handler for .change() called." );
0229         sparklineLogin();
0230     });
0231 });
0232 
0233