Skip to content

Commit d7226c3

Browse files
committed
UniFi API browser 2.0.12
- updated custom menu example in README - added support for firewall rules, based on PR #81 contributed by @chrishas35
1 parent 41d8f73 commit d7226c3

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,35 +147,31 @@ $collections = array_merge($collections, [
147147
'label' => 'Custom Menu', // length of this string is limited due to dropdown menu width
148148
'options' => [
149149
[
150-
'type' => 'collection', // either collection or divider
150+
'type' => 'collection', // either 'collection' or 'divider'
151151
'label' => 'hourly site stats past 24 hours', // string that is displayed in the dropdown menu
152-
'method' => 'stat_hourly_site', // the method/function in the API client class that is called
152+
'method' => 'stat_hourly_site', // name of the method/function in the API client class that is called
153153
'params' => [(time() - (24 * 60 *60)) * 1000, time() * 1000], // an array containing the parameters that are passed to the method/function
154-
'key' => 'custom_0' // unique key for this menu option, may be required for future versions
155154
],
156155
[
157156
'type' => 'collection',
158157
'label' => 'daily site stats past 31 days',
159158
'method' => 'stat_daily_site',
160159
'params' => [(time() - (31 * 24 * 60 *60)) * 1000, time() * 1000],
161-
'key' => 'custom_1'
162160
],
163161
[
164162
'type' => 'divider', // dividers have no other properties
165163
],
166164
[
167165
'type' => 'collection',
168166
'label' => 'enable the site LEDs',
169-
'method' => 'site_leds', // don't go wild when adding such calls, this example is simply to show the flexibility
170-
'params' => [true],
171-
'key' => 'custom_2'
167+
'method' => 'site_leds', // don't go too wild when adding such calls, this example is simply to show the flexibility
168+
'params' => [true]
172169
],
173170
[
174171
'type' => 'collection',
175172
'label' => 'disable the site LEDs',
176-
'method' => 'site_leds', // don't go wild when adding such calls, this example is simply to show the flexibility
177-
'params' => [false],
178-
'key' => 'custom_3'
173+
'method' => 'site_leds', // don't go too wild when adding such calls, this example is simply to show the flexibility
174+
'params' => [false]
179175
],
180176
],
181177
],

collections.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*
1414
* NOTE:
1515
* - do not modify this file, instead add a custom sub menu to the config.php file
16-
* - take care to use correct values for the "key" properties (reserved for later use)
1716
* - a valid value for params looks like this:
1817
* [true, true, 'no'] (note the quotes surrounding strings)
1918
*/
@@ -92,8 +91,7 @@
9291
'type' => 'collection', // or divider
9392
'label' => 'list network configuration',
9493
'method' => 'list_networkconf',
95-
'params' => [],
96-
'key' => 'configuration_9'
94+
'params' => []
9795
],
9896
[
9997
'type' => 'collection', // or divider
@@ -107,6 +105,12 @@
107105
'method' => 'list_portforwarding',
108106
'params' => []
109107
],
108+
[
109+
'type' => 'collection', // or divider
110+
'label' => 'list firewall rules',
111+
'method' => 'list_firewallrules',
112+
'params' => []
113+
],
110114
[
111115
'type' => 'collection', // or divider
112116
'label' => 'list firewall groups',
@@ -340,8 +344,7 @@
340344
'type' => 'collection', // or divider
341345
'label' => '5 minutes site dashboard metrics',
342346
'method' => 'list_dashboard',
343-
'params' => [true],
344-
'key' => 'stats_10'
347+
'params' => [true]
345348
],
346349
[
347350
'type' => 'collection', // or divider

common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* with this package in the file LICENSE.md
88
*
99
*/
10-
define('TOOL_VERSION', '2.0.11');
10+
define('TOOL_VERSION', '2.0.12');
1111

1212
/**
1313
* gather some basic information for the About modal

0 commit comments

Comments
 (0)