add result count and logic for no results

This commit is contained in:
2025-11-11 17:45:34 -08:00
parent dac5ef2983
commit 93d6100293
2 changed files with 31 additions and 24 deletions
+19 -12
View File
@@ -45,6 +45,7 @@ if (isset($_GET['group'])) {
}
curl_close($ch);
$data = json_decode($response, true);
$numResults = count($data);
// build the group array
$gpoMap = []; // will look like: [ 'GPOName' => ['Administrator' => [...], 'vnc_admin' => [...]] ]
@@ -74,21 +75,27 @@ if (isset($_GET['group'])) {
}
}
ksort($gpoMap, SORT_STRING | SORT_FLAG_CASE);
echo '<table border="1" cellpadding="4" cellspacing="0">';
echo '<tr><th>GPO</th><th>Administrators</th><th>vnc_admin</th></tr>';
if($numResults > 0){
echo 'Total results: '.$numResults.'<br>';
echo '<table border="1" cellpadding="4" cellspacing="0">';
echo '<tr><th>GPO</th><th>Administrators</th><th>vnc_admin</th></tr>';
foreach ($gpoMap as $gpoName => $cols) {
// Remove duplicates and build commaseparated lists
$adminGroups = implode('<br>', array_unique($cols['administrators']));
$vncGroups = implode('<br>', array_unique($cols['vnc_admin']));
foreach ($gpoMap as $gpoName => $cols) {
// Remove duplicates and build commaseparated lists
$adminGroups = implode('<br>', array_unique($cols['administrators']));
$vncGroups = implode('<br>', array_unique($cols['vnc_admin']));
echo '<tr>';
echo "<td>{$gpoName}</td>";
echo "<td>{$adminGroups}</td>";
echo "<td>{$vncGroups}</td>";
echo '</tr>';
echo '<tr>';
echo "<td>{$gpoName}</td>";
echo "<td>{$adminGroups}</td>";
echo "<td>{$vncGroups}</td>";
echo '</tr>';
}
echo '</table>';
}
else{
echo 'No results found for query.<p>';
}
echo '</table>';
}
} else {
+12 -12
View File
@@ -1,18 +1,18 @@
---
# Mount GPO Share path
- name: Mount GPO Share path
include_role:
name: "cifs_mount"
vars:
smb_username: "{{ ITMFG_USERNAME }}"
smb_password: "{{ ITMFG_PASSWORD }}"
server_path: "//172.23.1.23/gpo"
target_path: "{{ gpo_yaml_share }}"
# create python gpo service
- name: GPO Site - python api service
include_tasks: api.yaml
#- name: Mount GPO Share path
# include_role:
# name: "cifs_mount"
# vars:
# smb_username: "{{ ITMFG_USERNAME }}"
# smb_password: "{{ ITMFG_PASSWORD }}"
# server_path: "//172.23.1.23/gpo"
# target_path: "{{ gpo_yaml_share }}"
#
## create python gpo service
#- name: GPO Site - python api service
# include_tasks: api.yaml
# create python gpo service
- name: GPO Site - dashboard container