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); curl_close($ch);
$data = json_decode($response, true); $data = json_decode($response, true);
$numResults = count($data);
// build the group array // build the group array
$gpoMap = []; // will look like: [ 'GPOName' => ['Administrator' => [...], 'vnc_admin' => [...]] ] $gpoMap = []; // will look like: [ 'GPOName' => ['Administrator' => [...], 'vnc_admin' => [...]] ]
@@ -74,21 +75,27 @@ if (isset($_GET['group'])) {
} }
} }
ksort($gpoMap, SORT_STRING | SORT_FLAG_CASE); ksort($gpoMap, SORT_STRING | SORT_FLAG_CASE);
echo '<table border="1" cellpadding="4" cellspacing="0">'; if($numResults > 0){
echo '<tr><th>GPO</th><th>Administrators</th><th>vnc_admin</th></tr>'; 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) { foreach ($gpoMap as $gpoName => $cols) {
// Remove duplicates and build commaseparated lists // Remove duplicates and build commaseparated lists
$adminGroups = implode('<br>', array_unique($cols['administrators'])); $adminGroups = implode('<br>', array_unique($cols['administrators']));
$vncGroups = implode('<br>', array_unique($cols['vnc_admin'])); $vncGroups = implode('<br>', array_unique($cols['vnc_admin']));
echo '<tr>'; echo '<tr>';
echo "<td>{$gpoName}</td>"; echo "<td>{$gpoName}</td>";
echo "<td>{$adminGroups}</td>"; echo "<td>{$adminGroups}</td>";
echo "<td>{$vncGroups}</td>"; echo "<td>{$vncGroups}</td>";
echo '</tr>'; echo '</tr>';
}
echo '</table>';
}
else{
echo 'No results found for query.<p>';
} }
echo '</table>';
} }
} else { } else {
+12 -12
View File
@@ -1,18 +1,18 @@
--- ---
# Mount GPO Share path # Mount GPO Share path
- name: Mount GPO Share path #- name: Mount GPO Share path
include_role: # include_role:
name: "cifs_mount" # name: "cifs_mount"
vars: # vars:
smb_username: "{{ ITMFG_USERNAME }}" # smb_username: "{{ ITMFG_USERNAME }}"
smb_password: "{{ ITMFG_PASSWORD }}" # smb_password: "{{ ITMFG_PASSWORD }}"
server_path: "//172.23.1.23/gpo" # server_path: "//172.23.1.23/gpo"
target_path: "{{ gpo_yaml_share }}" # target_path: "{{ gpo_yaml_share }}"
#
# create python gpo service ## create python gpo service
- name: GPO Site - python api service #- name: GPO Site - python api service
include_tasks: api.yaml # include_tasks: api.yaml
# create python gpo service # create python gpo service
- name: GPO Site - dashboard container - name: GPO Site - dashboard container