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

31 lines
126 KiB
JavaScript
Raw Normal View History

(()=>{var jo=Object.create;var ge=Object.defineProperty,ko=Object.defineProperties,Ho=Object.getOwnPropertyDescriptor,Wo=Object.getOwnPropertyDescriptors,Bo=Object.getOwnPropertyNames,Dn=Object.getOwnPropertySymbols,zo=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable;var xn=(i,t,e)=>t in i?ge(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,P=(i,t)=>{for(var e in t||(t={}))Nn.call(t,e)&&xn(i,e,t[e]);if(Dn)for(var e of Dn(t))Vo.call(t,e)&&xn(i,e,t[e]);return i},Fe=(i,t)=>ko(i,Wo(t)),Ln=i=>ge(i,"__esModule",{value:!0});var at=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Yo=(i,t)=>{Ln(i);for(var e in t)ge(i,e,{get:t[e],enumerable:!0})},Fo=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Bo(t))!Nn.call(i,n)&&n!=="default"&&ge(i,n,{get:()=>t[n],enumerable:!(e=Ho(t,n))||e.enumerable});return i},Bt=i=>Fo(Ln(ge(i!=null?jo(zo(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var $i=(i,t,e)=>new Promise((n,s)=>{var r=u=>{try{a(e.next(u))}catch(p){s(p)}},o=u=>{try{a(e.throw(u))}catch(p){s(p)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(r,o);a((e=e.apply(i,t)).next())});var Mn=at((Di,Ni)=>{(function(i,t){typeof Di=="object"&&typeof Ni!="undefined"?Ni.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self).dayjs=t()})(Di,function(){"use strict";var i=1e3,t=6e4,e=36e5,n="millisecond",s="second",r="minute",o="hour",a="day",u="week",p="month",f="quarter",v="year",d="date",m="Invalid Date",E=/^(\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(C,$,A){var N=String(C);return!N||N.length>=$?C:""+Array($+1-N.length).join(A)+C},g={s:c,z:function(C){var $=-C.utcOffset(),A=Math.abs($),N=Math.floor(A/60),D=A%60;return($<=0?"+":"-")+c(N,2,"0")+":"+c(D,2,"0")},m:function C($,A){if($.date()<A.date())return-C(A,$);var N=12*(A.year()-$.year())+(A.month()-$.month()),D=$.clone().add(N,p),I=A-D<0,x=$.clone().add(N+(I?-1:1),p);return+(-(N+(A-D)/(I?D-x:x-D))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:p,y:v,w:u,d:a,D:d,h:o,m:r,s,ms:n,Q:f}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},b="en",_={};_[b]=l;var y=function(C){return C instanceof L},w=function(C,$,A){var N;if(!C)return b;if(typeof C=="string")_[C]&&(N=C),$&&(_[C]=$,N=C);else{var D=C.name;_[D]=C,N=D}return!A&&N&&(b=N),N||!A&&b},O=function(C,$){if(y(C))return C.clone();var A=typeof $=="object"?$:{};return A.date=C,A.args=arguments,new L(A)},S=g;S.l=w,S.i=y,S.w=function(C,$){return O(C,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var L=function(){function C(A){this.$L=w(A.locale,null,!0),this.parse(A)}var $=C.prototype;return $.parse=function(A){this.$d=function(N){var D=N.date,I=N.utc;if(D===null)return new Date(NaN);if(S.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var x=D.match(E);if(x){var j=x[2]-1||0,k=(x[7]||"0").substring(0,3);return I?new Date(Date.UTC(x[1],j,x[3]||1,x[4]||0,x[5]||0,x[6]||0,k)):new Date(x[1],j,x[3]||1,x[4]||0,x[5]||0,x[6]||0,k)}}return new Date(D)}(A),this.$x=A.x||{},this.init()},$.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},$.$utils=function(){return S},$.isValid=function(){return this.$d.toString()!==m},$.isSame=function(A,N){var D=O(A);return this.startOf(N)<=D&&D<=this.endOf(N)},$.isAfter=function(A,N){return O(A)<this.startOf(N)},$.isBefore=function(A,N){return this.endOf(N)<O(A)},$.$g=function(A,N,D){return S.u(A)?t
`)}:!o.ok&&"detail"in u?{error:u.detail}:u})}function Co(i){return $i(this,null,function*(){return yield tu(i,"GET")})}function*Tn(...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 Tn("body > div#netbox-data > *")){let e=t.getAttribute(i);if(Zc(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 Oi(i){for(let t of Tn("div.card-overlay"))eu(t,i)}function W(i,t,e,n=[]){let s=document.createElement(i);if(t!==null)for(let r of Object.keys(t)){let o=r,a=t[o];o in s&&(s[o]=a)}s.classList.add(...e);for(let r of n)s.appendChild(r);return s}function Do(i){return i*(9/5)+32}window.Collapse=Ot;window.Modal=Pt;window.Toast=kt;window.Tooltip=Ct;function Ci(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 r=document.createElement("div");r.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 ${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 v=document.createElement("div");if(v.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),v.innerText=e.trim(),o.appendChild(a),o.appendChild(v),r.appendChild(o),document.body.appendChild(r),new kt(o)}oe.default.extend(No.default);oe.default.extend(xo.default);oe.default.extend(Mo.default);oe.default.extend(Lo.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,oe.default)(t).subtract(i,"seconds"),r=s.tz("Etc/UTC").format("YYYY-MM-DD HH:MM:ss z"),o=null;e!==0&&(o=s.format("YYYY-MM-DD HH:MM:ss z"));let a=oe.default.duration(i,"seconds"),u=[];for(let f of su){let v=a[f]();if(v===1){let d=f.replace(/s$/,"");u=[...u,`${v} ${d}`]}else v>1&&(u=[...u,`${v} ${f}`])}let p="None";return u.length>0&&(p=u.join(", ")),{utc:r,zoned:o,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),r=document.getElementById("uptime-duration");r!==null&&(r.innerHTML=s);let o=document.getElementById("uptime");o!==null&&(n===null?o.innerHTML=e:o.innerHTML=[n,`<span class="fst-italic d-block">${e}</span>`].join(""))}function Be(i,t,e){let n=W("th",{innerText:t},["border-end","text-end"]),s=W("th",{innerText:e},["border-start","text-start"]),r=W("tr",{},[],[n,s]);i.insertAdjacentElement("beforebegin",r)}function ze(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 Ve(i){let t=document.getElementById(i);return t!==null?t.nextElementSibling:null}function au(i){let t=Ve("status-cpu");if(typeof i!="undefined"){if(t!==null){Be(t,"Name","Usage");for(let[e,n]of Object.entries(i)){let s=n["%usage"],r=W("td",{innerText:e},["border-end","text-end"]),o=W("td",{innerText:`${s} %`},["border-start","text-start"]),a=W("tr",{},[],[r,o]);t.insertAdjacentElement("beforebegin",a)}}}else ze(t)}function lu(i){let t=Ve("status-memory");if(type
/*!
* Bootstrap v5.1.0 (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
*/