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 Ho=Object.create;var Ee=Object.defineProperty,Wo=Object.defineProperties,Bo=Object.getOwnPropertyDescriptor,Vo=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertyNames,Nn=Object.getOwnPropertySymbols,Yo=Object.getPrototypeOf,xn=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable;var Mn=(i,t,e)=>t in i?Ee(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,P=(i,t)=>{for(var e in t||(t={}))xn.call(t,e)&&Mn(i,e,t[e]);if(Nn)for(var e of Nn(t))Fo.call(t,e)&&Mn(i,e,t[e]);return i},Ke=(i,t)=>Wo(i,Vo(t)),In=i=>Ee(i,"__esModule",{value:!0});var lt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Uo=(i,t)=>{In(i);for(var e in t)Ee(i,e,{get:t[e],enumerable:!0})},Ko=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of zo(t))!xn.call(i,n)&&n!=="default"&&Ee(i,n,{get:()=>t[n],enumerable:!(e=Bo(t,n))||e.enumerable});return i},Wt=i=>Ko(In(Ee(i!=null?Ho(Yo(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Li=(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 Pn=lt((Ni,xi)=>{(function(i,t){typeof Ni=="object"&&typeof xi!="undefined"?xi.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self).dayjs=t()})(Ni,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 L=String($);return!L||L.length>=C?$:""+Array(C+1-L.length).join(A)+$},g={s:c,z:function($){var C=-$.utcOffset(),A=Math.abs(C),L=Math.floor(A/60),D=A%60;return(C<=0?"+":"-")+c(L,2,"0")+":"+c(D,2,"0")},m:function $(C,A){if(C.date()<A.date())return-$(A,C);var L=12*(A.year()-C.year())+(A.month()-C.month()),D=C.clone().add(L,p),I=A-D<0,x=C.clone().add(L+(I?-1:1),p);return+(-(L+(A-D)/(I?D-x:x-D))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:p,y:v,w:u,d:a,D:d,h:o,m:r,s,ms:n,Q:f}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},b="en",_={};_[b]=l;var y=function($){return $ instanceof M},O=function($,C,A){var L;if(!$)return b;if(typeof $=="string")_[$]&&(L=$),C&&(_[$]=C,L=$);else{var D=$.name;_[D]=$,L=D}return!A&&L&&(b=L),L||!A&&b},w=function($,C){if(y($))return $.clone();var A=typeof C=="object"?C:{};return A.date=$,A.args=arguments,new M(A)},S=g;S.l=O,S.i=y,S.w=function($,C){return w($,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var M=function(){function $(A){this.$L=O(A.locale,null,!0),this.parse(A)}var C=$.prototype;return C.parse=function(A){this.$d=function(L){var D=L.date,I=L.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()},C.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()},C.$utils=function(){return S},C.isValid=function(){return this.$d.toString()!==m},C.isSame=function(A,L){var D=w(A);return this.startOf(L)<=D&&D<=this.endOf(L)},C.isAfter=function(A,L){return w(A)<this.startOf(L)},C.isBefore=function(A,L){return this.endOf(L)<w(A)},C.$g=function(A,L,D){return S.u(A)?t
`)}:!o.ok&&"detail"in u?{error:u.detail}:u})}function Do(i){return Li(this,null,function*(){return yield tu(i,"GET")})}function*An(...i){for(let t of i)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function Lo(i){i.startsWith("data-")||(i=`data-${i}`);for(let t of An("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 Ci(i){for(let t of An("div.card-overlay"))eu(t,i)}function W(i,t,e=null,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)}e!==null&&e.length>0&&s.classList.add(...e);for(let r of n)s.appendChild(r);return s}function No(i){return Math.round((i*(9/5)+32+Number.EPSILON)*10)/10}window.Collapse=mt;window.Modal=ie;window.Popover=_e;window.Toast=oe;window.Tooltip=Dt;function Di(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 oe(o)}re.default.extend(xo.default);re.default.extend(Mo.default);re.default.extend(Po.default);re.default.extend(Io.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"),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=re.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 ze(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 Ye(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 Fe(i){let t=document.getElementById(i);return t!==null?t.nextElementSibling:null}function au(i){let t=Fe("status-cpu");if(typeof i!="undefined"){if(t!==null){ze(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.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
*/
/*!
* 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
*/