librenms/routes/web.php
Tony Murray 1a60c44eb0
Device groups rewrite (#10346)
* Device Groups rewrite
Updated web ui
Static or dynamic groups allowed
Alert rule query builder
Translation support
Permissions support

* cleanup, make relationship save, and validate it

* builder WIP

* rules builder and rules saving/loading

* Parse query builder to Laravel Fluent query

* Upgrade existing groups when editing.
Properly update only dynamic groups when polling.

* remove unused old code
Update API and other places to use Eloquent

* debug output in poller restored

* Fix up some things
creating static
improved validation
fix js error on creation
Fix static groups in polling

* hide pattern for static group

* Implement authorization
Use in the menu too

* update schema

* fix rollback

* Don't abort on invalid queries

* fixes to query builder

* add test data, looks like macros aren't handled (omitted them because groups don't use them generally)

* Add macro support for QueryBuilderFluentParser

* add test for macro that accepts value

* More space in forms
Retain rules when converted to static
no duplicate names allowed

* Better error feedback
Update related devices on save

* Add button icon

* format

* update docs

* fix tests

* Fix some QueryBuilderFluentParser issues with OR
updated/more test data

* Show device groups runtime
fix querybuilder.json format

* Store table joins in the rules to minimize polling time
Update group joins in daily.sh (and when they are saved)

* Update daily.php

* Add units to time
2019-06-19 16:01:53 -05:00

127 lines
5.5 KiB
PHP

<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// Auth
Auth::routes();
// WebUI
Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
// Test
Route::get('/laravel', function () {
return view('laravel');
});
// pages
Route::resource('device-groups', 'DeviceGroupController');
Route::get('locations', 'LocationController@index');
Route::resource('preferences', 'UserPreferencesController', ['only' => ['index', 'store']]);
Route::resource('users', 'UserController');
// old route redirects
Route::permanentRedirect('poll-log', 'pollers/tab=log/');
// Two Factor Auth
Route::group(['prefix' => '2fa', 'namespace' => 'Auth'], function () {
Route::get('', 'TwoFactorController@showTwoFactorForm')->name('2fa.form');
Route::post('', 'TwoFactorController@verifyTwoFactor')->name('2fa.verify');
Route::post('add', 'TwoFactorController@create')->name('2fa.add');
Route::post('cancel', 'TwoFactorController@cancelAdd')->name('2fa.cancel');
Route::post('remove', 'TwoFactorController@destroy')->name('2fa.remove');
Route::post('{user}/unlock', 'TwoFactorManagementController@unlock')->name('2fa.unlock');
Route::delete('{user}', 'TwoFactorManagementController@destroy')->name('2fa.delete');
});
// Ajax routes
Route::group(['prefix' => 'ajax'], function () {
// page ajax controllers
Route::resource('location', 'LocationController', ['only' => ['update', 'destroy']]);
// misc ajax controllers
Route::group(['namespace' => 'Ajax'], function () {
Route::post('set_resolution', 'ResolutionController@set');
Route::get('netcmd', 'NetCommand@run');
Route::post('ripe/raw', 'RipeNccApiController@raw');
});
// form ajax handlers, perhaps should just be page controllers
Route::group(['prefix' => 'form', 'namespace' => 'Form'], function () {
Route::resource('widget-settings', 'WidgetSettingsController');
});
// js select2 data controllers
Route::group(['prefix' => 'select', 'namespace' => 'Select'], function () {
Route::get('application', 'ApplicationController');
Route::get('bill', 'BillController');
Route::get('device', 'DeviceController');
Route::get('device-field', 'DeviceFieldController');
Route::get('device-group', 'DeviceGroupController');
Route::get('eventlog', 'EventlogController');
Route::get('graph', 'GraphController');
Route::get('graph-aggregate', 'GraphAggregateController');
Route::get('graylog-streams', 'GraylogStreamsController');
Route::get('syslog', 'SyslogController');
Route::get('location', 'LocationController');
Route::get('munin', 'MuninPluginController');
Route::get('service', 'ServiceController');
Route::get('port', 'PortController');
Route::get('port-field', 'PortFieldController');
});
// jquery bootgrid data controllers
Route::group(['prefix' => 'table', 'namespace' => 'Table'], function () {
Route::post('customers', 'CustomersController');
Route::post('device', 'DeviceController');
Route::post('eventlog', 'EventlogController');
Route::post('fdb-tables', 'FdbTablesController');
Route::post('graylog', 'GraylogController');
Route::post('location', 'LocationController');
Route::post('port-nac', 'PortNacController');
Route::post('syslog', 'SyslogController');
});
// dashboard widgets
Route::group(['prefix' => 'dash', 'namespace' => 'Widgets'], function () {
Route::post('alerts', 'AlertsController');
Route::post('availability-map', 'AvailabilityMapController');
Route::post('component-status', 'ComponentStatusController');
Route::post('device-summary-horiz', 'DeviceSummaryHorizController');
Route::post('device-summary-vert', 'DeviceSummaryVertController');
Route::post('eventlog', 'EventlogController');
Route::post('generic-graph', 'GraphController');
Route::post('generic-image', 'ImageController');
Route::post('globe', 'GlobeController');
Route::post('graylog', 'GraylogController');
Route::post('placeholder', 'PlaceholderController');
Route::post('notes', 'NotesController');
Route::post('server-stats', 'ServerStatsController');
Route::post('syslog', 'SyslogController');
Route::post('top-devices', 'TopDevicesController');
Route::post('top-interfaces', 'TopInterfacesController');
Route::post('worldmap', 'WorldMapController');
});
});
// demo helper
Route::permanentRedirect('demo', '/');
// blank page, dummy page for external code using Laravel::bootWeb()
Route::any('/blank', function () {
return '';
});
// Legacy routes
Route::any('/{path?}', 'LegacyController@index')
->where('path', '^((?!_debugbar).)*');
});