]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/data.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 Oct 2024 08:48:57 +0000 (10:48 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 Oct 2024 08:48:57 +0000 (10:48 +0200)
etc/dbq/data.php
lib/php/nb.php

index 078ddb1120be05d9063efa19f8a7153167f18f8d..83d589cebcf903f36a9395385794d473120a9e04 100644 (file)
@@ -58,15 +58,25 @@ $DBQ['data'] = [
                                                SELECT host
                                                        ,max(updated) as last_updated
                                                        ,min(updated) as first_updated
-                                                       ,(SELECT count(path.val) FROM host_info path WHERE path.host=hi.host AND path.key LIKE 'git.%.path') as repos
+                                                       ,0 as count
                                                        ,(SELECT max(CAST(ex.val as INTEGER)) as exit FROM host_info ex
                                                                 WHERE ex.host=hi.host AND ex.key LIKE 'git.%.exit_code'
                                                        ) as exit
+                                                       ,(SELECT string_agg((name.val),' ') as repos FROM host_info name WHERE name.host=hi.host AND name.key LIKE 'git.%.name') as repos
                                                         FROM host_info hi
                                                         WHERE key LIKE 'git.%'
                                                         GROUP BY host ORDER BY last_updated DESC, host
 "),
                                        'row_parse_pre' => function(&$row,$t) {
+
+                                               #$repos = array_map(function($a){return basename($a);},explode(' ',$row['repos']));
+                                               if (isset($row['repos'])) {
+                                                       $repos = explode(' ',$row['repos']);
+                                                       sort($repos);
+                                                       $row['repos'] = join(' ',$repos);
+                                                       $row['count'] = count($repos);
+                                               }
+
                                                foreach ($row as $k=>$v) {
                                                        if (strpos($k,'updated') !== false) {
                                                                $row[$k] = preg_replace('/\..*$/','',$v);
index 5d28310cd33a7e1483c6fd0854a341f6b2578f27..be8e77b11f4741a2e6459c75fd93e9726950ea39 100644 (file)
@@ -191,7 +191,7 @@ class Nb {
         * Does what it says
         */
        public static function ar_map($return,$array,$as_hash=false) {
-       # NB 15.12.22: Depreciated use direct php arra_map functions  
+       # NB 15.12.22: Depreciated use direct php array_map functions  
        $map = $array;
        # NB 30.11.22: Does not work get error message mb_strlen does not exists 
        #bye($return);