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
133 KiB
JavaScript
Raw Normal View History

(()=>{var co=Object.create;var Te=Object.defineProperty,lo=Object.defineProperties,uo=Object.getOwnPropertyDescriptor,fo=Object.getOwnPropertyDescriptors,ho=Object.getOwnPropertyNames,Pi=Object.getOwnPropertySymbols,po=Object.getPrototypeOf,Ri=Object.prototype.hasOwnProperty,mo=Object.prototype.propertyIsEnumerable;var ji=(n,t,e)=>t in n?Te(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,P=(n,t)=>{for(var e in t||(t={}))Ri.call(t,e)&&ji(n,e,t[e]);if(Pi)for(var e of Pi(t))mo.call(t,e)&&ji(n,e,t[e]);return n},Xe=(n,t)=>lo(n,fo(t)),ki=n=>Te(n,"__esModule",{value:!0});var G=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),go=(n,t)=>{ki(n);for(var e in t)Te(n,e,{get:t[e],enumerable:!0})},_o=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ho(t))!Ri.call(n,i)&&i!=="default"&&Te(n,i,{get:()=>t[i],enumerable:!(e=uo(t,i))||e.enumerable});return n},Mt=n=>_o(ki(Te(n!=null?co(po(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var In=(n,t,e)=>new Promise((i,r)=>{var o=u=>{try{a(e.next(u))}catch(h){r(h)}},s=u=>{try{a(e.throw(u))}catch(h){r(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(o,s);a((e=e.apply(n,t)).next())});var Hi=G((Pn,Rn)=>{(function(n,t){typeof Pn=="object"&&typeof Rn!="undefined"?Rn.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self).dayjs=t()})(Pn,function(){"use strict";var n=1e3,t=6e4,e=36e5,i="millisecond",r="second",o="minute",s="hour",a="day",u="week",h="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+)?$/,p=/\[([^\]]+)]|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,c={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("_")},l=function($,C,A){var x=String($);return!x||x.length>=C?$:""+Array(C+1-x.length).join(A)+$},g={s:l,z:function($){var C=-$.utcOffset(),A=Math.abs(C),x=Math.floor(A/60),D=A%60;return(C<=0?"+":"-")+l(x,2,"0")+":"+l(D,2,"0")},m:function $(C,A){if(C.date()<A.date())return-$(A,C);var x=12*(A.year()-C.year())+(A.month()-C.month()),D=C.clone().add(x,h),I=A-D<0,L=C.clone().add(x+(I?-1:1),h);return+(-(x+(A-D)/(I?D-L:L-D))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:v,w:u,d:a,D:d,h:s,m:o,s:r,ms:i,Q:f}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},b="en",_={};_[b]=c;var y=function($){return $ instanceof M},O=function($,C,A){var x;if(!$)return b;if(typeof $=="string")_[$]&&(x=$),C&&(_[$]=C,x=$);else{var D=$.name;_[D]=$,x=D}return!A&&x&&(b=x),x||!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(x){var D=x.date,I=x.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 L=D.match(E);if(L){var j=L[2]-1||0,k=(L[7]||"0").substring(0,3);return I?new Date(Date.UTC(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[6]||0,k)):new Date(L[1],j,L[3]||1,L[4]||0,L[5]||0,L[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,x){var D=w(A);return this.startOf(x)<=D&&D<=this.endOf(x)},C.isAfter=function(A,x){return w(A)<this.startOf(x)},C.isBefore=function(A,x){return this.endOf(x)<w(A)},C.$g=function(A,x,D){return S.u(A)?t
`)}:!a.ok&&"detail"in h?{error:h.detail}:h})}function Zs(n){return In(this,null,function*(){return yield Ru(n,"GET")})}function*Ci(...n){for(let t of n)for(let e of document.querySelectorAll(t))e!==null&&(yield e)}function Js(n){n.startsWith("data-")||(n=`data-${n}`);for(let t of Ci("body > div#netbox-data > *")){let e=t.getAttribute(n);if(Nu(e))return e}return null}function ju(n,t){n!==null&&(typeof t=="undefined"?window.getComputedStyle(n).display==="none"?n.style.display="":n.style.display="none":t==="show"?n.style.display="":n.style.display="none")}function Ln(n){for(let t of Ci("div.card-overlay"))ju(t,n)}function W(n,t,e=null,i=[]){let r=document.createElement(n);if(t!==null)for(let o of Object.keys(t)){let s=o,a=t[s];s in r&&(r[s]=a)}e!==null&&e.length>0&&r.classList.add(...e);for(let o of i)r.appendChild(o);return r}function to(n){return n*(9/5)+32}window.Collapse=_t;window.Modal=re;window.Popover=ye;window.Toast=ae;window.Tooltip=Nt;function Mn(n,t,e,i){let r="mdi-alert";switch(n){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 o=document.createElement("div");o.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let s=document.createElement("div");s.setAttribute("class",`toast bg-${n}`),s.setAttribute("role","alert"),s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true");let a=document.createElement("div");a.setAttribute("class",`toast-header bg-${n} 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 v=document.createElement("div");if(v.setAttribute("class","toast-body"),a.appendChild(u),a.appendChild(h),typeof i!="undefined"){let m=document.createElement("small");m.setAttribute("class","text-muted"),a.appendChild(m)}return a.appendChild(f),v.innerText=e.trim(),s.appendChild(a),s.appendChild(v),o.appendChild(s),document.body.appendChild(o),new ae(s)}le.default.extend(eo.default);le.default.extend(no.default);le.default.extend(ro.default);le.default.extend(io.default);var Hu=["hostname","fqdn","vendor","model","serial_number","os_version"],Wu=["years","months","days","hours","minutes","seconds"];function Bu(n){let t=new Date,e=t.getTimezoneOffset(),r=(0,le.default)(t).subtract(n,"seconds"),o=r.tz("Etc/UTC").format("YYYY-MM-DD HH:MM:ss z"),s=null;e!==0&&(s=r.format("YYYY-MM-DD HH:MM:ss z"));let a=le.default.duration(n,"seconds"),u=[];for(let f of Wu){let v=a[f]();if(v===1){let d=f.replace(/s$/,"");u=[...u,`${v} ${d}`]}else v>1&&(u=[...u,`${v} ${f}`])}let h="None";return u.length>0&&(h=u.join(", ")),{utc:o,zoned:s,duration:h}}function Vu(n){for(let a of Hu)if(a in n){let u=document.getElementById(a);u!==null&&(u.innerHTML=String(n[a]))}let{uptime:t}=n,{utc:e,zoned:i,duration:r}=Bu(t),o=document.getElementById("uptime-duration");o!==null&&(o.innerHTML=r);let s=document.getElementById("uptime");s!==null&&(i===null?s.innerHTML=e:s.innerHTML=[i,`<span class="fst-italic d-block">${e}</span>`].join(""))}function Ue(n,t,e){let i=W("th",{innerText:t},["border-end","text-end"]),r=W("th",{innerText:e},["border-start","text-start"]),o=W("tr",{},[],[i,r]);n.insertAdjacentElement("beforebegin",o)}function Ke(n){let t=W("td",{colSpan:"2",innerText:"No Data"},["text-muted","text-center"]),e=W("tr",{},[],[t]);n!==null&&n.insertAdjacentElement("beforebegin",e)}function qe(n){let t=document.getElementById(n);return t!==null?t.nextElementSibling:null}function zu(n){let t=qe("status-cpu");if(typeof n!="undefined"){if(t!==null){Ue(t,"Name","Usage");for(let[e,i]of Object.entries(n)){let r=i["%usage"],o=W("td",{innerText:e},["border-end","text-end"]),s=W("td",{innerText:`${r} %`},["border-start","text-start"]),a=W("tr",{},[],[o,s]);t.insertAdjacentElement("beforebegin",a)}}}else Ke(t)}fun
/*!
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
*/