Display a message if no Group is found #1796

Merged
merged 3 commits into from Aug 30, 2015

Projects

None yet

3 participants

@arjitc
Contributor
arjitc commented Aug 29, 2015
@arjitc arjitc Display a message if no Group is found
35c7c6a
@laf laf commented on an outdated diff Aug 29, 2015
html/pages/device-groups.inc.php
- echo '</td>';
- echo '</tr>';
-}
-
+ foreach (GetDeviceGroups() as $group) {
+ echo '<tr id="row_'.$group['id'].'">';
+ echo '<td>'.$group['name'].'</td>';
+ echo '<td>'.$group['desc'].'</td>';
+ echo '<td>'.$group['pattern'].'</td>';
+ echo '<td>';
+ echo "<button type='button' class='btn btn-primary btn-sm' aria-label='Edit' data-toggle='modal' data-target='#create-group' data-group_id='".$group['id']."' name='edit-device-group'><span class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button> ";
+ echo "<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-group_id='".$group['id']."' name='delete-device-group'><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></button>";
+ echo '</td>';
+ echo '</tr>';
+ }
+} else { //if $group_count_check is empty, aka no group found, then display a message to the user.
@laf
laf Aug 29, 2015 Member

Can you update this to:

}
else {

@laf laf commented on an outdated diff Aug 29, 2015
html/pages/device-groups.inc.php
echo '</tbody></table></div>';
-echo "<button type='button' class='btn btn-primary btn-sm' aria-label='Add' data-toggle='modal' data-target='#create-group' data-group_id='' name='create-device-group'>Create new Group</button> ";
+
+if(!empty($group_count_check)) { //display create new node group when $group_count_check has a value so that the user can define more groups in the future.
+echo "<hr>";
@laf
laf Aug 29, 2015 Member

Need to indent line 31 + 32 with 4 spaces please.

@laf
Member
laf commented Aug 29, 2015

@arjitc looks good to me apart from those couple of coding style updates to be standard.

@arjitc arjitc Fixed indents and coding style.
6b9315b
@arjitc
Contributor
arjitc commented Aug 29, 2015

@laf fixed :)

@arjitc arjitc Updated indents, pulled Line #24 into the if { }
6febdbe
@laf laf merged commit 607912c into librenms:master Aug 30, 2015

2 checks passed

Auto-Deploy Build finished.
Details
Scrutinizer No new issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment