Extract APP_ID - APPREFID from display string on selection

The SearchableSelect shows full context for searching (app name, env)
but when a selection is made, only the 'APP_ID - APPREFID' portion is
stored as the cell value. Applies to both bulk defaults and per-cell
inline edits.
This commit is contained in:
Jordan Ramos
2026-06-30 14:41:27 -06:00
parent 0680a82aaf
commit cb49b16f0b

View File

@@ -209,7 +209,11 @@ export default function LoaderModal({ isOpen, onClose, initialDevices }) {
// --- Bulk default ---
const setBulkDefault = (colId, value) => {
setBulkDefaults(prev => ({ ...prev, [colId]: value }));
// For APP_ID_ASSET_TAG, extract just "APP_ID - APPREFID" from the full display string
const resolved = (colId === 'APP_ID_ASSET_TAG' && value.includes(' | '))
? value.split(' | ')[1].replace(/\s*\[.*\]$/, '').trim()
: value;
setBulkDefaults(prev => ({ ...prev, [colId]: resolved }));
};
// --- Paste IPs (standalone mode) ---
@@ -585,9 +589,13 @@ export default function LoaderModal({ isOpen, onClose, initialDevices }) {
value={editValue}
options={getPicklist(col.id)}
onChange={(val) => {
// For APP_ID_ASSET_TAG, extract just "APP_ID - APPREFID"
const resolved = (col.id === 'APP_ID_ASSET_TAG' && val.includes(' | '))
? val.split(' | ')[1].replace(/\s*\[.*\]$/, '').trim()
: val;
setOverrides(prev => ({
...prev,
[rowIdx]: { ...(prev[rowIdx] || {}), [col.id]: val },
[rowIdx]: { ...(prev[rowIdx] || {}), [col.id]: resolved },
}));
setEditingCell(null);
}}