<commit_before><?php
require("header.php"); // Important includes
require("inc/db-magdb-open.inc.php"); // Postgres Data Sources

// Gathers clusters
$all_clusters = Array();
$all_nodes = pg_query("select \"fqdn\" as \"name\", \"castorInstance\", \"diskPool\", \"dxtx\", \"currentStatus\" "
    ."from \"vCastorFQDN\" "
    ."where \"normalStatus\" not in ('Retired', 'Decomissioned') "
    ."order by \"castorInstance\", \"diskPool\", \"machineName\";");
if ($all_nodes and pg_num_rows($all_nodes)){
    while ($row = pg_fetch_assoc($all_nodes)) {
        $all_clusters[$row['name']] = Array(
            'panel' => $row['castorInstance'],
            'cluster' => $row['diskPool'],
            'dxtx' => $row['dxtx'],
        );
        $status[$row['name']] = Array(
            $row['currentStatus'] => 'Overwatch',
        );
    }
}

// Gathers notes
$all_notes = Array();
$notes = mysql_query("select name, note from notes");
if ($notes and mysql_num_rows($notes)) {
    while ($note = mysql_fetch_assoc($notes)) {
        $all_notes[$note['name']] = $note['note'];
    }
}

// Generates main array
$results = Array();
foreach ($all_clusters as $name => $panels) {

    $group = '';
    $panel = $panels['panel'];
    $cluster = $panels['cluster'];

    $results[$group][$panel][$cluster][$name] = Array();
    if (array_key_exists($name, $all_notes)) {
        $results[$group][$panel][$cluster][$name]['note'] = $all_notes[$name];
    };
    if (nagios($name) !== Null) {
        $results[$group][$panel][$cluster][$name]['nagios'] = nagios($name);
    };
    if (array_key_exists($name, $all_clusters)) {
        $results[$group][$panel][$cluster][$name]['dxtx'] = $all_clusters[$name]['dxtx'];
    };
    if (array_key_exists($name, $status)) {
        $results[$group][$panel][$cluster][$name]['status'] = $status[$name];
    };
}

// Returns built json
echo json_encode($results);
<commit_msg>Add generation info to node mouse-over<commit_after><?php
require("header.php"); // Important includes
require("inc/db-magdb-open.inc.php"); // Postgres Data Sources

// Gathers clusters
$all_clusters = Array();
$all_nodes = pg_query("select \"fqdn\" as \"name\", \"castorInstance\", \"hardwareGroup\", \"diskPool\", \"dxtx\", \"currentStatus\" "
    ."from \"vCastorFQDN\" "
    ."where \"normalStatus\" not in ('Retired', 'Decomissioned') "
    ."order by \"castorInstance\", \"diskPool\", \"machineName\";");
if ($all_nodes and pg_num_rows($all_nodes)){
    while ($row = pg_fetch_assoc($all_nodes)) {
        $all_clusters[$row['name']] = Array(
            'panel' => $row['castorInstance'],
            'cluster' => $row['diskPool'],
            'generation' => $row['hardwareGroup'],
            'dxtx' => $row['dxtx'],
        );
        $status[$row['name']] = Array(
            $row['currentStatus'] => 'Overwatch',
        );
    }
}

// Gathers notes
$all_notes = Array();
$notes = mysql_query("select name, note from notes");
if ($notes and mysql_num_rows($notes)) {
    while ($note = mysql_fetch_assoc($notes)) {
        $all_notes[$note['name']] = $note['note'];
    }
}

// Generates main array
$results = Array();
foreach ($all_clusters as $name => $panels) {

    $group = '';
    $panel = $panels['panel'];
    $cluster = $panels['cluster'];

    $results[$group][$panel][$cluster][$name] = Array();
    if (array_key_exists($name, $all_notes)) {
        $results[$group][$panel][$cluster][$name]['note'] = $all_notes[$name];
    };
    if (nagios($name) !== Null) {
        $results[$group][$panel][$cluster][$name]['nagios'] = nagios($name);
    };
    if (array_key_exists($name, $all_clusters)) {
        $results[$group][$panel][$cluster][$name]['dxtx'] = $all_clusters[$name]['dxtx'];
    };
    if (array_key_exists($name, $all_clusters)) {
        $results[$group][$panel][$cluster][$name]['generation'] = $all_clusters[$name]['generation'];
    };
    if (array_key_exists($name, $status)) {
        $results[$group][$panel][$cluster][$name]['status'] = $status[$name];
    };
}

// Returns built json
echo json_encode($results);

{'fraction_non_alphanumeric': 0.22454500737825872, 'fraction_numerical': 0.0, 'mean_word_length': 3.65864833906071, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '3373314', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1360, 'n_words': 241}