[520d94]: Netdisco / share / views / ajax / device / ports.tt  Maximize  Restore  History

Download this file

349 lines (327 with data), 14.2 kB

  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
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
[% SET user_can_port_control = user_has_role('port_control') %]
<table class="table table-bordered table-striped nd_floatinghead">
<thead>
<tr>
<th></th>
[% FOREACH item IN vars.port_columns %]
[% NEXT IF item.name == 'c_admin' %]
[% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %]
[% NEXT UNLESS params.${item.name} %]
<th[% ' class="nd_nudge-for-icon"' IF
(user_can_port_control AND params.c_admin AND (item.name == 'c_port' OR item.name == 'c_name')) %]>
[% item.label | html_entity %]
</th>
[% END %]
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td class="nd_center-cell nd_devport-icon">
[% IF row.up_admin != 'up' %]
<i class="icon-remove"></i>
[% ELSIF row.stp == 'blocking' %]
<i class="icon-fullscreen text-info"></i>
[% ELSIF row.has_column_loaded('is_free') AND row.is_free %]
<i class="icon-arrow-down text-success"></i>
[% ELSIF row.up_admin == 'up' AND (row.up != 'up' AND row.up != 'dormant') %]
<i class="icon-arrow-down text-error"></i>
[% ELSE %]
<i class="icon-angle-up text-success"></i>
[% END %]
[% IF row.slave_of %]<br/>
[% IF row.get_column('agg_master_up_admin') != 'up' %]
<small><i class="icon-group muted"></i></small>
[% ELSIF row.get_column('agg_master_up') == 'up' %]
<small><i class="icon-group text-success"></i></small>
[% ELSE %]
<small><i class="icon-group text-error"></i></small>
[% END %]
[% END %]
</td>
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'left' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
[% IF params.c_port %]
[% IF user_can_port_control AND params.c_admin %]
[% IF row.up_admin == 'up' %]
<td nowrap class="nd_editable-cell" data-action="down"
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-hand-down nd_hand-icon"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Disable"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell" data-action="up"
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-hand-up nd_hand-icon"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Enable"></i>
[% END %]
<a class="nd_log-icon"
href="[% uri_for('/admin/portlog') %]?q=[% device.dns || device.ip | uri %]&f=[% row.port | uri %]">
<i class="icon-file-text-alt"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="View Port Log"></i>
</a>
[% ELSE %]
<td nowrap>
[% END %]
<a class="nd_this-port-only nd_port-only-first" href="[% uri_for('/device',
self_options) %]&q=[% params.q | uri %]&f=[% row.port | uri %]&prefer=port">
[% IF row.is_master %]
<small><i class="icon-group muted"></i></small>&nbsp;
[% END %]
[% row.port | html_entity %]</a>
[% IF row.slave_of %]<br/>
<a class="nd_this-port-only" href="[% uri_for('/device',
self_options) %]&q=[% params.q | uri %]&f=[% row.slave_of | uri %]&prefer=port">
[% row.slave_of | html_entity %]</a>
[% END %]
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'mid' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
[% IF params.c_descr %]
<td nowrap>[% row.descr | html_entity %]</td>
[% END %]
[% IF params.c_type %]
<td>[% row.type | html_entity %]</td>
[% END %]
[% IF params.c_duplex %]
<td>
[% IF row.up == 'up' AND row.duplex %]
[% (row.duplex_admin.ucfirst || 'Auto') | html_entity %] / [% row.duplex.ucfirst | html_entity %]
[% END %]
</td>
[% END %]
[% IF params.c_lastchange %]
<td>[% row.lastchange_stamp | html_entity %]</td>
[% END %]
[% IF params.c_name %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="c_name" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap>
[% END %]
<div class="nd_editable-cell-content">
[% row.name | html_entity %]
</div>
</td>
[% END %]
[% IF params.c_speed %]
<td>[% row.speed | html_entity %]</td>
[% END %]
[% IF params.c_mac %]
<td>[% row.mac | html_entity %]</td>
[% END %]
[% IF params.c_mtu %]
<td>[% row.mtu | html_entity %]</td>
[% END %]
[% IF params.c_pvid %]
[% IF user_can_port_control AND params.c_admin %]
<td class="nd_editable-cell" contenteditable="true" data-default="[% row.vlan | html_entity %]"
data-field="c_pvid" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
<div class="nd_editable-cell-content">
[% IF row.vlan %][% row.vlan | html_entity %][% END %]
</div>
</td>
[% ELSE %]
<td>
<a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=vlan&q=[% row.vlan | uri %]">
[% row.vlan | html_entity %]</a>
</td>
[% END %]
[% END %]
[% IF params.c_vmember %]
<td>
[% IF row.vlan_count %]
[% SET output = '' %]
[% SET vlanlist = [] %]
[% FOREACH vlan IN row.all_port_vlans %][% vlanlist.push(vlan.get_column('vlan')) %][% END %]
[% FOREACH vlan IN vlanlist.nsort %]
[% SET output = output _
'<a href="' _ uri_for('/search') _ '?tab=vlan&q=' _ vlan _ '">' _ vlan _ '</a>' %]
[% SET output = output _ ', ' IF NOT loop.last %]
[% END %]
[% IF row.vlan_count > 10 %] [%# TODO make this a settable variable %]
[% SET output = '<div class="nd_vlan-total">(' _ row.vlan_count
_ ')</div><span class="nd_linkcell nd_collapse-vlans">
<div class="nd_arrow-up-down-left icon-chevron-up icon-large"></div>Show VLANs</span>
<div class="nd_collapsing nd_collapse-pre-hidden">' _ output %]
[% SET output = output _ '</div>' %]
[% END %]
[% output %]
[% END %]
</td>
[% END %]
[% IF params.c_power %]
[% IF row.power %]
[% IF row.power.admin == 'true' %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap data-action="false"
data-field="c_power" data-for-device="[% device.ip | html_entity %]"
data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power-icon nd_power-on"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Disable"></i>
[% ELSE %]
<td nowrap>
<i class="icon-off nd_power-on"></i>
[% END %]
<span>
[% IF row.power.power > 0 %]
[% row.power.power | html_entity %]&nbsp;mW
[% ELSE %]
([% row.power.status | html_entity %])
[% END %]
</span>
[% ELSE %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap data-action="true"
data-field="c_power" data-for-device="[% device.ip | html_entity %]"
data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power-icon"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Click to Enable"></i>
[% ELSE %]
<td>
<i class="icon-off"></i>
[% END %]
[% END %]
</td>
[% ELSE %]
<td></td>
[% END %]
[% END %]
[% IF params.c_nodes OR params.c_neighbors %]
<td>
[% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %]
[% IF row.neighbor %]
<i class="icon-link[% ' text-warning' IF row.manual_topo %]"></i>
[% IF row.remote_type AND row.remote_type.match('(?i)ip.phone') %]
<i class="icon-phone"></i>&nbsp;
[% ELSIF row.remote_type AND row.remote_type.match('(cisco\s+AIR-[L|C]?AP|-K9W8-|^AP:\s)') %]
<i class="icon-signal"></i>&nbsp;
[% END %]
<a href="[% uri_for('/device',
self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]&prefer=port">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %]
[% ' - ' IF row.remote_port %][% row.remote_port | html_entity %]</a><br/>
[% IF params.neigh_id and (row.remote_id or row.remote_type) %]
([% 'id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %])<br/>
[% END %]
[% ELSIF row.remote_ip %]
<i class="icon-unlink text-error"></i>&nbsp;
[% IF row.remote_type AND row.remote_type.match('(?i)ip.phone') %]
<i class="icon-phone"></i>&nbsp;
[% ELSIF row.remote_type AND row.remote_type.match('(cisco\s+AIR-[L|C]?AP|-K9W8-|^AP:\s)') %]
<i class="icon-signal"></i>&nbsp;
[% END %]
<a href="[% search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip | html_entity %]
[% ' - ' IF row.remote_port %][% row.remote_port | html_entity %]</a><br/>
[% IF params.neigh_id and (row.remote_id or row.remote_type) %]
([% 'id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %])<br/>
[% END %]
[% ELSE %]
<i class="icon-unlink text-error"></i>&nbsp; (possible uplink)
[% END %]
[% END %]
[% IF params.c_nodes %]
[% FOREACH node IN row.$nodes %]
[% '<br/>' IF (row.remote_ip OR row.is_uplink) OR NOT loop.first %]
[% '<i class="icon-book"></i>&nbsp; ' IF NOT node.active %]
[% '<i class="icon-signal"></i>&nbsp; ' IF node.wireless.defined %]
<a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF (node.vlan > 0) && (node.vlan != row.vlan) %]
(on vlan [% node.vlan | html_entity %])
[% END %]
[% IF params.n_ssid AND node.wireless.defined %]
(SSID:
[% FOREACH wlan IN node.wireless %]
[%+ wlan.ssid | html_entity %]
[% END %]
)
[% END %]
[% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip %]
[% FOREACH ip IN node.ips %]
<br/>&nbsp; [% '<i class="icon-book"></i>&nbsp; ' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip | html_entity %])</a>
[% ELSE %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% ip.ip | html_entity %]</a>
[% END %]
[% END %]
[% END %]
[% END %]
[% END %]
</td>
[% END %]
[% IF params.c_stp %]
<td>[% row.stp | html_entity %]</td>
[% END %]
[% IF params.c_up %]
<td>
[% row.up_admin.ucfirst | html_entity %] / [% row.up.ucfirst | html_entity %]
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'right' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
[% IF user_can_port_control %]
<div id="nd_portlog" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-hidden="true">
<div class="modal-body">
<blockquote>
<ul><li><p>Please provide a reason for chainging the Port Configuration</p></li></ul>
</blockquote>
<select id="nd_portlog-reason" class="input-block-level" name="reason">
[% FOREACH pair IN settings.port_control_reasons.pairs %]
<option[% ' selected="selected"' IF pair.key == 'other' %] value="[% pair.key | html_entity %]">
[% pair.value | html_entity %]</option>
[% END %]
</select>
<textarea id="nd_portlog-log" class="input-block-level" rows="2" name="log"
placeholder="Enter a log message"></textarea>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button id="nd_portlog-submit" class="btn btn-info" data-dismiss="modal">Continue</button>
</div>
</div>
[% END %]

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks