RV: prefilter by current_state_id; hide UUID column client-side
This commit is contained in:
parent
0621bd0a67
commit
8d7b965418
@ -25,6 +25,17 @@ export const RECORD_VIEW_IDS = {
|
||||
SCHEDULED_TEST_DRIVES: "rv-mahindra-scheduled-td",
|
||||
} as const;
|
||||
|
||||
// rv_uid -> field_keys that should NOT render as table columns even though
|
||||
// they're declared on the RV. current_state_id lives on these RVs only so the
|
||||
// server-side prefilter validator accepts it; the rendered table doesn't need
|
||||
// the raw UUID column.
|
||||
export const RV_HIDDEN_COLUMNS: Record<string, string[]> = {
|
||||
"rv-mahindra-active-scheduling": ["current_state_id"],
|
||||
"rv-mahindra-scheduled-td": ["current_state_id"],
|
||||
"rv-mahindra-pending-feedback": ["current_state_id"],
|
||||
"rv-mahindra-completed": ["current_state_id"],
|
||||
};
|
||||
|
||||
export const DETAIL_VIEW_IDS = {
|
||||
INSTANCE_DETAIL: "7865e1d9-9f7c-489e-a12b-98463ebbb5c1",
|
||||
} as const;
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
type SearchQuery, type TileValue, type ChartDataResponse,
|
||||
type AuditEntry,
|
||||
} from "../api/viewService";
|
||||
import { WORKFLOW_ID } from "../config";
|
||||
import { WORKFLOW_ID, RV_HIDDEN_COLUMNS } from "../config";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// rv-screen layout walkers (same logic the production RecordViewTable uses;
|
||||
@ -241,7 +241,8 @@ export function useRecordView(viewId: number | string | null): UseRecordViewStat
|
||||
const res = await getRecordView(rvTemplateUid, viewId, query);
|
||||
setTileValues(res.tile_values ?? []);
|
||||
setChartData(res.chart_data ?? []);
|
||||
setFields(res.config.fields.filter((f) => f.field_key !== ""));
|
||||
const hidden = new Set(RV_HIDDEN_COLUMNS[rvTemplateUid] ?? []);
|
||||
setFields(res.config.fields.filter((f) => f.field_key !== "" && !hidden.has(f.field_key)));
|
||||
const dataRows = Array.isArray(res.data) ? res.data : [];
|
||||
setRows(dataRows);
|
||||
if (res.pagination) setPagination(res.pagination);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user