Skip to content

Commit

Permalink
OCLOMRS-1094: Use concept url when removing concept from collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Piumal1999 committed Mar 22, 2022
1 parent 0de0c31 commit 0458c09
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/apps/concepts/components/ConceptsActionMenu.tsx
Expand Up @@ -34,7 +34,7 @@ const addConceptsToDictionaryMenu = (
};

const removeConceptsFromDictionaryMenu = (
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void,
removeConceptsFromDictionary: (conceptUrls: string[]) => void,
row: APIConcept,
toggleMenu: (
index: number,
Expand All @@ -46,7 +46,7 @@ const removeConceptsFromDictionaryMenu = (
<MenuItem
onClick={() => {
if (removeConceptsFromDictionary)
removeConceptsFromDictionary([row.version_url]);
removeConceptsFromDictionary([row.url]);
toggleMenu(index);
}}
>
Expand Down Expand Up @@ -105,7 +105,7 @@ const removeMenu = (
event?: React.MouseEvent<HTMLButtonElement, MouseEvent> | undefined
) => void,
linkedSource: string | undefined,
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void
removeConceptsFromDictionary: (conceptUrls: string[]) => void
) => {
return !showRemoveFromDictionaryMenuItem(row, buttons.edit, linkedSource)
? null
Expand Down Expand Up @@ -144,7 +144,7 @@ interface ConceptsActionMenuProps {
) => void;
menu: { index: number; anchor: null | HTMLElement };
canModifyConcept: (concept: APIConcept) => boolean;
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void;
removeConceptsFromDictionary: (conceptUrls: string[]) => void;
addConceptsToDictionary: Function;
linkedSource: string | undefined;
linkedDictionary: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/concepts/components/ConceptsTable.tsx
Expand Up @@ -20,7 +20,7 @@ interface Props extends QueryParams {
buttons?: { [key: string]: boolean };
addConceptsToDictionary: Function;
dictionaryToAddTo?: string;
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void;
removeConceptsFromDictionary: (conceptUrls: string[]) => void;
linkedDictionary?: string;
linkedSource?: string;
canModifyConcept: (concept: APIConcept) => boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/apps/concepts/components/ConceptsTableRow.tsx
Expand Up @@ -199,7 +199,7 @@ const actionCell = (
event?: React.MouseEvent<HTMLButtonElement, MouseEvent> | undefined
) => void,
menu: { index: number; anchor: null | HTMLElement },
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void,
removeConceptsFromDictionary: (conceptUrls: string[]) => void,
addConceptsToDictionary: Function,

linkedSource: string | undefined,
Expand Down Expand Up @@ -246,7 +246,7 @@ interface ConceptsTableRowProps {
event?: React.MouseEvent<HTMLButtonElement, MouseEvent> | undefined
) => void;
menu: { index: number; anchor: null | HTMLElement };
removeConceptsFromDictionary: (conceptVersionUrls: string[]) => void;
removeConceptsFromDictionary: (conceptUrls: string[]) => void;
addConceptsToDictionary: Function;
dictionaryToAddTo?: string;
isItemSelected: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/apps/concepts/pages/ViewConceptsPage.tsx
Expand Up @@ -366,8 +366,8 @@ const ViewConceptsPage: React.FC<Props> = ({
canModifyConcept={(concept: APIConcept) =>
canModifyConcept(concept.url, profile, usersOrgs)
}
removeConceptsFromDictionary={(conceptVersionUrls: string[]) =>
removeConceptsFromDictionary(containerUrl, conceptVersionUrls)
removeConceptsFromDictionary={(conceptUrls: string[]) =>
removeConceptsFromDictionary(containerUrl, conceptUrls)
}
/>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/apps/concepts/redux/actions.ts
Expand Up @@ -200,7 +200,7 @@ export const upsertConceptAndMappingsAction = (
// we don't remove the toConceptUrls because we can't be sure no other mapping depends on them
// that would break the OCL module importer
// ...state.concepts.mappings.map(mapping => mapping.url), todo ensure the cascade is working and delete this if so
concept.version_url
concept.url
].filter(reference => reference) as string[];
await dispatch(
removeReferencesFromDictionary(linkedDictionary, referencesToRemove)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/concepts/redux/reducer.ts
Expand Up @@ -69,7 +69,7 @@ export const reducer = createReducer<ConceptsState>(initialState, {
}: { actionIndex: number; payload: {}; meta: [string, string[]] }
) => {
state.concepts.items = state.concepts.items.filter(
(concept: APIConcept) => !meta[1].includes(concept.version_url)
(concept: APIConcept) => !meta[1].includes(concept.url)
);
},
[LOGOUT_ACTION]: () => {
Expand Down

0 comments on commit 0458c09

Please sign in to comment.