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

31 lines
113 KiB
JavaScript
Raw Normal View History

(()=>{var Wo=Object.create;var fe=Object.defineProperty,Bo=Object.defineProperties,Vo=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols,Uo=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable;var Tn=(i,t,e)=>t in i?fe(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)&&Tn(i,e,t[e]);if(yn)for(var e of yn(t))Yo.call(t,e)&&Tn(i,e,t[e]);return i},We=(i,t)=>Bo(i,Fo(t)),An=i=>fe(i,"__esModule",{value:!0});var q=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ko=(i,t)=>{An(i);for(var e in t)fe(i,e,{get:t[e],enumerable:!0})},qo=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of zo(t))!bn.call(i,n)&&n!=="default"&&fe(i,n,{get:()=>t[n],enumerable:!(e=Vo(t,n))||e.enumerable});return i},Oi=i=>qo(An(fe(i!=null?Wo(Uo(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var wi=(i,t,e)=>new Promise((n,r)=>{var s=u=>{try{a(e.next(u))}catch(h){r(h)}},o=u=>{try{a(e.throw(u))}catch(h){r(h)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((e=e.apply(i,t)).next())});var ln=q((ro,fi)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof fi=="object"&&fi.exports?fi.exports=t():i.EvEmitter=t()})(typeof window!="undefined"?window:ro,function(){"use strict";function i(){}var t=i.prototype;return t.on=function(e,n){if(!(!e||!n)){var r=this._events=this._events||{},s=r[e]=r[e]||[];return s.indexOf(n)==-1&&s.push(n),this}},t.once=function(e,n){if(!(!e||!n)){this.on(e,n);var r=this._onceEvents=this._onceEvents||{},s=r[e]=r[e]||{};return s[n]=!0,this}},t.off=function(e,n){var r=this._events&&this._events[e];if(!(!r||!r.length)){var s=r.indexOf(n);return s!=-1&&r.splice(s,1),this}},t.emitEvent=function(e,n){var r=this._events&&this._events[e];if(!(!r||!r.length)){r=r.slice(0),n=n||[];for(var s=this._onceEvents&&this._onceEvents[e],o=0;o<r.length;o++){var a=r[o],u=s&&s[a];u&&(this.off(e,a),delete s[a]),a.apply(this,n)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},i})});var hi=q((vp,di)=>{(function(i,t){typeof define=="function"&&define.amd?define(t):typeof di=="object"&&di.exports?di.exports=t():i.getSize=t()})(window,function(){"use strict";function t(d){var v=parseFloat(d),E=d.indexOf("%")==-1&&!isNaN(v);return E&&v}function e(){}var n=typeof console=="undefined"?e:function(d){console.error(d)},r=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],s=r.length;function o(){for(var d={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},v=0;v<s;v++){var E=r[v];d[E]=0}return d}function a(d){var v=getComputedStyle(d);return v||n("Style returned "+v+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),v}var u=!1,h;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 v=document.body||document.documentElement;v.appendChild(d);var E=a(d);h=Math.round(t(E.width))==200,_.isBoxSizeOuter=h,v.removeChild(d)}}function _(d){if(f(),typeof d=="string"&&(d=document.querySelector(d)),!(!d||typeof d!="object"||!d.nodeType)){var v=a(d);if(v.display=="none")return o();var E={};E.width=d.offsetWidth,E.height=d.offsetHeight;for(var p=E.isBorderBox=v.boxSizing=="border-box",l=0;l<s;l++){var c=r[l],m=v[c],b=parseFloat(m);E[c]=isNaN(b)?0:b}var y=E.paddingLeft+E.paddingRight,S=E.paddingTop+E.paddingBottom,A=E.marginLeft+E.marginRight,C=E.marginTop+E.marginBottom,w=E.borderLeftWidth+E.borderRightWidth,N=E.borderTopWidth+E.borderBottomWidth,L=p&&h,M=t(v.width);M!==!1&&(E.width=M+(L?0:y+w));var Q=t(v.height);return Q!==!1&&(E.height=Q+(L?0:S+N)),E.innerWidth=E.width-(y+w),E.innerHeight=E.height-(S+N),E.
`)}:!a.ok&&"detail"in h?{error:h.detail}:h})}function Ro(i){return wi(this,null,function*(){return yield fu(i,"GET")})}function*fn(...i){for(let t of i)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function $o(i){i.startsWith("data-")||(i=`data-${i}`);for(let t of fn("body > div#netbox-data > *")){let e=t.getAttribute(i);if($e(e))return e}return null}function du(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 fn("div.card-overlay"))du(t,i)}window.Collapse=it;window.Modal=Ft;window.Popover=le;window.Toast=Yt;window.Tooltip=gt;function Mo(i,t,e,n){let r="mdi-alert";switch(i){case"warning":r="mdi-alert";break;case"success":r="mdi-check-circle";break;case"info":r="mdi-information";break;case"danger":r="mdi-alert";break}let s=document.createElement("div");s.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let o=document.createElement("div");o.setAttribute("class",`toast bg-${i}`),o.setAttribute("role","alert"),o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true");let a=document.createElement("div");a.setAttribute("class",`toast-header bg-${i} text-body`);let u=document.createElement("i");u.setAttribute("class",`mdi ${r}`);let h=document.createElement("strong");h.setAttribute("class","me-auto ms-1"),h.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"),a.appendChild(u),a.appendChild(h),typeof n!="undefined"){let v=document.createElement("small");v.setAttribute("class","text-muted"),a.appendChild(v)}return a.appendChild(f),_.innerText=e.trim(),o.appendChild(a),o.appendChild(_),s.appendChild(o),document.body.appendChild(s),new Yt(o)}function dn(i,t,e){var n,r;return(r=(n=i.querySelector(t))==null?void 0:n.getAttribute(e))!=null?r:null}function pu(i){var t,e;for(let[n,r]of Object.entries(i.get_lldp_neighbors_detail)){let[s]=n.split("."),o=document.getElementById(s);if(o!==null)for(let a of r){let u=o.querySelector("td.device"),h=o.querySelector("td.interface"),f=dn(o,"td.configured_device","data"),_=dn(o,"td.configured_chassis","data-chassis"),d=dn(o,"td.configured_interface","data"),v=null;$e(d)&&(v=d.replace(/^([A-Z][a-z])[^0-9]*([0-9/]+)$/,"$1$2"));let E=(t=a.remote_system_name)!=null?t:"",p=(e=a.remote_port)!=null?e:"",[l]=E.split("."),[c]=p.split(".");u!==null&&(u.innerText=l),h!==null&&(h.innerText=c),!$e(f)&&$e(l)?o.classList.add("info"):(f===l||_===l)&&v===c||f===l||_===l?o.classList.add("success"):o.classList.add("danger")}}}function jo(){yi("show");let i=$o("object-url");i!==null&&Ro(i).then(t=>{if(Po(t)){Mo("danger","Error Retrieving LLDP Neighbor Information",t.error).show(),yi("hide");return}else pu(t)}).finally(()=>{yi("hide")})}document.readyState!=="loading"?jo():document.addEventListener("DOMContentLoaded",jo);})();
/*!
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
*/
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
/*!
* getSize v2.0.3
* measure size of elements
* MIT license
*/