Listings
Production
Testing
Development
These were pulled using the following JavaScript ran in the browser console:
Then paste this output into a "markup" block!
JavaScript to Determine Offices
let envSites = [
{env: "Production", domain: "https://water.usace.army.mil/office"},
{env: "Test", domain: "https://water-test.cwbi.us/office"},
{env: "Development", domain: "https://water.dev.cwbi.us/office"}
]
envSites.forEach(site=> {
fetch("https://cwms-data.usace.army.mil/cwms-data/offices")
.then(r => r.json())
.then(offices => {
const districts = offices.filter(o => o.type === "DIS");
return Promise.allSettled(
districts.map(d =>
fetch(`${site.domain}/${d.name.toLowerCase()}`)
.then(resp => {
if (resp.ok) return `[${d.name} - ${d["long-name"]}](${site.domain}/${d.name})`; // return long-name if request works
throw new Error("Not found");
})
)
);
})
.then(results => {
const liveSites = results
.filter(r => r.status === "fulfilled")
.map(r => r.value);
console.log(site.env + "\n" + liveSites.join("\n\n"));
})
.catch(err => console.error(err));
})