1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/project-static/dist/lldp.js

25 lines
106 KiB
JavaScript
Raw Normal View History

2022-10-04 15:02:37 +02:00
"use strict";(()=>{var Tr=Object.create;var je=Object.defineProperty,Ar=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Or=Object.getOwnPropertyDescriptors,wr=Object.getOwnPropertyNames,vn=Object.getOwnPropertySymbols,Cr=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable;var yn=(i,t,e)=>t in i?je(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t)=>{for(var e in t||(t={}))bn.call(t,e)&&yn(i,e,t[e]);if(vn)for(var e of vn(t))Lr.call(t,e)&&yn(i,e,t[e]);return i},Ye=(i,t)=>Ar(i,Or(t));var It=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Nr=(i,t)=>{for(var e in t)je(i,e,{get:t[e],enumerable:!0})},xr=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of wr(t))!bn.call(i,o)&&o!==e&&je(i,o,{get:()=>t[o],enumerable:!(n=Sr(t,o))||n.enumerable});return i};var Dr=(i,t,e)=>(e=i!=null?Tr(Cr(i)):{},xr(t||!i||!i.__esModule?je(e,"default",{value:i,enumerable:!0}):e,i));var wi=(i,t,e)=>new Promise((n,o)=>{var r=u=>{try{l(e.next(u))}catch(p){o(p)}},s=u=>{try{l(e.throw(u))}catch(p){o(p)}},l=u=>u.done?n(u.value):Promise.resolve(u.value).then(r,s);l((e=e.apply(i,t)).next())});var an=It((or,hi)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof hi=="object"&&hi.exports?hi.exports=t():i.EvEmitter=t()})(typeof window!="undefined"?window:or,function(){"use strict";function i(){}var t=i.prototype;return t.on=function(e,n){if(!(!e||!n)){var o=this._events=this._events||{},r=o[e]=o[e]||[];return r.indexOf(n)==-1&&r.push(n),this}},t.once=function(e,n){if(!(!e||!n)){this.on(e,n);var o=this._onceEvents=this._onceEvents||{},r=o[e]=o[e]||{};return r[n]=!0,this}},t.off=function(e,n){var o=this._events&&this._events[e];if(!(!o||!o.length)){var r=o.indexOf(n);return r!=-1&&o.splice(r,1),this}},t.emitEvent=function(e,n){var o=this._events&&this._events[e];if(!(!o||!o.length)){o=o.slice(0),n=n||[];for(var r=this._onceEvents&&this._onceEvents[e],s=0;s<o.length;s++){var l=o[s],u=r&&r[l];u&&(this.off(e,l),delete r[l]),l.apply(this,n)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},i})});var mi=It((Qh,pi)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof pi=="object"&&pi.exports?pi.exports=t():i.getSize=t()})(window,function(){"use strict";function t(d){var E=parseFloat(d),v=d.indexOf("%")==-1&&!isNaN(E);return v&&E}function e(){}var n=typeof console=="undefined"?e:function(d){console.error(d)},o=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],r=o.length;function s(){for(var d={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},E=0;E<r;E++){var v=o[E];d[v]=0}return d}function l(d){var E=getComputedStyle(d);return E||n("Style returned "+E+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),E}var u=!1,p;function f(){if(!u){u=!0;var d=document.createElement("div");d.style.width="200px",d.style.padding="1px 2px 3px 4px",d.style.borderStyle="solid",d.style.borderWidth="1px 2px 3px 4px",d.style.boxSizing="border-box";var E=document.body||document.documentElement;E.appendChild(d);var v=l(d);p=Math.round(t(v.width))==200,_.isBoxSizeOuter=p,E.removeChild(d)}}function _(d){if(f(),typeof d=="string"&&(d=document.querySelector(d)),!(!d||typeof d!="object"||!d.nodeType)){var E=l(d);if(E.display=="none")return s();var v={};v.width=d.offsetWidth,v.height=d.offsetHeight;for(var h=v.isBorderBox=E.boxSizing=="border-box",a=0;a<r;a++){var c=o[a],m=E[c],y=parseFloat(m);v[c]=isNaN(y)?0:y}var b=v.paddingLeft+v.paddingRight,T=v.paddingTop+v.paddingBottom,A=v.marginLeft+v.marginRight,w=v.marginTop+v.marginBottom,L=v.borderLeftWidth+v.borderRightWidth,N=v.borderTopWidth+v.borderBottomWidth,x=h&&p,C=t(E.width);C!==!1&&(v.width=C+(x?0:b+L));var B=t(E.height);return B!==!1&&(v.height=B+(x?0:T+N)),v.innerWidth=v.width-(b+L),v.innerHeight=v.height-(T+N),v.outerWidth=v.width+A,v.outerHeight=v.height+w,v}}return _})});
`)}:!s.ok&&"detail"in u?{error:u.detail}:u})}function fr(i){return wi(this,null,function*(){return yield xc(i,"GET")})}function*ln(...i){for(let t of i)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function dr(i){i.startsWith("data-")||(i=`data-${i}`);for(let t of ln("body > div#netbox-data > *")){let e=t.getAttribute(i);if(he(e))return e}return null}function Dc(i,t){i!==null&&(typeof t=="undefined"?window.getComputedStyle(i).display==="none"?i.style.display="":i.style.display="none":t==="show"?i.style.display="":i.style.display="none")}function bi(i){for(let t of ln("div.card-overlay"))Dc(t,i)}window.Collapse=q;window.Modal=At;window.Popover=Qt;window.Toast=Ot;window.Tooltip=ct;function hr(i,t,e,n){let o="mdi-alert";switch(i){case"warning":o="mdi-alert";break;case"success":o="mdi-check-circle";break;case"info":o="mdi-information";break;case"danger":o="mdi-alert";break}let r=document.createElement("div");r.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let s=document.createElement("div");s.setAttribute("class",`toast bg-${i}`),s.setAttribute("role","alert"),s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true");let l=document.createElement("div");l.setAttribute("class",`toast-header bg-${i} text-body`);let u=document.createElement("i");u.setAttribute("class",`mdi ${o}`);let p=document.createElement("strong");p.setAttribute("class","me-auto ms-1"),p.innerText=t;let f=document.createElement("button");f.setAttribute("type","button"),f.setAttribute("class","btn-close"),f.setAttribute("data-bs-dismiss","toast"),f.setAttribute("aria-label","Close");let _=document.createElement("div");if(_.setAttribute("class","toast-body"),l.appendChild(u),l.appendChild(p),typeof n!="undefined"){let E=document.createElement("small");E.setAttribute("class","text-muted"),l.appendChild(E)}return l.appendChild(f),_.innerText=e.trim(),s.appendChild(l),s.appendChild(_),r.appendChild(s),document.body.appendChild(r),new Ot(s)}var pr=new RegExp(/^([A-Z][A-Za-z]+)[^0-9]*([0-9/]+)$/),Pc=new Map([["TwentyFiveGigE","Twe"]]);function cn(i,t,e){var n,o;return(o=(n=i.querySelector(t))==null?void 0:n.getAttribute(e))!=null?o:null}function $c(i){var t;if(i===null)return i;if(i.match(pr)){let[e,n]=((t=i.match(pr))!=null?t:[]).slice(1,3);if(he(e)&&he(n))return`${Pc.get(e)||e.slice(0,2)}${n}`}return i}function Rc(i){var t,e;for(let[n,o]of Object.entries(i.get_lldp_neighbors_detail)){let[r]=n.split("."),s=document.getElementById(r);if(s!==null)for(let l of o){let u=s.querySelector("td.device"),p=s.querySelector("td.interface"),f=cn(s,"td.configured_device","data"),_=cn(s,"td.configured_chassis","data-chassis"),d=cn(s,"td.configured_interface","data"),E=$c(d),v=(t=l.remote_system_name)!=null?t:"",h=(e=l.remote_port)!=null?e:"",[a]=v.split("."),[c]=h.split(".");u!==null&&(u.innerText=a),p!==null&&(p.innerText=c),!he(f)&&he(a)?s.classList.add("info"):(f===a||_===a)&&(d===c||E===c)?s.classList.add("success"):s.classList.add("danger")}}}function mr(){bi("show");let i=dr("object-url");i!==null&&fr(i).then(t=>{if(ur(t)){hr("danger","Error Retrieving LLDP Neighbor Information",t.error).show(),bi("hide");return}else Rc(t)}).finally(()=>{bi("hide")})}document.readyState!=="loading"?mr():document.addEventListener("DOMContentLoaded",mr);})();
/*!
2021-08-30 11:02:47 -07:00
* Bootstrap v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Masonry v4.2.2
* Cascading grid layout library
* https://masonry.desandro.com
* MIT License
* by David DeSandro
*/
/*!
* Outlayer v2.1.1
* the brains and guts of a layout library
* MIT license
*/
/*!
* getSize v2.0.3
* measure size of elements
* MIT license
*/