PageSourceSearch

https://vizops360.ai/assets/serverStore-B4Gp3qM-.js

js vizops360.ai collected 2026-10-05 13:51:01 UTC 3,268 bytes, 1 lines download raw bytes

1import{aP as y,aH as d}from"./index-CpeGhXo5.js";const u=e=>{if(!e)return"";try{const t=JSON.parse(e);return Array.isArray(t)?t[0]||"":String(e)}catch{return String(e)}},h=e=>{const t=u(e.ramCapacity),r=parseInt(t.replace(/[^0-9]/g,""),10)||16,s=u(e.storageCapacity)||"1TB SSD",a=u(e.ipAddress)||(typeof e.ipAddress=="string"?e.ipAddress:"192.168.1.100"),n=e.name||`${e.brand||""} ${e.model||""}`.trim()||"Server";return{id:e.id||e.assetTag||`SRV-${Math.floor(Math.random()*9e3)+1e3}`,assetTag:e.assetTag,name:n,hostname:e.hostname||n.toLowerCase().replace(/[^a-z0-9]/g,"-"),ipAddress:a,serverType:e.model&&e.model.includes("Server")?e.model:"Database Server",environment:"Production",status:e.status==="In Repair"?"Maintenance":e.status==="Retired"?"Offline":"Online",osName:e.os||"Ubuntu Server",osVersion:e.os||"22.04 LTS",osArchitecture:"64-bit",licenseInfo:"Standard",cpuModel:e.processor||"Intel Xeon",cpuCores:8,cpuThreads:16,ramCapacityGB:r,storageCapacity:s,storageType:s.toLowerCase().includes("nvme")?"NVMe":s.toLowerCase().includes("hdd")?"HDD":"SSD",raidConfig:"RAID 1",networkAdapterDetails:"1 Gbps Ethernet",adminUsername:"root",sshRdpPort:22,domainName:"local",currentCpuUsage:15,currentRamUsage:45,currentStorageUsage:30,lastRebootTime:e.purchaseDate||"Recently",uptime:"99.9%",lastHealthCheck:"Today",assignedDepartment:e.department||"IT",responsiblePerson:e.assignedTo||"Unassigned",datacenterLocation:"Main DC",rackNumber:"Rack-01",backupEnabled:!0,backupFrequency:"Daily",antivirusInstalled:!0,firewallEnabled:!0,notes:e.notes||"",lastUpdated:e.purchaseDate||"Today",serialNumber:e.serialNumber}};let l=null,v=0;const g=y((e,t)=>({servers:[],timelineEvents:[],fetchServers:async()=>{if(l)return l;if(!(Date.now()-v<3e3&&t().servers.length>0))return l=(async()=>{try{const r=await d.get("/sysadmin/servers"),s=r.data?.data||r.data||[],a=Array.isArray(s)?s:[];let n=[];try{const o=await d.get("/sysadmin/assets"),m=o.data?.data||o.data||[];n=(Array.isArray(m)?m.filter(p=>p.category==="Server"||p.customCategory==="Server"):[]).map(h)}catch(o){console.error("Failed to load server assets for merge:",o)}const i=[...a];n.forEach(o=>{i.some(c=>c.id===o.id||c.assetTag===o.assetTag||o.serialNumber&&c.serialNumber===o.serialNumber||c.name.toLowerCase()===o.name.toLowerCase())||i.push(o)}),e({servers:i}),v=Date.now()}catch(r){console.error("Error fetching servers:",r)}finally{l=null}})(),l},addServer:async r=>{try{const s=await d.post("/sysadmin/servers",r),a=s.data?.data||s.data||r;e({servers:[...t().servers,a]})}catch(s){console.error("API failed, falling back to local state",s),e({servers:[...t().servers,r]})}},updateServer:async(r,s)=>{try{const a=await d.patch(`/sysadmin/servers/${r}`,s),n=a.data?.data||a.data||s;e({servers:t().servers.map(i=>i.id===r?{...i,...n}:i)})}catch(a){console.error("API failed, falling back to local state",a),e({servers:t().servers.map(n=>n.id===r?{...n,...s}:n)})}},deleteServer:async r=>{try{await d.delete(`/sysadmin/servers/${r}`),e({servers:t().servers.filter(s=>s.id!==r)})}catch(s){console.error("API failed, falling back to local state",s),e({servers:t().servers.filter(a=>a.id!==r)})}},addTimelineEvent:r=>{e({timelineEvents:[{...r,id:`EVT-${Date.now()}`},...t().timelineEvents]})}}));export{g as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.