Skip to content

Commit

Permalink
Expand merging to Localities, Paleo Ctxt, Collecting Event
Browse files Browse the repository at this point in the history
Fixes #4046
  • Loading branch information
CarolineDenis committed Mar 4, 2024
1 parent 9044ffc commit b62a79b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 15 additions & 2 deletions specifyweb/frontend/js_src/lib/components/FormMeta/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { interactionTables } from '../Interactions/config';
import { Dialog } from '../Molecules/Dialog';
import {
ProtectedAction,
ProtectedTable,
ProtectedTool,
} from '../Permissions/PermissionDenied';
import { UnloadProtectsContext } from '../Router/UnloadProtect';
Expand All @@ -38,6 +39,8 @@ import { QueryTreeUsages } from './QueryTreeUsages';
import { ReadOnlyMode } from './ReadOnlyMode';
import { ShareRecord } from './ShareRecord';
import { SubViewMeta } from './SubViewMeta';
import { MergeRecord } from './MergeRecord';
import { recordMergingTables } from '../Merging';

/**
* Form preferences host context aware user preferences and other meta-actions.
Expand Down Expand Up @@ -213,8 +216,18 @@ function MetaDialog({
))}
</ProtectedAction>
</ProtectedTool>
{/* FEATURE: A merge records button. See previous implementation at
commit 0274eb2 */}
<ProtectedAction action="update" resource="/permissions/roles">
<ProtectedAction action="delete" resource="/permissions/roles">
<ProtectedTable
action="update"
tableName={resource.specifyTable.name}
>
{recordMergingTables.has(resource.specifyTable.name) && (
<MergeRecord resource={resource} />
)}
</ProtectedTable>
</ProtectedAction>
</ProtectedAction>
</>
}
header={formsText.recordInformation()}
Expand Down
8 changes: 8 additions & 0 deletions specifyweb/frontend/js_src/lib/components/Merging/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ import { recordMergingTableSpec } from './definitions';
import { InvalidMergeRecordsDialog } from './InvalidMergeRecords';
import { mergingQueryParameter } from './queryString';
import { Status } from './Status';
import { Tables } from '../DataModel/types';

export const recordMergingTables = new Set<keyof Tables>([
'Agent',
'Locality',
'PaleoContext',
'CollectingEvent',
]);

export function RecordMergingLink({
table,
Expand Down

0 comments on commit b62a79b

Please sign in to comment.