Fix APPID picker crash — use plain strings for SearchableSelect

SearchableSelect expects string arrays, not objects. Convert CMDB
options to strings in format 'APP_NAME | APP_ID - APPREFID [ENV]'
so filtering and display work correctly.
This commit is contained in:
Jordan Ramos
2026-06-30 14:22:27 -06:00
parent c338e6fa3b
commit 0680a82aaf

View File

@@ -81,15 +81,13 @@ export default function LoaderModal({ isOpen, onClose, initialDevices }) {
.catch(() => setCardConfigured(false));
// Load CMDB APPID data for Granite Loader APPID picker
if (!appIdOptions) {
// ⚠️ CONVENTION: Use credentials: 'include' on all fetch calls (missing here)
// ⚠️ CONVENTION: Use credentials: 'include' on all fetch calls (cookie-based auth)
fetch('/cmdb-appids.json', { credentials: 'include' })
.then(r => r.ok ? r.json() : [])
.then(data => {
// Build searchable options: label shows "APP_NAME (APP_ID) [ENV]", value is "APP_ID - APPREFID"
const opts = data.map(d => ({
label: `${d.app_name} (${d.app_id}) [${d.env}]`,
value: `${d.app_id} - ${d.apprefid}`,
}));
// Build searchable string options: "APP_NAME | APP_ID - APPREFID [ENV]"
// SearchableSelect works with plain strings; user searches by name/ID
const opts = data.map(d => `${d.app_name} | ${d.app_id} - ${d.apprefid} [${d.env}]`);
setAppIdOptions(opts);
})
.catch(() => setAppIdOptions([]));