mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
(firewall, alias) hide already used aliases. closes https://github.com/opnsense/core/issues/1042
This commit is contained in:
parent
f6a6a08216
commit
c52dbf2ce0
@ -291,6 +291,29 @@ include("head.inc");
|
||||
$(this).parent().parent().remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* link alias typeahead to input, only return items not already on this form.
|
||||
*/
|
||||
function addFieldTypeAhead() {
|
||||
$(".fld_detail").typeahead({
|
||||
source: document.all_aliases[$("#typeSelect").val()],
|
||||
matcher: function(item){
|
||||
var used = false;
|
||||
$(".fld_detail").each(function(){
|
||||
if (item == $(this).val()) {
|
||||
used = true;
|
||||
}
|
||||
});
|
||||
if (used) {
|
||||
return false;
|
||||
} else {
|
||||
return ~item.toLowerCase().indexOf(this.query)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// add new detail record
|
||||
$("#addNew").click(function(){
|
||||
// copy last row and reset values
|
||||
@ -300,7 +323,7 @@ include("head.inc");
|
||||
});
|
||||
$(".act-removerow").click(removeRow);
|
||||
// link typeahead to new item
|
||||
$(".fld_detail").typeahead({ source: document.all_aliases[$("#typeSelect").val()] });
|
||||
addFieldTypeAhead();
|
||||
// link geoip list to new item
|
||||
$(".geoip_list").change(function(){
|
||||
$(this).parent().find('input').val($(this).val());
|
||||
@ -364,7 +387,7 @@ include("head.inc");
|
||||
break;
|
||||
}
|
||||
$(".fld_detail").typeahead("destroy");
|
||||
$(".fld_detail").typeahead({ source: document.all_aliases[$("#typeSelect").val()] });
|
||||
addFieldTypeAhead();
|
||||
}
|
||||
|
||||
$("#typeSelect").change(function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user