🥇 1st Infinity Portal extension
👍 Endorsed by SD-WAN product managers
Infinity Portal Extension to visualize SD-WAN sites on a world map.
SD-WAN agents
https://portal.checkpoint.com/dashboard/sd-wan#/sd-wan-network/agents
Extension code
Copy the code below into the address field of a new bookmark. Click it to enable the map.
javascript:(()=>{if(null!==document.getElementById("_map"))return;function e(){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css",e.crossorigin="",document.head.appendChild(e);let t=document.createElement("script");t.type="text/javascript",t.src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js",t.crossorigin="",document.head.appendChild(t)}function t(){e();let t=document.createElement("a");t.id="_map",t.href="#",t.role="tab",t.dataset.rbEventKey="geomap",["cp-tab-header","nav-link"].forEach(e=>t.classList.add(e));let r=document.createElement("span");r.classList.add("content");let s=document.createElement("span");s.classList.add("title"),s.title="geo map",s.innerText="geo map",r.appendChild(s),t.appendChild(r);let l=document.querySelector(".cp-tabs-list.nav .row");l.append(t);let n=document.querySelector(".cp-tab-content.tab-content"),c=document.createElement("div");c.role="tabpanel",c.ariaHidden="true",["fade","cp-tabs-pane","tab-pane"].forEach(e=>c.classList.add(e)),c.style.padding="10px",n.append(c);let o=l.querySelector(".cp-tab-header.active"),d=n.querySelector(".cp-tabs-pane.active.show");function p(){t.classList.remove("active"),t.ariaSelected="false",c.classList.remove("active"),c.classList.remove("show"),c.ariaHidden="true",o.classList.add("active"),o.ariaSelected="true",d.classList.add("active"),d.classList.add("show"),d.ariaHdden="false"}p();let h=document.querySelector(".rdg.cp-grid.entities-table"),m=h.querySelector('.rdg-row[aria-selected="true"]')?.ariaRowIndex;h.addEventListener("click",e=>{if(e.target.classList.contains("rdg-cell")&&e.target.parentElement.ariaRowIndex!==m){let a="true"===t.ariaSelected;p(),m=e.target.ariaRowIndex,setImmediate(()=>l.append(t),1),a&&setImmediate(()=>g(),1)}});let f=document.createElement("div");function g(){function e(t){t.preventDefault(),p(),o.removeEventListener("click",e)}o=l.querySelector(".active"),d=n.querySelector(".cp-tabs-pane.active.show"),l.querySelectorAll(".cp-tab-header").forEach(e=>e.classList.remove("active")),l.querySelectorAll(".cp-tab-header").forEach(e=>e.ariaSelected="false"),n.querySelectorAll(".cp-tabs-pane").forEach(e=>{e.classList.remove("active"),e.classList.remove("show"),e.ariaHidden="true"}),t.classList.add("active"),t.ariaSelected="true",c.classList.add("active"),c.classList.add("show"),c.ariaHidden="false",o.addEventListener("click",e,{once:!0})}f.style.width="100%",f.style.height="100%",f.style["flex-shrink"]="0",c.append(f),i().then(async e=>{for(;!window.L;)await new Promise(e=>setTimeout(e,50));let t=L.map(f,{maxZoom:19}).setView([0,0],0);L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:""}).addTo(t);let r=new ResizeObserver(()=>t.invalidateSize());r.observe(f);let i=await Promise.allSettled(e.map(async({ip:e,name:t})=>({...await a(e),ip:e,name:t}))).then(e=>e.filter(e=>"fulfilled"===e.status).map(e=>e.value)),s=[];for(let l of i){let{name:n,ip:c,lat:o,lon:d}=l,p=L.marker([o,d]).addTo(t),h=`<p>IP: ${c}, Name: ${n??"N/A"}</p>`;p.bindPopup(h),p.bindTooltip(h),s.push(p)}}),t.addEventListener("click",e=>{e.preventDefault(),g()}),g()}function a(e){return fetch(`https://ipinfo.io/${encodeURIComponent(e)}`,{headers:{Accept:"application/json"}}).then(e=>e.json()).then(e=>[e,e.loc.split(",").map(e=>parseFloat(e))]).then(([e,[t,a]])=>({...e,lat:t,lon:a}))}let r={operationName:"Agents",variables:{matchSearch:[""],filters:{status:["Connected"]},paging:{offset:0,limit:50},sortBy:{field:"name",order:"ascending"}},query:"query Agents($matchSearch:[String],$filters:AgentsFilter,$paging:Paging,$sortBy:SortBy){getAgents(matchSearch:$matchSearch,filters:$filters,paging:$paging,sortBy:$sortBy){id,name,... on TokenAgent {ip}}}"};async function i(){let e=window?.localStorage?.csrf,t="";if(!e){alert("There is no access-token, please try to reload the page.");return}try{t=await (await fetch("https://cloudinfra-gw.portal.checkpoint.com/app/sd-wan/graphql",{headers:{"content-type":"application/json","x-access-token":e},body:JSON.stringify(r),method:"POST",credentials:"include"})).json()}catch(a){console.log(a)}return t?.data?.getAgents?.map(e=>({ip:`${e.ip}`||"",name:`${e.name}`||""}))??[]}t()})();