demo: contractor links — respect the /lakehouse path prefix

J reported https://devop.live/contractor?name=3115%20W%20POLK%20ST.%20LLC
returned 404. Cause: the anchor href was a bare /contractor, which on
devop.live routes to the LLM Team UI (port 5000) at the main site root,
not the lakehouse mcp-server (which lives under /lakehouse/*).

Every page that renders a contractor link now uses the same prefix
detector the dashboard already had:

  var P = location.pathname.indexOf('/lakehouse') >= 0 ? '/lakehouse' : '';

Files updated:
- search.html: entity-brief anchor + preview anchor → P+/contractor
- console.html: permit-card contractor list → P+/contractor
- contractor.html: history.replaceState + back-link + the
  /intelligence/contractor_profile fetch all use P prefix. The page
  is reachable at /lakehouse/contractor on the public URL and bare
  /contractor on localhost; both work without further config.

Verified:
  https://devop.live/lakehouse/contractor?name=3115%20W%20POLK%20ST.%20LLC
    → 200, 29.9 KB, full profile renders. Contractor has 1 permit on
    file (a small LLC), 1 geocoded so the heat map plots one marker.
This commit is contained in:
root
2026-04-28 06:01:04 -05:00
parent a1066db87b
commit 31d8ef918c
3 changed files with 14 additions and 5 deletions
+11 -2
View File
@@ -66,6 +66,12 @@ body{font-family:'Inter',-apple-system,system-ui,sans-serif;background:#090c10;c
<script>
function $(id){return document.getElementById(id)}
// Path prefix detection — devop.live serves this page under /lakehouse,
// localhost:3700 serves it at root. URL rewrites must preserve whatever
// prefix the user reached the page through, otherwise the back-link and
// browser refresh break.
var P=location.pathname.indexOf('/lakehouse')>=0?'/lakehouse':'';
// Bootstrap from URL: /contractor?name=Turner+Construction
window.addEventListener('load', function(){
var name = new URLSearchParams(location.search).get('name');
@@ -73,19 +79,22 @@ window.addEventListener('load', function(){
$('q').value = name;
lookup();
}
// Back link respects the prefix too
var back=document.querySelector('.bar a');
if(back) back.href=P+'/';
});
function lookup(){
var name = $('q').value.trim();
if(!name){ $('out').textContent = ''; return; }
history.replaceState({}, '', '/contractor?name='+encodeURIComponent(name));
history.replaceState({}, '', P+'/contractor?name='+encodeURIComponent(name));
var out = $('out');
out.textContent = '';
var ld = document.createElement('div');
ld.className = 'ld';
ld.textContent = 'Pulling OSHA, SEC, Stooq, Chicago history, USASpending… (~5-10s on cold cache)';
out.appendChild(ld);
fetch('/intelligence/contractor_profile',{
fetch(P+'/intelligence/contractor_profile',{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({name:name})