Sha256: bb205bfca830ecb5546c9bf158681bc8104f8ea214f325dd325d11b597541623

Contents?: true

Size: 1.86 KB

Versions: 18

Compression:

Stored size: 1.86 KB

Contents

// When document is ready
jQuery(document).ready(function() {

  // Prepare for setup the datatable.
  var dataTableOptions = {
    "sAjaxSource": sAjaxSource,
    "bSort": true,
    "aaSorting": [[1, 'desc']],
    "bAutoWidth": false,
    "aoColumns": [
        { "sWidth": "5%"},              // Id
        { "sWidth": "15%"},             // Started At
        { "sWidth": "10%"},             // Machine Runner Id
        { "sWidth": "12%"},             // Server Name
        { "sWidth": "10%"},             // Pid
        { "sWidth": "10%"},             // Status
        { "sWidth": "25%"},             // Latest Commit
        { "sWidth": "10%"},             // Deployment Tag
    ],
    "fnInitComplete" : function() {
      initPageSelect();
      setPageOrder();
    },
    "fnServerData": function ( sSource, aoData, fnCallback ) {
      _.each(jQuery('.datatable_variable').serializeArray(), function(dv) { aoData.push(dv); });
      jQuery.getJSON( sSource, aoData, function (json) {
        fnCallback(json);
        initPaging();
        addTitles();
      });
    },
    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
      colorizationStatus(nRow, aData);
      return nRow;
    },
    "sDom": "Rlfrtip"
  };

   // Setup the datatable.
  jQuery('#datatable').addDataTable(dataTableOptions);
});

function setPageOrder(){
  jQuery('#datatable').dataTable().fnSort([ [1,'desc'] ]);
}

// Function that changes the color of the job status
function colorizationStatus(nRow, aData) {
  jQuery('td:nth-child(6)', nRow).wrapInner('<div class="">');
  switch(aData[5]) {
    case 'Running':
      jQuery('td:nth-child(6) div', nRow).addClass('running');
      break;
    case 'Winding Down':
      jQuery('td:nth-child(6) div', nRow).addClass('winding-down');
      break;
    case 'Dead':
      jQuery('td:nth-child(6) div', nRow).addClass('dead');
      break;
  }
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
naf-2.1.13 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.12 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.11 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.10 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.9 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.8 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.6 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.5 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.4 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.3 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.2 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.1 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.1.0 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.0.4 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.0.3 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.0.2 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.0.1 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js
naf-2.0.0 app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js