From: Nicolas Boisselier Date: Tue, 28 Jun 2016 11:49:53 +0000 (+0100) Subject: no buttons when not a table X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=da237126d9a14bdffe07cac83873f7515d4cf543;p=nb.git no buttons when not a table --- diff --git a/etc/dbs/ui.php b/etc/dbs/ui.php index fa9e3df0..b2c4518c 100644 --- a/etc/dbs/ui.php +++ b/etc/dbs/ui.php @@ -145,7 +145,7 @@ $CONF['_ui'] = array( }, ), - 'network_ips' => array('sql' => "SELECT (SELECT id FROM network WHERE network <>'' AND network IS NOT NULL AND cidr_range(network,ip) ORDER BY hidden LIMIT 1) as idnetwork,code,network,iddc,count(*) as count FROM view_ip_detail JOIN network ON idnetwork=network.id GROUP BY idnetwork HAVING idnetwork IS NOT NULL ORDER BY count DESC"), + 'network_ips' => array('sql' => "SELECT id as idnetwork,code,network,iddc,count(*) as count FROM network n JOIN view_ip ON cidr_range(network,ip) WHERE n.network IS NOT NULL AND n.hidden=0 GROUP BY n.id" ), 'view_puppet_error' => array('sql' => "SELECT idnode ,idcompany ,iddc ,value as last_run FROM fact JOIN node ON id=idnode WHERE name='last_run' AND substr(value,1,10) <='".date('Y-m-d', strtotime('-3 days'))."'"), 'view_backup_error' => array('sql' => "SELECT idnode,idcompany,iddc,server,max(backup.date) as date FROM backup JOIN node ON id=idnode WHERE NOT EXISTS (SELECT 1 FROM node_decommission nd WHERE nd.id=node.id) GROUP BY idnode HAVING date <= '".date('Y-m-d', strtotime('-2 days'))."' ORDER BY backup.date") diff --git a/lib/php/db/table.php b/lib/php/db/table.php index b3c144cc..e0405c2b 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -651,6 +651,7 @@ Class Table extends nb { public function rows(&$opt=array(),$opt_by_val=null) { + if (empty($this->type) or $this->type != 'table') $this->pset('buttons','0');; if ($opt_by_val !== null) $opt = $opt_by_val; $format = $this->p('format');