diff --git a/backend/app/frontend/static/mine-map.js b/backend/app/frontend/static/mine-map.js index 227e8f8..cea47a3 100644 --- a/backend/app/frontend/static/mine-map.js +++ b/backend/app/frontend/static/mine-map.js @@ -47,6 +47,11 @@ return String(value); } + function shelfLabel(value) { + const label = display(value, "Unlabelled shelf"); + return /^shelf\b/i.test(label) ? label : "Shelf " + label; + } + function words(value) { return display(value, "Unknown").replaceAll("_", " ").toLowerCase(); } @@ -497,8 +502,8 @@ rack.appendChild(create("h2", "rack-title", "Rack " + rackEntry[0])); for (const shelfEntry of rackEntry[1]) { const shelf = create("section", "map-shelf"); - shelf.setAttribute("aria-label", "Shelf " + shelfEntry[0]); - shelf.appendChild(create("h3", "shelf-title", "Shelf " + shelfEntry[0])); + shelf.setAttribute("aria-label", shelfLabel(shelfEntry[0])); + shelf.appendChild(create("h3", "shelf-title", shelfLabel(shelfEntry[0]))); const grid = create("div", "position-grid"); for (const position of shelfEntry[1]) { grid.appendChild(positionTile(position, scale)); @@ -607,10 +612,10 @@ detailRow("Current IP", position.current_ip); const location = position.room_id ? [position.site_name, position.room_name, "Rack " + position.rack_name, - "Shelf " + position.shelf_name, display(position.position_label, + shelfLabel(position.shelf_name), display(position.position_label, "Position " + position.position_index)].join(" / ") : ["Unscoped", "Room label " + display(position.room_name), - "Rack " + display(position.rack_name), "Shelf " + display(position.shelf_name), + "Rack " + display(position.rack_name), shelfLabel(position.shelf_name), display(position.position_label, "Position " + position.position_index)].join(" / "); detailRow("Location", location); detailRow("Lifecycle", words(position.lifecycle_status));