Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCLOMRS-1094: Use concept url when removing concept from collection #774

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/apps/concepts/components/ConceptsActionMenu.tsx
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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