mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use Laravel url helpers to improve functionality without dns name (#10227)
* Use Laravel url helpers to improve functionality without dns name Not exhaustive... * Fix Url generated urls * Bump js version
This commit is contained in:
@@ -208,7 +208,7 @@ class Url
|
|||||||
{
|
{
|
||||||
$vars = array_merge($vars, $new_vars);
|
$vars = array_merge($vars, $new_vars);
|
||||||
|
|
||||||
$url = $vars['page'] . '/';
|
$url = url($vars['page']) . '/';
|
||||||
unset($vars['page']);
|
unset($vars['page']);
|
||||||
|
|
||||||
foreach ($vars as $var => $value) {
|
foreach ($vars as $var => $value) {
|
||||||
|
@@ -121,7 +121,7 @@ class DeviceController extends TableController
|
|||||||
return [
|
return [
|
||||||
'extra' => $this->getLabel($device),
|
'extra' => $this->getLabel($device),
|
||||||
'status' => $device->statusName(),
|
'status' => $device->statusName(),
|
||||||
'icon' => '<img src="' . $device->icon . '" title="' . pathinfo($device->icon, PATHINFO_FILENAME) . '">',
|
'icon' => '<img src="' . asset($device->icon) . '" title="' . pathinfo($device->icon, PATHINFO_FILENAME) . '">',
|
||||||
'hostname' => $this->getHostname($device),
|
'hostname' => $this->getHostname($device),
|
||||||
'metrics' => $this->getMetrics($device),
|
'metrics' => $this->getMetrics($device),
|
||||||
'hardware' => Rewrite::ciscoHardware($device),
|
'hardware' => Rewrite::ciscoHardware($device),
|
||||||
|
@@ -148,7 +148,7 @@ function submitCustomRange(frmdata) {
|
|||||||
|
|
||||||
function updateResolution(refresh)
|
function updateResolution(refresh)
|
||||||
{
|
{
|
||||||
$.post('ajax/set_resolution',
|
$.post(ajax_url + '/set_resolution',
|
||||||
{
|
{
|
||||||
width: $(window).width(),
|
width: $(window).width(),
|
||||||
height:$(window).height()
|
height:$(window).height()
|
||||||
@@ -422,7 +422,7 @@ function init_map_marker(leaflet, latlng) {
|
|||||||
function update_location(id, latlng, callback) {
|
function update_location(id, latlng, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
url: "ajax/location/" + id,
|
url: ajax_url + '/location/' + id,
|
||||||
data: {lat: latlng.lat, lng: latlng.lng}
|
data: {lat: latlng.lat, lng: latlng.lng}
|
||||||
}).success(function () {
|
}).success(function () {
|
||||||
toastr.success('Location updated');
|
toastr.success('Location updated');
|
||||||
@@ -488,7 +488,7 @@ function init_select2(selector, type, data, selected, placeholder) {
|
|||||||
placeholder: placeholder,
|
placeholder: placeholder,
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/' + type,
|
url: ajax_url + '/select/' + type,
|
||||||
delay: 150,
|
delay: 150,
|
||||||
data: data_function
|
data: data_function
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ var eventlog_grid = $("#eventlog").bootgrid({
|
|||||||
eventtype: "' . addcslashes($vars['eventtype'], '"') . '",
|
eventtype: "' . addcslashes($vars['eventtype'], '"') . '",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/eventlog"
|
url: "' . url('/ajax/table/eventlog') . '"
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -125,7 +125,7 @@ $tmp_output .= '
|
|||||||
range: "' . (isset($_POST['range']) ? mres($_POST['range']) : '') . '"
|
range: "' . (isset($_POST['range']) ? mres($_POST['range']) : '') . '"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/graylog",
|
url: "' . url('/ajax/table/graylog') . '",
|
||||||
});
|
});
|
||||||
|
|
||||||
init_select2("#stream", "graylog-streams", {}, "' . (isset($_POST['stream']) ? mres($_POST['stream']) : '') . '");
|
init_select2("#stream", "graylog-streams", {}, "' . (isset($_POST['stream']) ? mres($_POST['stream']) : '') . '");
|
||||||
|
@@ -44,7 +44,7 @@ var syslog_grid = $("#syslog").bootgrid({
|
|||||||
from: "' . addcslashes($vars['from'], '"') . '",
|
from: "' . addcslashes($vars['from'], '"') . '",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/syslog"
|
url: "' . url('/ajax/table/syslog') . '"
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -220,7 +220,7 @@ echo "
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'ajax/form',
|
url: '<?php echo url('/ajax/form'); ?>',
|
||||||
data: { type: "callback-statistics", state: state},
|
data: { type: "callback-statistics", state: state},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data){
|
success: function(data){
|
||||||
@@ -234,7 +234,7 @@ echo "
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'ajax/form',
|
url: '<?php echo url('/ajax/form'); ?>',
|
||||||
data: { type: "callback-clear"},
|
data: { type: "callback-clear"},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
@@ -25,7 +25,7 @@ $no_refresh = true;
|
|||||||
var grid = $("#customers").bootgrid({
|
var grid = $("#customers").bootgrid({
|
||||||
ajax: true,
|
ajax: true,
|
||||||
rowCount: [50, 100, 250, -1],
|
rowCount: [50, 100, 250, -1],
|
||||||
url: "ajax/table/customers",
|
url: "<?php echo url('/ajax/table/customers'); ?>",
|
||||||
formatters: {
|
formatters: {
|
||||||
customer: function (column, row) {
|
customer: function (column, row) {
|
||||||
return '<strong>' + row[column.id] + '</strong>';
|
return '<strong>' + row[column.id] + '</strong>';
|
||||||
|
@@ -60,7 +60,7 @@ if ($device['os'] === 'vrp') {
|
|||||||
$('#nac-grid').bootgrid({
|
$('#nac-grid').bootgrid({
|
||||||
ajax: true,
|
ajax: true,
|
||||||
rowCount: [25, 50, 100, -1],
|
rowCount: [25, 50, 100, -1],
|
||||||
url: "ajax/table/port-nac",
|
url: "<?php echo url('/ajax/table/port-nac'); ?>",
|
||||||
post: function () {
|
post: function () {
|
||||||
return {
|
return {
|
||||||
device_id: <?php echo $device['device_id'] ?>
|
device_id: <?php echo $device['device_id'] ?>
|
||||||
|
@@ -26,7 +26,7 @@ var grid = $("#port-fdb").bootgrid({
|
|||||||
dns: $("#port-fdb").bootgrid("getColumnSettings")[4].visible
|
dns: $("#port-fdb").bootgrid("getColumnSettings")[4].visible
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/fdb-tables"
|
url: "<?php echo url('/ajax/table/fdb-tables'); ?>"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ var grid = $("#ports-fdb").bootgrid({
|
|||||||
dns: $("#ports-fdb").bootgrid("getColumnSettings")[5].visible
|
dns: $("#ports-fdb").bootgrid("getColumnSettings")[5].visible
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/fdb-tables"
|
url: "<?php echo url('/ajax/table/fdb-tables') ?>"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -343,7 +343,7 @@ if ($format == "graph") {
|
|||||||
group: '<?php echo mres($vars['group']); ?>',
|
group: '<?php echo mres($vars['group']); ?>',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/device"
|
url: "<?php echo url('/ajax/table/device') ?>"
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@@ -82,7 +82,7 @@ $pagetitle[] = 'Eventlog';
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "All Devices",
|
placeholder: "All Devices",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/device',
|
url: '<?php echo url('/ajax/select/device'); ?>',
|
||||||
delay: 200
|
delay: 200
|
||||||
}
|
}
|
||||||
})<?php echo $device_id ? ".val($device_id).trigger('change');" : ''; ?>;
|
})<?php echo $device_id ? ".val($device_id).trigger('change');" : ''; ?>;
|
||||||
@@ -95,7 +95,7 @@ $pagetitle[] = 'Eventlog';
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "All Types",
|
placeholder: "All Types",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/eventlog',
|
url: '<?php echo url('/ajax/select/eventlog'); ?>',
|
||||||
delay: 200,
|
delay: 200,
|
||||||
data: function(params) {
|
data: function(params) {
|
||||||
return {
|
return {
|
||||||
|
@@ -611,7 +611,7 @@ if (empty($vars['bare']) || $vars['bare'] == "no") {
|
|||||||
if( widget_id > 0 && widget_settings != {} ) {
|
if( widget_id > 0 && widget_settings != {} ) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
url: 'ajax/form/widget-settings/' + widget_id,
|
url: '<?php echo url('/ajax/form/widget-settings/'); ?>' + widget_id,
|
||||||
data: {settings: widget_settings},
|
data: {settings: widget_settings},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
@@ -642,7 +642,7 @@ if (empty($vars['bare']) || $vars['bare'] == "no") {
|
|||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'ajax/dash/' + data_type,
|
url: ajax_url + '/dash/' + data_type,
|
||||||
data: {
|
data: {
|
||||||
id: id,
|
id: id,
|
||||||
dimensions: {x:$widget_body.width(), y:$widget_body.height()},
|
dimensions: {x:$widget_body.width(), y:$widget_body.height()},
|
||||||
|
@@ -122,7 +122,7 @@ echo '"'.$vars['searchPhrase'].'"+';
|
|||||||
dns: $("#fdb-search").bootgrid("getColumnSettings")[6].visible
|
dns: $("#fdb-search").bootgrid("getColumnSettings")[6].visible
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/fdb-tables"
|
url: "<?php echo url('/ajax/table/fdb-tables'); ?>"
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -147,7 +147,7 @@ $pagetitle[] = 'Syslog';
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "All Devices",
|
placeholder: "All Devices",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/device',
|
url: '<?php echo url('/ajax/select/device'); ?>',
|
||||||
delay: 200
|
delay: 200
|
||||||
}
|
}
|
||||||
})<?php echo $device_id ? ".val($device_id).trigger('change');" : ''; ?>;
|
})<?php echo $device_id ? ".val($device_id).trigger('change');" : ''; ?>;
|
||||||
@@ -160,7 +160,7 @@ $pagetitle[] = 'Syslog';
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "All Programs",
|
placeholder: "All Programs",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/syslog',
|
url: '<?php echo url('/ajax/select/syslog'); ?>',
|
||||||
delay: 200,
|
delay: 200,
|
||||||
data: function(params) {
|
data: function(params) {
|
||||||
return {
|
return {
|
||||||
@@ -180,7 +180,7 @@ $pagetitle[] = 'Syslog';
|
|||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: "All Priorities",
|
placeholder: "All Priorities",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: 'ajax/select/syslog',
|
url: '<?php echo url('/ajax/select/syslog'); ?>',
|
||||||
delay: 200,
|
delay: 200,
|
||||||
data: function(params) {
|
data: function(params) {
|
||||||
return {
|
return {
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
@extends('layouts.librenmsv1')
|
@extends('layouts.librenmsv1')
|
||||||
|
|
||||||
@section('javascript')
|
|
||||||
<script src="js/jquery.qrcode.min.js"></script>
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@@ -8,14 +8,14 @@
|
|||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@if(!LibreNMS\Config::get('favicon', false))
|
@if(!LibreNMS\Config::get('favicon', false))
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('images/apple-touch-icon.png') }}">
|
||||||
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32">
|
<link rel="icon" type="image/png" href="{{ asset('images/favicon-32x32.png') }}" sizes="32x32">
|
||||||
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16">
|
<link rel="icon" type="image/png" href="{{ asset('images/favicon-16x16.png') }}" sizes="16x16">
|
||||||
<link rel="manifest" href="images/manifest.json">
|
<link rel="manifest" href="{{ asset('images/manifest.json') }}">
|
||||||
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5">
|
<link rel="mask-icon" href="{{ asset('images/safari-pinned-tab.svg') }}" color="#5bbad5">
|
||||||
<link rel="shortcut icon" href="images/favicon.ico">
|
<link rel="shortcut icon" href="{{ asset('images/favicon.ico') }}">
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<meta name="msapplication-config" content="images/browserconfig.xml">
|
<meta name="msapplication-config" content="{{ asset('images/browserconfig.xml') }}">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
@else
|
@else
|
||||||
<link rel="shortcut icon" href="{{ LibreNMS\Config::get('favicon') }}" />
|
<link rel="shortcut icon" href="{{ LibreNMS\Config::get('favicon') }}" />
|
||||||
@@ -47,31 +47,38 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@yield('css')
|
@yield('css')
|
||||||
|
|
||||||
<script src="js/polyfill.min.js"></script>
|
<script src="{{ asset('js/polyfill.min.js') }}"></script>
|
||||||
<script src="js/jquery.min.js"></script>
|
<script src="{{ asset('js/jquery.min.js') }}"></script>
|
||||||
<script src="js/bootstrap.min.js"></script>
|
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
|
||||||
<script src="js/bootstrap-hover-dropdown.min.js"></script>
|
<script src="{{ asset('js/bootstrap-hover-dropdown.min.js') }}"></script>
|
||||||
<script src="js/bootstrap-switch.min.js"></script>
|
<script src="{{ asset('js/bootstrap-switch.min.js') }}"></script>
|
||||||
<script src="js/hogan-2.0.0.js"></script>
|
<script src="{{ asset('js/hogan-2.0.0.js') }}"></script>
|
||||||
<script src="js/jquery.cycle2.min.js"></script>
|
<script src="{{ asset('js/jquery.cycle2.min.js') }}"></script>
|
||||||
<script src="js/moment.min.js"></script>
|
<script src="{{ asset('js/moment.min.js') }}"></script>
|
||||||
<script src="js/bootstrap-datetimepicker.min.js"></script>
|
<script src="{{ asset('js/bootstrap-datetimepicker.min.js') }}"></script>
|
||||||
<script src="js/typeahead.bundle.min.js"></script>
|
<script src="{{ asset('js/typeahead.bundle.min.js') }}"></script>
|
||||||
<script src="js/jquery-ui.min.js"></script>
|
<script src="{{ asset('js/jquery-ui.min.js') }}"></script>
|
||||||
<script src="js/tagmanager.js"></script>
|
<script src="{{ asset('js/tagmanager.js') }}"></script>
|
||||||
<script src="js/mktree.js"></script>
|
<script src="{{ asset('js/mktree.js') }}"></script>
|
||||||
<script src="js/jquery.bootgrid.min.js"></script>
|
<script src="{{ asset('js/jquery.bootgrid.min.js') }}"></script>
|
||||||
<script src="js/handlebars.min.js"></script>
|
<script src="{{ asset('js/handlebars.min.js') }}"></script>
|
||||||
<script src="js/pace.min.js"></script>
|
<script src="{{ asset('js/pace.min.js') }}"></script>
|
||||||
<script src="js/qrcode.min.js"></script>
|
<script src="{{ asset('js/qrcode.min.js') }}"></script>
|
||||||
@if(LibreNMS\Config::get('enable_lazy_load', true))
|
@if(LibreNMS\Config::get('enable_lazy_load', true))
|
||||||
<script src="js/jquery.lazyload.min.js"></script>
|
<script src="{{ asset('js/jquery.lazyload.min.js') }}"></script>
|
||||||
<script src="js/lazyload.js"></script>
|
<script src="{{ asset('js/lazyload.js') }}"></script>
|
||||||
@endif
|
@endif
|
||||||
<script src="{{ asset('js/select2.min.js') }}"></script>
|
<script src="{{ asset('js/select2.min.js') }}"></script>
|
||||||
<script src="{{ asset('js/librenms.js?ver=20190123') }}"></script>
|
<script>
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var ajax_url = "{{ url('/ajax') }}";
|
||||||
|
</script>
|
||||||
|
<script src="{{ asset('js/librenms.js?ver=20190514') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
<!-- Begin
|
<!-- Begin
|
||||||
function popUp(URL)
|
function popUp(URL)
|
||||||
{
|
{
|
||||||
@@ -80,16 +87,10 @@
|
|||||||
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600');");
|
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600');");
|
||||||
}
|
}
|
||||||
// End -->
|
// End -->
|
||||||
|
|
||||||
$.ajaxSetup({
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/overlib_mini.js"></script>
|
<script type="text/javascript" src="{{ asset('js/overlib_mini.js') }}"></script>
|
||||||
<script type="text/javascript" src="js/toastr.min.js"></script>
|
<script type="text/javascript" src="{{ asset('js/toastr.min.js') }}"></script>
|
||||||
<script type="text/javascript" src="js/boot.js"></script>
|
<script type="text/javascript" src="{{ asset('js/boot.js') }}"></script>
|
||||||
@yield('javascript')
|
@yield('javascript')
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@@ -88,10 +88,10 @@
|
|||||||
locations_grid = $("#locations").bootgrid({
|
locations_grid = $("#locations").bootgrid({
|
||||||
ajax: true,
|
ajax: true,
|
||||||
rowCount: [25, 50, 100, -1],
|
rowCount: [25, 50, 100, -1],
|
||||||
url: "ajax/table/location",
|
url: "{{ url('/ajax/table/location') }}",
|
||||||
formatters: {
|
formatters: {
|
||||||
"location": function (column, row) {
|
"location": function (column, row) {
|
||||||
return '<a href=/devices/location=' + row.id + '>' + row.location + '</a>';
|
return '<a href="{{ url('/devices') }}/location=' + row.id + '">' + row.location + '</a>';
|
||||||
},
|
},
|
||||||
"coordinates": function (column, row) {
|
"coordinates": function (column, row) {
|
||||||
var text;
|
var text;
|
||||||
|
@@ -22,6 +22,6 @@
|
|||||||
eventtype: "{{ $eventtype }}"
|
eventtype: "{{ $eventtype }}"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/eventlog"
|
url: "{{ url('/ajax/table/eventlog') }}"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@@ -34,6 +34,6 @@
|
|||||||
range: "{{ $range }}"
|
range: "{{ $range }}"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/graylog"
|
url: "{{ url('/ajax/table/graylog') }}"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@@ -23,6 +23,6 @@
|
|||||||
device: '{{ $device ?: '' }}'
|
device: '{{ $device ?: '' }}'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "ajax/table/syslog"
|
url: "{{ url('/ajax/table/syslog') }}"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user