mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 02:16:39 +00:00
115 lines
5.1 KiB
Text
115 lines
5.1 KiB
Text
{% -- Generate forms for the actual switch of the currently active interface %}
|
|
|
|
{% -- For the system interface %}
|
|
<form id="switch_interface_form_{{ getSystemInterfaceId() }}" method="POST" action="{{ ntop.getHttpPrefix() }}/lua/system_stats.lua?ifid={{ getSystemInterfaceId() }}">
|
|
<input name="switch_interface" type="hidden" value="1" />
|
|
<input name="csrf" type="hidden" value="{{ ntop.getRandomCSRFValue() }}" />
|
|
</form>
|
|
|
|
{% -- For all other interfaces %}
|
|
{% for k, v in pairsByValues(ifnames, asc) do %}
|
|
<form id="switch_interface_form_{{ k }}" method="POST" action="{{ action_urls[k] }}">
|
|
<input name="switch_interface" type="hidden" value="1" />
|
|
<input name="csrf" type="hidden" value="{{ ntop.getRandomCSRFValue() }}" />
|
|
</form>
|
|
{% end %}
|
|
|
|
|
|
{% -- Print out the interfaces dropdown %}
|
|
|
|
<li class="nav-item d-none d-sm-flex align-items-center">
|
|
<select name="interfaces-dropdown" id="interfaces-dropdown" class="selectpicker"
|
|
data-width="fit" data-live-search="true" data-live-search-placeholder="{{ i18n('search') }}" data-actions-box="true">
|
|
|
|
{% if isAdministrator() then %}
|
|
<optgroup label="{{ i18n('system') }}">
|
|
<option value="{{ getSystemInterfaceId() }}" {{ selected }} data-content="{{ i18n('system') }} ">{{ i18n('system') }}</option>
|
|
</optgroup>
|
|
{% end %}
|
|
|
|
{% -- The Interfaces optgroup %}
|
|
<optgroup label="{{ i18n('interfaces') }}">
|
|
|
|
{% for round = 1, 2 do -- First round: only physical interfaces, second round: only virtual interfaces %}
|
|
{% for k, v in pairsByValues(ifnames, asc) do %}
|
|
{% if round == 1 and ifCustom[k] then %}
|
|
{% -- Nothing to do, this round is for physical, non-disaggregated interfaces ... %}
|
|
{% elseif round == 2 and not ifCustom[k] then %}
|
|
{% -- Nothing to do, this round is for disaggregated interfaces only ... %}
|
|
{% else %}
|
|
{% local icons, selected = {}, '' %}
|
|
|
|
{% if tonumber(k) == interface.getId() and not is_system_interface then %}
|
|
{% selected = 'selected=""' %}
|
|
{% end %}
|
|
|
|
{% if pcapdump[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-file'></i>" %}
|
|
{% elseif packetinterfaces[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-ethernet'></i>" %}
|
|
{% elseif zmqinterfaces[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-bezier-curve'></i>" %} {% --broadcast-tower %}
|
|
{% end %}
|
|
|
|
{% if views[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-eye'></i>" %}
|
|
{% end %}
|
|
|
|
{% if dynamic[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-code-branch'></i>" %}
|
|
{% end %}
|
|
|
|
{% if drops[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-tint'></i>" %}
|
|
{% end %}
|
|
|
|
{% if recording[v] then %}
|
|
{% icons[#icons + 1] = "<i class='fas fa-hdd'></i>" %}
|
|
{% end %}
|
|
|
|
<option data-tokens="{{ k }}" value="{{ k }}" {{ selected }} data-content="{{ table.concat(icons, ' ')}} {{ shortenCollapse(ifHdescr[k]) }}">{{ ifHdescr[k] }}</option>
|
|
{% end %}
|
|
{% end %}
|
|
{% end %}
|
|
</optgroup>
|
|
{% if ntop.isPro() and isAdministrator() and (table.len(infrastructures) > 0) then %}
|
|
<optgroup id="optInf" label="{{ i18n('infrastructure_dashboard.infrastructure') }}">
|
|
{% for k,v in pairs(infrastructures or {}) do %}
|
|
<option value="{{ v }}" href="#" data-content="{{ "<i class='fas fa-building'></i> "..k }}"> {{ v }}</option>
|
|
{% end %}
|
|
</optgroup>
|
|
{% end %}
|
|
</select>
|
|
</li>
|
|
|
|
|
|
{% -- Print the observation point dropdown %}
|
|
{% if(observationPoints ~= nil) then %}
|
|
|
|
|
|
{% for _, v in pairsByKeys(observationPoints, asc) do %}
|
|
<form id="switch_interface_form_observation_point_{{ v["obs_point"] }}" method="POST" action="{{ ntop.getHttpPrefix() .. "/lua/flows_stats.lua" .. action_urls[interface.getId()] }}&observationPointId={{ v["obs_point"] }}" >
|
|
<input name="switch_interface" type="hidden" value="1" />
|
|
<input name="csrf" type="hidden" value="{{ ntop.getRandomCSRFValue() }}" />
|
|
</form>
|
|
{% end %}
|
|
|
|
|
|
<li class="nav-item d-none d-sm-flex align-items-center">
|
|
<select name="observationpoint-dropdown" id="observationpoint-dropdown" class="selectpicker" data-width="fit" data-live-search="true" data-live-search-placeholder="{{ i18n('search') }}" data-actions-box="true">
|
|
|
|
{% -- The Observationpoint optgroup %}
|
|
<optgroup label="{{ i18n('observationpoints') }}">
|
|
{% for _, v in pairsByKeys(observationPoints, asc) do %}
|
|
{% local selected = '' %}
|
|
{% if((observationPointId ~= nil) and (tostring(v["obs_point"]) == tostring(observationPointId))) then selected = 'selected' end %}
|
|
<option value="{{ v["obs_point"] }}" {{ selected }}>{{ getObsPointAlias(v["obs_point"], true) }}</option>
|
|
{% end %}
|
|
</optgroup>
|
|
</select>
|
|
</li>
|
|
{% end %}
|
|
|
|
|
|
|
|
<script type="text/javascript" src="{{ ntop.getHttpPrefix() }}/js/pages/components/ifaces-dropdown.js?{{ ntop.getStaticFileEpoch() }}"></script>
|