-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/production' into issue-4801
- Loading branch information
Showing
32 changed files
with
580 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
specifyweb/frontend/js_src/lib/components/FormEditor/helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import type { RR } from '../../utils/types'; | ||
import type { Tables } from '../DataModel/types'; | ||
|
||
export const tablesWithBusRulesIn6 = new Set([ | ||
'AccessionAgentBusRules', | ||
'AccessionAuthorizationBusRules', | ||
'AccessionBusRules', | ||
'AddressBusRules', | ||
'AgentBusRules', | ||
'AppraisalBusRules', | ||
'AttachmentBusRules', | ||
'AuthorBusRules', | ||
'BioStratBusRules', | ||
'BorrowBusRules', | ||
'CatalogNumberingSchemeBusRules', | ||
'CatAutoNumberingSchemeBusRules', | ||
'CollectingEventBusRules', | ||
'CollectingTripAuthorizationBusRules', | ||
'CollectingTripBusRules', | ||
'CollectionBusRules', | ||
'CollectionObjectBusRules', | ||
'CollectorBusRules', | ||
'ConservDescriptionBusRules', | ||
'ConservEventBusRules', | ||
'ContainerBusRules', | ||
'DataTypeBusRules', | ||
'DeaccessionAgentBusRules', | ||
'DeterminationBusRules', | ||
'DeterminerBusRules', | ||
'DisciplineBusRules', | ||
'DivisionBusRules', | ||
'DNASequenceBusRules', | ||
'DNASequencingRunBusRules', | ||
'ExchangeOutBusRules', | ||
'ExchangeOutPrepBusRules', | ||
'ExtractorBusRules', | ||
'FieldNotebookBusRules', | ||
'FieldNotebookPageSetBusRules', | ||
'FundingAgentBusRules', | ||
'GeographyBusRules', | ||
'GeologicTimePeriodBusRules', | ||
'GiftBusRules', | ||
'GiftPreparationBusRules', | ||
'GroupPersonBusRules', | ||
'InfoRequestBusRules', | ||
'LithoStratBusRules', | ||
'LoanBusRules', | ||
'LoanGiftShipmentBusRules', | ||
'LoanPreparationBusRules', | ||
'LoanReturnPreparationBusRules', | ||
'LocalityBusRules', | ||
'PcrPersonBusRules', | ||
'PermitBusRules', | ||
'PickListBusRules', | ||
'PreparationBusRules', | ||
'PrepTypeBusRules', | ||
'SpecifyUserBusRules', | ||
'StorageBusRules', | ||
'TaxonBusRules', | ||
'TreatmentEventBusRules', | ||
'TreeDefBusRules', | ||
]); | ||
|
||
/** | ||
* Most of the time business rules class name can be inferred from table name. | ||
* Exceptions: | ||
*/ | ||
export const businessRulesOverride: Partial<RR<keyof Tables, string>> = { | ||
Shipment: 'LoanGiftShipment', | ||
CollectionObjectAttachment: 'Attachment', | ||
}; | ||
|
||
export const getBusinessRuleClassFromTable = ( | ||
tableName: keyof Tables | ||
): string => | ||
businessRulesOverride[tableName] === undefined | ||
? tablesWithBusRulesIn6.has(`${tableName}BusRules`) | ||
? `edu.ku.brc.specify.datamodel.busrules.${tableName}BusRules` | ||
: '' | ||
: `edu.ku.brc.specify.datamodel.busrules.${businessRulesOverride[ | ||
tableName | ||
]!}BusRules`; |
Oops, something went wrong.