forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddIpLists.js
More file actions
25 lines (20 loc) · 762 Bytes
/
addIpLists.js
File metadata and controls
25 lines (20 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { parseAndSortIpLists } from './helpers';
// Populates the "IP address / IP list" select with created IP lists
// on the Add Firewall Rule page
export default function handleAddIpLists() {
const ipListSelect = document.querySelector('.js-ip-list-select');
if (!ipListSelect) {
return;
}
const ipSetLists = parseAndSortIpLists(ipListSelect.dataset.ipsetLists);
const headerOption = document.createElement('option');
headerOption.textContent = 'IPset IP Lists';
headerOption.disabled = true;
ipListSelect.appendChild(headerOption);
ipSetLists.forEach((ipSet) => {
const ipOption = document.createElement('option');
ipOption.textContent = ipSet.name;
ipOption.value = `ipset:${ipSet.name}`;
ipListSelect.appendChild(ipOption);
});
}