mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix new bill search input (#11524)
* Work around select2 in a modal * Update select2
This commit is contained in:
2
html/css/select2.min.css
vendored
2
html/css/select2.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -394,7 +394,7 @@ function http_fallback(link) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function init_select2(selector, type, data, selected, placeholder) {
|
||||
function init_select2(selector, type, data, selected, placeholder, config) {
|
||||
var $select = $(selector);
|
||||
|
||||
// allow function to be assigned to pass data
|
||||
@@ -407,7 +407,7 @@ function init_select2(selector, type, data, selected, placeholder) {
|
||||
data_function = data;
|
||||
}
|
||||
|
||||
$select.select2({
|
||||
var init = {
|
||||
theme: "bootstrap",
|
||||
dropdownAutoWidth : true,
|
||||
width: "auto",
|
||||
@@ -418,7 +418,17 @@ function init_select2(selector, type, data, selected, placeholder) {
|
||||
delay: 150,
|
||||
data: data_function
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// override init values
|
||||
if (typeof config === 'object') {
|
||||
const keys = Object.keys(config)
|
||||
for (const key of keys) {
|
||||
init[key] = config[key];
|
||||
}
|
||||
}
|
||||
|
||||
$select.select2(init);
|
||||
|
||||
if (selected) {
|
||||
console.log(selected);
|
||||
|
3
html/js/select2.min.js
vendored
3
html/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,7 +6,11 @@ var ajax = new Array();
|
||||
function getInterfaceList(sel)
|
||||
{
|
||||
var deviceId = sel.options[sel.selectedIndex].value;
|
||||
document.getElementById('port_id').options.length = 0; // Empty city select box
|
||||
// Empty city select box
|
||||
var el = document.getElementById('port_id');
|
||||
if (el !== null) {
|
||||
el.options.length = 0;
|
||||
}
|
||||
if (deviceId.length>0) {
|
||||
var index = ajax.length;
|
||||
ajax[index] = new sack();
|
||||
|
@@ -43,7 +43,7 @@ if (Auth::user()->hasGlobalAdmin()) {
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)"></select>
|
||||
<script type="text/javascript">
|
||||
init_select2('#device', 'device', {}, <?php echo "{id: $port_device_id, text: '" . format_hostname($device) . "'}"; ?>);
|
||||
init_select2('#device', 'device', {}, <?php echo "{id: $port_device_id, text: '" . format_hostname($device) . "'}"; ?>, '', {dropdownParent: $('#create-bill .modal-content')});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
@else
|
||||
<link rel="shortcut icon" href="{{ LibreNMS\Config::get('favicon') }}" />
|
||||
@endif
|
||||
|
||||
|
||||
<link rel="manifest" href="{{ asset('images/manifest.json') }}">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="msapplication-config" content="{{ asset('images/browserconfig.xml') }}">
|
||||
@@ -79,7 +79,7 @@
|
||||
});
|
||||
var ajax_url = "{{ url('/ajax') }}";
|
||||
</script>
|
||||
<script src="{{ asset('js/librenms.js?ver=20191025') }}"></script>
|
||||
<script src="{{ asset('js/librenms.js?ver=20200501') }}"></script>
|
||||
<script type="text/javascript">
|
||||
<!-- Begin
|
||||
function popUp(URL)
|
||||
|
Reference in New Issue
Block a user