diff --git a/src/components/recordedit/form-row.tsx b/src/components/recordedit/form-row.tsx index 321870da3..d7ab7119a 100644 --- a/src/components/recordedit/form-row.tsx +++ b/src/components/recordedit/form-row.tsx @@ -319,7 +319,7 @@ const FormRow = ({ const safeClassNameId = `${formNumber}-${makeSafeIdAttr(column.displayname.value)}`; const tempForeignKeyCallbacks = { ...foreignKeyCallbacks }; - const prefill = reference.bulkCreateForeignKeyObject; + const bulkFKObject = reference.bulkCreateForeignKeyObject; /** * add foreignkey callbacks to generated input if: * - there is a bulkCreateForeignKeyObject defined @@ -327,10 +327,10 @@ const FormRow = ({ * - the column is a foreignkey * - and the column is the one used for associating to the leaf table of the association */ - if (prefill?.isUnique && column.isForeignKey && prefill.leafColumn.name === colName) { + if (bulkFKObject?.isUnique && column.isForeignKey && bulkFKObject.leafColumn.name === colName) { tempForeignKeyCallbacks.getDisabledTuples = disabledTuplesPromise( column.reference.contextualize.compactSelectForeignKey, - prefill.disabledRowsFilter(), + bulkFKObject.disabledRowsFilter(), bulkForeignKeySelectedRows ); diff --git a/src/components/recordedit/recordedit.tsx b/src/components/recordedit/recordedit.tsx index f553ac2ff..54f5fd632 100644 --- a/src/components/recordedit/recordedit.tsx +++ b/src/components/recordedit/recordedit.tsx @@ -107,7 +107,7 @@ const RecordeditInner = ({ const { validateSessionBeforeMutation } = useAuthn(); const { errors, dispatchError } = useError(); - const { addAlert } = useAlert(); + const { addTooManyFormsAlert } = useAlert(); const { appMode, columnModels, config, foreignKeyData, initialized, modalOptions, prefillObject, bulkForeignKeySelectedRows, setbulkForeignKeySelectedRows, @@ -323,7 +323,6 @@ const RecordeditInner = ({ const domainRef: any = bulkFKObject.leafColumn.reference; const andFilters: any[] = bulkFKObject.andFiltersForLeaf(); - // TODO: think about this more if it's required in this context // if filter in source is based on the related table, then we would need to add it as a hidden custom filter here. let customFacets: any = null; if ( @@ -452,7 +451,7 @@ const RecordeditInner = ({ const numberFormsAllowed = MAX_ROWS_TO_ADD - numberForms let alertMessage = `Cannot add ${numberFormsToAdd} records. Please input a value between 1 and ${numberFormsAllowed}, inclusive.`; if (numberFormsAllowed === 0) alertMessage = `Cannot add ${numberFormsToAdd} records. Maximum number of forms already added.`; - addAlert(alertMessage, ChaiseAlertType.ERROR); + addTooManyFormsAlert(alertMessage, ChaiseAlertType.ERROR); setShowCloneSpinner(false); return true; } diff --git a/src/providers/alerts.tsx b/src/providers/alerts.tsx index 21f0c8b8a..936da7184 100644 --- a/src/providers/alerts.tsx +++ b/src/providers/alerts.tsx @@ -47,7 +47,7 @@ export const AlertsContext = createContext<{ removeAlert: RemoveAlertFunction, addURLLimitAlert: () => void, removeURLLimitAlert: () => void, - addTooManyFormsAlert:(message: string) => void, + addTooManyFormsAlert:(message: string, type: ChaiseAlertType) => void, removeTooManyFormsAlert:() => void, removeAllAlerts: () => void, } | @@ -126,10 +126,10 @@ export default function AlertsProvider({ children }: AlertsProviderProps): JSX.E urlLimitAlert.current = null; } - const addTooManyFormsAlert = (message: string) => { + const addTooManyFormsAlert = (message: string, type: ChaiseAlertType) => { if (tooManyFormsAlert.current) return; - tooManyFormsAlert.current = addAlert(message, ChaiseAlertType.WARNING, () => tooManyFormsAlert.current = null) + tooManyFormsAlert.current = addAlert(message, type, () => tooManyFormsAlert.current = null) } const removeTooManyFormsAlert = () => { diff --git a/src/providers/recordset.tsx b/src/providers/recordset.tsx index f0c845dff..90890acd7 100644 --- a/src/providers/recordset.tsx +++ b/src/providers/recordset.tsx @@ -367,7 +367,7 @@ export default function RecordsetProvider({ if (numberFormsAllowed === 0) alertMessage = `Cannot select ${res.length} records. Maximum number of forms already added.`; if (temp === false) { - addTooManyFormsAlert(alertMessage) + addTooManyFormsAlert(alertMessage, ChaiseAlertType.WARNING); } else { removeTooManyFormsAlert(); } diff --git a/test/e2e/specs/delete-prohibited/recordset/facet.config.ts b/test/e2e/specs/delete-prohibited/recordset/facet.config.ts index 12fab1945..2fda70bd3 100644 --- a/test/e2e/specs/delete-prohibited/recordset/facet.config.ts +++ b/test/e2e/specs/delete-prohibited/recordset/facet.config.ts @@ -5,10 +5,10 @@ export default getConfig({ configFileName: 'recordset/facet.dev.json', mainSpecName: 'delete-prohibited', testMatch: [ - // 'facet-presentation.spec.ts', - // 'individual-facet.spec.ts', - // 'four-facet-selections.spec.ts', + 'facet-presentation.spec.ts', + 'individual-facet.spec.ts', + 'four-facet-selections.spec.ts', 'misc-facet.spec.ts', - // 'reorder-facet.spec.ts' + 'reorder-facet.spec.ts' ] });