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/status.js

25 lines
126 KiB
JavaScript
Raw Normal View History

2022-10-04 22:00:32 +02:00
(()=>{var Uo=Object.create;var Ae=Object.defineProperty,Ko=Object.defineProperties,Go=Object.getOwnPropertyDescriptor,qo=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertyNames,Rn=Object.getOwnPropertySymbols,Qo=Object.getPrototypeOf,jn=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable;var Hn=(i,t,e)=>t in i?Ae(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,R=(i,t)=>{for(var e in t||(t={}))jn.call(t,e)&&Hn(i,e,t[e]);if(Rn)for(var e of Rn(t))Zo.call(t,e)&&Hn(i,e,t[e]);return i},Xe=(i,t)=>Ko(i,qo(t)),kn=i=>Ae(i,"__esModule",{value:!0});var ft=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Jo=(i,t)=>{kn(i);for(var e in t)Ae(i,e,{get:t[e],enumerable:!0})},tr=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Xo(t))!jn.call(i,n)&&n!=="default"&&Ae(i,n,{get:()=>t[n],enumerable:!(e=Go(t,n))||e.enumerable});return i},le=i=>tr(kn(Ae(i!=null?Uo(Qo(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Mi=(i,t,e)=>new Promise((n,s)=>{var o=u=>{try{a(e.next(u))}catch(p){s(p)}},r=u=>{try{a(e.throw(u))}catch(p){s(p)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,r);a((e=e.apply(i,t)).next())});var Wn=ft((Ii,Pi)=>{(function(i,t){typeof Ii=="object"&&typeof Pi!="undefined"?Pi.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self).dayjs=t()})(Ii,function(){"use strict";var i=1e3,t=6e4,e=36e5,n="millisecond",s="second",o="minute",r="hour",a="day",u="week",p="month",f="quarter",_="year",d="date",m="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,l={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},c=function(D,O,S){var N=String(D);return!N||N.length>=O?D:""+Array(O+1-N.length).join(S)+D},g={s:c,z:function(D){var O=-D.utcOffset(),S=Math.abs(O),N=Math.floor(S/60),$=S%60;return(O<=0?"+":"-")+c(N,2,"0")+":"+c($,2,"0")},m:function D(O,S){if(O.date()<S.date())return-D(S,O);var N=12*(S.year()-O.year())+(S.month()-O.month()),$=O.clone().add(N,p),x=S-$<0,L=O.clone().add(N+(x?-1:1),p);return+(-(N+(S-$)/(x?$-L:L-$))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:p,y:_,w:u,d:a,D:d,h:r,m:o,s,ms:n,Q:f}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},y="en",v={};v[y]=l;var E=function(D){return D instanceof M},A=function D(O,S,N){var $;if(!O)return y;if(typeof O=="string"){var x=O.toLowerCase();v[x]&&($=x),S&&(v[x]=S,$=x);var L=O.split("-");if(!$&&L.length>1)return D(L[0])}else{var j=O.name;v[j]=O,$=j}return!N&&$&&(y=$),$||!N&&y},C=function(D,O){if(E(D))return D.clone();var S=typeof O=="object"?O:{};return S.date=D,S.args=arguments,new M(S)},w=g;w.l=A,w.i=E,w.w=function(D,O){return C(D,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var M=function(){function D(S){this.$L=A(S.locale,null,!0),this.parse(S)}var O=D.prototype;return O.parse=function(S){this.$d=function(N){var $=N.date,x=N.utc;if($===null)return new Date(NaN);if(w.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var L=$.match(b);if(L){var j=L[2]-1||0,H=(L[7]||"0").substring(0,3);return x?new Date(Date.UTC(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[6]||0,H)):new Date(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[6]||0,H)}}return new Date($)}(S),this.$x=S.x||{},this.init()},O.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},O.$utils=function(){return w},O.isValid=function(){return this.$d.toString()!==m},O.isSame=function(S,N){var $=C(S);return this.startOf(N)<=$&&$<=this.endOf(N)},O.isAfter=function(S,N){return C(S)<this.startOf(N)},O.isBefore=
`)}:!r.ok&&"detail"in u?{error:u.detail}:u})}function Mo(i){return Mi(this,null,function*(){return yield tu(i,"GET")})}function*On(...i){for(let t of i)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function Io(i){i.startsWith("data-")||(i=`data-${i}`);for(let t of On("body > div#netbox-data > *")){let e=t.getAttribute(i);if(Jc(e))return e}return null}function eu(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 Di(i){for(let t of On("div.card-overlay"))eu(t,i)}function W(i,t,e=null,n=[]){let s=document.createElement(i);if(t!==null)for(let o of Object.keys(t)){let r=o,a=t[r];r in s&&(s[r]=a)}e!==null&&e.length>0&&s.classList.add(...e);for(let o of n)s.appendChild(o);return s}function Po(i){return Math.round((i*(9/5)+32+Number.EPSILON)*10)/10}window.Collapse=_t;window.Modal=ie;window.Popover=be;window.Toast=oe;window.Tooltip=xt;function xi(i,t,e,n){let s="mdi-alert";switch(i){case"warning":s="mdi-alert";break;case"success":s="mdi-check-circle";break;case"info":s="mdi-information";break;case"danger":s="mdi-alert";break}let o=document.createElement("div");o.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let r=document.createElement("div");r.setAttribute("class",`toast bg-${i}`),r.setAttribute("role","alert"),r.setAttribute("aria-live","assertive"),r.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 ${s}`);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"),a.appendChild(u),a.appendChild(p),typeof n!="undefined"){let m=document.createElement("small");m.setAttribute("class","text-muted"),a.appendChild(m)}return a.appendChild(f),_.innerText=e.trim(),r.appendChild(a),r.appendChild(_),o.appendChild(r),document.body.appendChild(o),new oe(r)}re.default.extend(Ro.default);re.default.extend(jo.default);re.default.extend(ko.default);re.default.extend(Ho.default);var nu=["hostname","fqdn","vendor","model","serial_number","os_version"],su=["years","months","days","hours","minutes","seconds"];function ou(i){let t=new Date,e=t.getTimezoneOffset(),s=(0,re.default)(t).subtract(i,"seconds"),o=s.tz("Etc/UTC").format("YYYY-MM-DD HH:MM:ss z"),r=null;e!==0&&(r=s.format("YYYY-MM-DD HH:MM:ss z"));let a=re.default.duration(i,"seconds"),u=[];for(let f of su){let _=a[f]();if(_===1){let d=f.replace(/s$/,"");u=[...u,`${_} ${d}`]}else _>1&&(u=[...u,`${_} ${f}`])}let p="None";return u.length>0&&(p=u.join(", ")),{utc:o,zoned:r,duration:p}}function ru(i){for(let a of nu)if(a in i){let u=document.getElementById(a);u!==null&&(u.innerHTML=String(i[a]))}let{uptime:t}=i,{utc:e,zoned:n,duration:s}=ou(t),o=document.getElementById("uptime-duration");o!==null&&(o.innerHTML=s);let r=document.getElementById("uptime");r!==null&&(n===null?r.innerHTML=e:r.innerHTML=[n,`<span class="fst-italic d-block">${e}</span>`].join(""))}function Ue(i,t,e){let n=W("th",{innerText:t},["border-end","text-end"]),s=W("th",{innerText:e},["border-start","text-start"]),o=W("tr",{},[],[n,s]);i.insertAdjacentElement("beforebegin",o)}function Ke(i){let t=W("td",{colSpan:"2",innerText:"No Data"},["text-muted","text-center"]),e=W("tr",{},[],[t]);i!==null&&i.insertAdjacentElement("beforebegin",e)}function Ge(i){let t=document.getElementById(i);return t!==null?t.nextElementSibling:null}function au(i){let t=Ge("status-cpu");if(typeof i!="undefined"){if(t!==null){Ue(t,"Name","Usage");for(let[e,n]of Object.entries(i)){let s=n["%usage"],o=W("td",{innerText:e},["border-end","text-end"]),r=W("td",{innerText:`${s} %`},["border-start","text-start"]),a=W("tr",{},[],[o,r]);t.insertAdjacentElemen
/*!
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
*/