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 22:00:32 +02:00
(()=>{var Ar=Object.create;var pe=Object.defineProperty,Sr=Object.defineProperties,Or=Object.getOwnPropertyDescriptor,wr=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,vn=Object.getOwnPropertySymbols,Lr=Object.getPrototypeOf,yn=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable;var bn=(i,t,e)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t)=>{for(var e in t||(t={}))yn.call(t,e)&&bn(i,e,t[e]);if(vn)for(var e of vn(t))Nr.call(t,e)&&bn(i,e,t[e]);return i},Be=(i,t)=>Sr(i,wr(t)),Tn=i=>pe(i,"__esModule",{value:!0});var Nt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),xr=(i,t)=>{Tn(i);for(var e in t)pe(i,e,{get:t[e],enumerable:!0})},Dr=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Cr(t))!yn.call(i,n)&&n!=="default"&&pe(i,n,{get:()=>t[n],enumerable:!(e=Or(t,n))||e.enumerable});return i},Ir=i=>Dr(Tn(pe(i!=null?Ar(Lr(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Oi=(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=Nt((rr,di)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof di=="object"&&di.exports?di.exports=t():i.EvEmitter=t()})(typeof window!="undefined"?window:rr,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 pi=Nt((Qh,hi)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof hi=="object"&&hi.exports?hi.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 V=t(E.height);return V!==!1&&(v.height=V+(x?0:T+N)),v.innerWidth=v.width-(b+L),v.innerHeight=v.height-(T+N)
`)}:!s.ok&&"detail"in u?{error:u.detail}:u})}function dr(i){return Oi(this,null,function*(){return yield Dc(i,"GET")})}function*ln(...i){for(let t of i)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function hr(i){i.startsWith("data-")||(i=`data-${i}`);for(let t of ln("body > div#netbox-data > *")){let e=t.getAttribute(i);if(fe(e))return e}return null}function Ic(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 yi(i){for(let t of ln("div.card-overlay"))Ic(t,i)}window.Collapse=et;window.Modal=Kt;window.Popover=ce;window.Toast=Gt;window.Tooltip=mt;function pr(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 Gt(s)}var mr=new RegExp(/^([A-Z][A-Za-z]+)[^0-9]*([0-9/]+)$/),Rc=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(mr)){let[e,n]=((t=i.match(mr))!=null?t:[]).slice(1,3);if(fe(e)&&fe(n))return`${Rc.get(e)||e.slice(0,2)}${n}`}return i}function Mc(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),!fe(f)&&fe(a)?s.classList.add("info"):(f===a||_===a)&&(d===c||E===c)?s.classList.add("success"):s.classList.add("danger")}}}function gr(){yi("show");let i=hr("object-url");i!==null&&dr(i).then(t=>{if(fr(t)){pr("danger","Error Retrieving LLDP Neighbor Information",t.error).show(),yi("hide");return}else Mc(t)}).finally(()=>{yi("hide")})}document.readyState!=="loading"?gr():document.addEventListener("DOMContentLoaded",gr);})();
/*!
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
*/