- {content('lg1', !secondLang)}
- {secondLang && content('lg2', false, D2)}
+
+
+ {secondLang && }
);
}
diff --git a/app/src/js/applications/concepts/visualization/links.scss b/app/src/js/applications/concepts/visualization/links.scss
new file mode 100644
index 000000000..c7f3536e3
--- /dev/null
+++ b/app/src/js/applications/concepts/visualization/links.scss
@@ -0,0 +1,3 @@
+.concept-links dd {
+ margin: revert;
+}
diff --git a/app/src/js/applications/operations/indicators/search.spec.js b/app/src/js/applications/operations/indicators/search.spec.js
index 0e86fadf1..d61cded06 100644
--- a/app/src/js/applications/operations/indicators/search.spec.js
+++ b/app/src/js/applications/operations/indicators/search.spec.js
@@ -1,6 +1,6 @@
import { SearchFormList } from './search';
import React from 'react';
-import { render, fireEvent, waitForElement } from '@testing-library/react';
+import { render, fireEvent } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
const data = [
{
@@ -351,7 +351,7 @@ describe('
', () => {
const listOptions = container.querySelector('label[for="creator"] input');
fireEvent.keyDown(listOptions, { key: 'ArrowDown' });
- const option = await waitForElement(() => findByText('DG57-C060'));
+ const option = await findByText('DG57-C060');
fireEvent.click(option);
expect(container.querySelectorAll('li')).toHaveLength(1);
});
@@ -369,7 +369,7 @@ describe('
', () => {
const listOptions = container.querySelector('label[for="publisher"] input');
fireEvent.keyDown(listOptions, { key: 'ArrowDown' });
- const option = await waitForElement(() => findByText('DG75-L002'));
+ const option = await findByText('DG75-L002');
fireEvent.click(option);
expect(container.querySelectorAll('li')).toHaveLength(1);
});
diff --git a/app/src/js/applications/operations/msd/pages/sims-creation/index.js b/app/src/js/applications/operations/msd/pages/sims-creation/index.js
index 17242b487..44ab0b1f2 100644
--- a/app/src/js/applications/operations/msd/pages/sims-creation/index.js
+++ b/app/src/js/applications/operations/msd/pages/sims-creation/index.js
@@ -201,7 +201,7 @@ class SimsCreation extends React.Component {
label: op.labelLg1,
value: op.idSims,
})
- );
+ ).sort((o1, o2) => o1.label.toLowerCase().localeCompare(o2.label.toLowerCase()));
function MSDInformations(msd, handleChange, firstLevel = false) {
return (
@@ -312,7 +312,7 @@ class SimsCreation extends React.Component {
/>
)}
- {mode !== DUPLICATE && operationsWithSimsOptions.length > 0 && (
+ {mode !== DUPLICATE && (
{
})
}
}, [seriesId, parentType, familyId])
- return
+ return
}
}
diff --git a/app/src/js/applications/operations/series/search.spec.js b/app/src/js/applications/operations/series/search.spec.js
index e228c214f..5c9a46c61 100644
--- a/app/src/js/applications/operations/series/search.spec.js
+++ b/app/src/js/applications/operations/series/search.spec.js
@@ -1,6 +1,6 @@
import { SearchFormList } from './search';
import React from 'react';
-import { render, fireEvent, waitForElement } from '@testing-library/react';
+import { render, fireEvent } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
const data = [
{
@@ -179,7 +179,7 @@ describe('', () => {
const listOptions = container.querySelector('label[for="creator"] input');
fireEvent.keyDown(listOptions, { key: 'ArrowDown' });
- const option = await waitForElement(() => findByText('DG57-C003'));
+ const option = await findByText('DG57-C003');
fireEvent.click(option);
expect(container.querySelectorAll('li')).toHaveLength(1);
});
@@ -198,7 +198,7 @@ describe('', () => {
const listOptions = container.querySelector('label[for="publisher"] input');
fireEvent.keyDown(listOptions, { key: 'ArrowDown' });
- const option = await waitForElement(() => findByText('Acoss'));
+ const option = await findByText('Acoss');
fireEvent.click(option);
expect(container.querySelectorAll('li')).toHaveLength(1);
});
@@ -219,7 +219,7 @@ describe('', () => {
'label[for="dataCollector"] input'
);
fireEvent.keyDown(listOptions, { key: 'ArrowDown' });
- const option = await waitForElement(() => findByText('DG75-A040'));
+ const option = await findByText('DG75-A040');
fireEvent.click(option);
expect(container.querySelectorAll('li')).toHaveLength(1);
});
diff --git a/app/src/js/constants/app.js b/app/src/js/constants/app.js
index 9a8380066..1232072dc 100644
--- a/app/src/js/constants/app.js
+++ b/app/src/js/constants/app.js
@@ -27,5 +27,6 @@ export const NARROWER = 'narrower';
export const REFERENCES = 'references';
export const SUCCEED = 'succeed';
export const RELATED = 'related';
+export const IS_REPLACED_BY = 'succeededBy';
export const CLOSE_MATCH = 'closeMatch';
export const NONE = ''; //local only: to ignore concept not linked
diff --git a/app/src/js/i18n/dictionary/app.js b/app/src/js/i18n/dictionary/app.js
index bcbfe6b15..8f8fd5b66 100644
--- a/app/src/js/i18n/dictionary/app.js
+++ b/app/src/js/i18n/dictionary/app.js
@@ -220,12 +220,12 @@ const dictionary = {
...btnD,
// Links
narrowerTitle: {
- fr: 'Parent',
- en: 'Parent',
+ fr: 'A pour enfant',
+ en: 'Has child',
},
broaderTitle: {
- fr: 'Enfant',
- en: 'Child',
+ fr: 'A pour parent',
+ en: 'Has parent',
},
referencesTitle: {
fr: 'Référence',
@@ -236,12 +236,12 @@ const dictionary = {
en: 'Replaces',
},
relatedTitle: {
- fr: 'Lié',
- en: 'Related',
+ fr: 'Est lié à ',
+ en: 'Is related to',
},
equivalentTitle: {
- fr: 'Équivalent',
- en: 'Equivalent',
+ fr: 'Correspond à ',
+ en: 'Matches',
},
// Mail
mailTitle: {
diff --git a/app/src/js/reducers/collections/by-id/general.js b/app/src/js/reducers/collections/by-id/general.js
deleted file mode 100644
index 73bf2cfae..000000000
--- a/app/src/js/reducers/collections/by-id/general.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-import * as generalUtils from 'js/utils/collections/general';
-
-export default function(state = {}, action) {
- const { type, payload } = action;
- switch (type) {
- case A.UPDATE_COLLECTION_SUCCESS: {
- const { id } = payload;
- return {
- ...state,
- [id]: {},
- };
- }
- case A.VALIDATE_COLLECTION_LIST_SUCCESS: {
- const { ids } = payload;
- const newState = {
- ...state,
- };
- ids.forEach(id => (newState[id] = {}));
- return newState;
- }
- case A.LOAD_COLLECTION_GENERAL_SUCCESS: {
- const { id, results } = payload;
- return {
- ...state,
- [id]: {
- status: LOADED,
- //ensure that all the fields are present (the server
- //does not return the fields not defined)
- results: Object.assign(generalUtils.empty(), results),
- },
- };
- }
- default:
- return state;
- }
-}
-
-export function getGeneral(state, id) {
- return state[id] && state[id].results;
-}
diff --git a/app/src/js/reducers/collections/by-id/general.spec.js b/app/src/js/reducers/collections/by-id/general.spec.js
deleted file mode 100644
index 09eac4f36..000000000
--- a/app/src/js/reducers/collections/by-id/general.spec.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import reducerCollectionsGeneral, { getGeneral } from './general';
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-import * as generalUtils from 'js/utils/collections/general';
-
-describe('reducerCollectionsGeneral', () => {
- test('action UPDATE_COLLECTION_SUCCESS', () => {
- const action = {
- type: A.UPDATE_COLLECTION_SUCCESS,
- payload: { id: 'id1' },
- };
- const result = reducerCollectionsGeneral(
- { id1: 'previous', id2: 'previous' },
- action
- );
- expect(result).toEqual({ id1: {}, id2: 'previous' });
- });
- test('action VALIDATE_COLLECTION_LIST_SUCCESS', () => {
- const action = {
- type: A.VALIDATE_COLLECTION_LIST_SUCCESS,
- payload: { ids: ['id1', 'id2'] },
- };
- const result = reducerCollectionsGeneral(
- { id1: 'previous', id2: 'previous', id3: 'previous' },
- action
- );
- expect(result).toEqual({ id1: {}, id2: {}, id3: 'previous' });
- });
- test('action LOAD_COLLECTION_GENERAL_SUCCESS', () => {
- const action = {
- type: A.LOAD_COLLECTION_GENERAL_SUCCESS,
- payload: { id: 'id1', results: { prefLabelLg1: 'My collection' } },
- };
- const result = reducerCollectionsGeneral({}, action);
- expect(result).toEqual({
- id1: {
- status: LOADED,
- results: Object.assign(generalUtils.empty(), {
- prefLabelLg1: 'My collection',
- }),
- },
- });
- });
-});
-
-describe('getGeneral', () => {
- test('getGeneral selector should extract nothing', () => {
- const result = getGeneral({ id1: { results: 'results' } }, 'id2');
- expect(result).toEqual();
- });
- test('getGeneral selector should extract results', () => {
- const result = getGeneral({ id1: { results: 'results' } }, 'id1');
- expect(result).toEqual('results');
- });
-});
diff --git a/app/src/js/reducers/collections/by-id/index.js b/app/src/js/reducers/collections/by-id/index.js
deleted file mode 100644
index 600d4e513..000000000
--- a/app/src/js/reducers/collections/by-id/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { getGeneral } from './general';
-import { getMembers } from './members';
-
-/**
- * Returns the collection with the givend if everything (general, members) has
- * been loaded
- *
- * @export
- * @param {object} state
- * @param {string} id
- * @returns {object}
- */
-export function getCollection(state, id) {
- const general = getGeneral(state.general, id);
- if (!general) return;
- const members = getMembers(state.members, id);
- if (!members) return;
- return {
- general,
- members,
- };
-}
diff --git a/app/src/js/reducers/collections/by-id/index.spec.js b/app/src/js/reducers/collections/by-id/index.spec.js
deleted file mode 100644
index 1a0d7175c..000000000
--- a/app/src/js/reducers/collections/by-id/index.spec.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { getCollection } from './';
-
-describe('getCollection', () => {
- test('getCollection selector should extract results', () => {
- const result = getCollection(
- {
- general: {},
- members: {},
- },
- 'id1'
- );
- expect(result).toEqual();
- });
- test('getCollection selector should extract results', () => {
- const result = getCollection(
- {
- general: { id1: { results: 'general id1' } },
- members: { id1: { results: 'members id1' } },
- },
- 'id1'
- );
- expect(result).toEqual({ general: 'general id1', members: 'members id1' });
- });
-});
diff --git a/app/src/js/reducers/collections/by-id/members.js b/app/src/js/reducers/collections/by-id/members.js
deleted file mode 100644
index 8865bc4c1..000000000
--- a/app/src/js/reducers/collections/by-id/members.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-
-export default function(state = {}, action) {
- const { type, payload } = action;
- switch (type) {
- case A.LOAD_COLLECTION_MEMBERS_SUCCESS: {
- const { id, results } = payload;
- return {
- ...state,
- [id]: {
- status: LOADED,
- results,
- },
- };
- }
- default:
- return state;
- }
-}
-
-export function getMembers(state, collectionId) {
- return state[collectionId] && state[collectionId].results;
-}
diff --git a/app/src/js/reducers/collections/by-id/members.spec.js b/app/src/js/reducers/collections/by-id/members.spec.js
deleted file mode 100644
index 3318d5ff4..000000000
--- a/app/src/js/reducers/collections/by-id/members.spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import reducerCollectionsMembers, { getMembers } from './members';
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-
-describe('reducerCollectionsMembers', () => {
- test('action LOAD_COLLECTION_MEMBERS_SUCCESS', () => {
- const action = {
- type: A.LOAD_COLLECTION_MEMBERS_SUCCESS,
- payload: { id: 'id1', results: 'members' },
- };
- const result = reducerCollectionsMembers(
- { id1: 'previous', id2: 'previous' },
- action
- );
- expect(result).toEqual({
- id1: {
- status: LOADED,
- results: 'members',
- },
- id2: 'previous',
- });
- });
-});
-
-describe('getMembers', () => {
- test('getMembers selector should extract nothing', () => {
- const result = getMembers({ id1: { results: 'members' } }, 'id2');
- expect(result).toEqual();
- });
- test('getMembers selector should extract results', () => {
- const result = getMembers({ id1: { results: 'members' } }, 'id1');
- expect(result).toEqual('members');
- });
-});
diff --git a/app/src/js/reducers/collections/index.js b/app/src/js/reducers/collections/index.js
deleted file mode 100644
index 650f31381..000000000
--- a/app/src/js/reducers/collections/index.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import listReducer from '../utils/list-reducer';
-import collectionGeneral from './by-id/general';
-import collectionMembers from './by-id/members';
-import * as A from 'js/actions/constants';
-import { handleReset } from 'js/reducers/utils/reset-reducer';
-
-const collectionList = handleReset(
- listReducer([
- A.LOAD_COLLECTION_LIST,
- A.LOAD_COLLECTION_LIST_SUCCESS,
- A.LOAD_COLLECTION_LIST_FAILURE,
- ]),
- [A.CREATE_COLLECTION, A.UPDATE_COLLECTION]
-);
-
-const collectionToValidateList = handleReset(
- listReducer([
- A.LOAD_COLLECTION_VALIDATE_LIST,
- A.LOAD_COLLECTION_VALIDATE_LIST_SUCCESS,
- A.LOAD_COLLECTION_VALIDATE_LIST_FAILURE,
- ]),
- [A.CREATE_COLLECTION, A.UPDATE_COLLECTION, A.VALIDATE_COLLECTION_LIST]
-);
-
-export default {
- collectionList,
- collectionToValidateList,
- collectionGeneral,
- collectionMembers,
-};
diff --git a/app/src/js/reducers/concepts/by-id/general.js b/app/src/js/reducers/concepts/by-id/general.js
deleted file mode 100755
index 81c33601b..000000000
--- a/app/src/js/reducers/concepts/by-id/general.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-import * as generalUtils from 'js/utils/concepts/general';
-
-export default function(state = {}, action) {
- const { type, payload } = action;
- switch (type) {
- case A.DELETE_CONCEPT_SUCCESS: {
- const { id } = payload;
- return {
- ...state,
- [id]: {},
- };
- }
- case A.UPDATE_CONCEPT_SUCCESS: {
- const { id } = payload;
- return {
- ...state,
- [id]: {},
- };
- }
- case A.VALIDATE_CONCEPT_LIST_SUCCESS: {
- const { ids } = payload;
- const newState = {
- ...state,
- };
- ids.forEach(id => (newState[id] = {}));
- return newState;
- }
- case A.LOAD_CONCEPT_GENERAL_SUCCESS: {
- const { id, results } = payload;
- return {
- ...state,
- [id]: {
- status: LOADED,
- //ensure that all the fields are present (the server
- //does not return the fields not defined)
- results: Object.assign(generalUtils.empty(), results),
- },
- };
- }
- default:
- return state;
- }
-}
-
-export function getGeneral(state, id) {
- return state[id] && state[id].results;
-}
diff --git a/app/src/js/reducers/concepts/by-id/general.spec.js b/app/src/js/reducers/concepts/by-id/general.spec.js
deleted file mode 100644
index 393fec7e1..000000000
--- a/app/src/js/reducers/concepts/by-id/general.spec.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import reducerConceptsGeneral, { getGeneral } from './general';
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-import * as generalUtils from 'js/utils/concepts/general';
-
-describe('reducerConceptsGeneral', () => {
- test('action UPDATE_CONCEPT_SUCCESS', () => {
- const action = {
- type: A.UPDATE_CONCEPT_SUCCESS,
- payload: { id: 'id1' },
- };
- const result = reducerConceptsGeneral(
- { id1: 'previous', id2: 'previous' },
- action
- );
- expect(result).toEqual({ id1: {}, id2: 'previous' });
- });
- test('action VALIDATE_CONCEPT_LIST_SUCCESS', () => {
- const action = {
- type: A.VALIDATE_CONCEPT_LIST_SUCCESS,
- payload: { ids: ['id1', 'id2'] },
- };
- const result = reducerConceptsGeneral(
- { id1: 'previous', id2: 'previous', id3: 'previous' },
- action
- );
- expect(result).toEqual({ id1: {}, id2: {}, id3: 'previous' });
- });
- test('action LOAD_CONCEPT_GENERAL_SUCCESS', () => {
- const action = {
- type: A.LOAD_CONCEPT_GENERAL_SUCCESS,
- payload: { id: 'id1', results: { prefLabelLg1: 'My concept' } },
- };
- const result = reducerConceptsGeneral({}, action);
- expect(result).toEqual({
- id1: {
- status: LOADED,
- results: Object.assign(generalUtils.empty(), {
- prefLabelLg1: 'My concept',
- }),
- },
- });
- });
-});
-
-describe('getGeneral', () => {
- test('getGeneral selector should extract nothing', () => {
- const result = getGeneral({ id1: { results: 'results' } }, 'id2');
- expect(result).toEqual();
- });
- test('getGeneral selector should extract results', () => {
- const result = getGeneral({ id1: { results: 'results' } }, 'id1');
- expect(result).toEqual('results');
- });
-});
diff --git a/app/src/js/reducers/concepts/by-id/index.js b/app/src/js/reducers/concepts/by-id/index.js
deleted file mode 100644
index 5fe7ea76c..000000000
--- a/app/src/js/reducers/concepts/by-id/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { getGeneral } from './general';
-import { getNotes } from './notes';
-import { getLinks } from './links';
-
-/**
- * Returns the concept with the givend if everything (general, notes, links) has
- * been loaded
- *
- * @export
- * @param {object} state
- * @param {string} id
- * @returns {object}
- */
-export function getConcept(state, id) {
- const general = getGeneral(state.general, id);
- if (!general) return;
- const notes = getNotes(state.notes, id, general.conceptVersion);
- if (!notes) return;
- const links = getLinks(state.links, id);
- if (!links) return;
- return {
- general,
- notes,
- links,
- };
-}
diff --git a/app/src/js/reducers/concepts/by-id/index.spec.js b/app/src/js/reducers/concepts/by-id/index.spec.js
deleted file mode 100644
index c97ab1020..000000000
--- a/app/src/js/reducers/concepts/by-id/index.spec.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import { getConcept } from './';
-import { LOADED } from 'js/constants';
-
-describe('getConcept', () => {
- test('getConcept selector should extract results', () => {
- const result = getConcept(
- {
- general: {},
- },
- 'id1'
- );
- expect(result).toEqual();
- });
- test('getConcept selector should extract results', () => {
- const result = getConcept(
- {
- general: {
- id1: { results: { prefLabelLg1: 'My concept', conceptVersion: '2' } },
- },
- notes: {
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADED, results: 'id1 notes v2' },
- },
- },
- links: { id1: { results: 'links id1' } },
- },
- 'id1'
- );
- expect(result).toEqual({
- general: { prefLabelLg1: 'My concept', conceptVersion: '2' },
- notes: 'id1 notes v2',
- links: 'links id1',
- });
- });
-});
diff --git a/app/src/js/reducers/concepts/by-id/links.js b/app/src/js/reducers/concepts/by-id/links.js
deleted file mode 100755
index 9ed085687..000000000
--- a/app/src/js/reducers/concepts/by-id/links.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-
-export default function(state = {}, action) {
- const { type, payload } = action;
- switch (type) {
- case A.DELETE_CONCEPT_SUCCESS: {
- const { id } = payload;
- return {
- ...state,
- [id]: {},
- };
- }
- case A.LOAD_CONCEPT_LINKS_SUCCESS: {
- const { id, results } = payload;
- return {
- ...state,
- [id]: {
- status: LOADED,
- results,
- },
- };
- }
- default:
- return state;
- }
-}
-
-export function getLinks(state, conceptId) {
- return state[conceptId] && state[conceptId].results;
-}
diff --git a/app/src/js/reducers/concepts/by-id/links.spec.js b/app/src/js/reducers/concepts/by-id/links.spec.js
deleted file mode 100644
index ec149d1cd..000000000
--- a/app/src/js/reducers/concepts/by-id/links.spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import reducerConceptsLinks, { getLinks } from './links';
-import * as A from 'js/actions/constants';
-import { LOADED } from 'js/constants';
-
-describe('reducerConceptsLinks', () => {
- test('action LOAD_CONCEPT_LINKS_SUCCESS', () => {
- const action = {
- type: A.LOAD_CONCEPT_LINKS_SUCCESS,
- payload: { id: 'id1', results: 'links' },
- };
- const result = reducerConceptsLinks(
- { id1: 'previous', id2: 'previous' },
- action
- );
- expect(result).toEqual({
- id1: {
- status: LOADED,
- results: 'links',
- },
- id2: 'previous',
- });
- });
-});
-
-describe('getLinks', () => {
- test('getLinks selector should extract nothing', () => {
- const result = getLinks({ id1: { results: 'links' } }, 'id2');
- expect(result).toEqual();
- });
- test('getLinks selector should extract results', () => {
- const result = getLinks({ id1: { results: 'links' } }, 'id1');
- expect(result).toEqual('links');
- });
-});
diff --git a/app/src/js/reducers/concepts/by-id/notes.js b/app/src/js/reducers/concepts/by-id/notes.js
deleted file mode 100755
index 4a5eb0a22..000000000
--- a/app/src/js/reducers/concepts/by-id/notes.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import * as A from 'js/actions/constants';
-import { LOADING, LOADED } from 'js/constants';
-import { ArrayUtils } from 'bauhaus-utilities';
-
-export default function(state = {}, action) {
- const { type, payload } = action;
- switch (type) {
- case A.DELETE_CONCEPT_SUCCESS: {
- const { id } = payload;
- return {
- ...state,
- [id]: {},
- };
- }
- case A.LOAD_NOTES_VERSION:
- const { id, version } = payload;
- const otherVersions = state[id];
- return {
- ...state,
- [id]: {
- ...otherVersions,
- [version]: {
- status: LOADING,
- },
- },
- };
- case A.LOAD_NOTES_VERSION_SUCCESS: {
- const { id, version, results } = payload;
- const otherVersions = state[id];
- return {
- ...state,
- [id]: {
- //on conserve les versions déjà chargées
- ...otherVersions,
- //on ajoute la nouvelle version
- [version]: {
- status: LOADED,
- results,
- },
- },
- };
- }
- default:
- return state;
- }
-}
-
-export const getNotes = (state, conceptId, conceptVersion) => {
- const allNotes = state[conceptId];
- if (!allNotes) return null;
- const versionNotes = allNotes[conceptVersion];
- return versionNotes && versionNotes.results;
-};
-
-export const getAllNotes = (state, conceptId, lastVersion) => {
- const allNotes = state[conceptId];
- if (!allNotes) return null;
- const notes = Object.keys(allNotes).reduce((notes, version) => {
- const notesVersion = allNotes[version];
- if (notesVersion && notesVersion.results)
- notes[version] = notesVersion.results;
- return notes;
- }, {});
- const versions = ArrayUtils.range(1, Number(lastVersion) + 1);
- //return notes only if each expected version is present
- if (versions.every(version => version in notes)) {
- return notes;
- }
-};
diff --git a/app/src/js/reducers/concepts/by-id/notes.spec.js b/app/src/js/reducers/concepts/by-id/notes.spec.js
deleted file mode 100644
index 5aa2c1b8c..000000000
--- a/app/src/js/reducers/concepts/by-id/notes.spec.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import reducerConceptsNotes, { getNotes, getAllNotes } from './notes';
-import * as A from 'js/actions/constants';
-import { LOADING, LOADED } from 'js/constants';
-
-describe('reducerConceptsNotes', () => {
- test('action LOAD_NOTES_VERSION', () => {
- const action = {
- type: A.LOAD_NOTES_VERSION,
- payload: { id: 'id1', version: 2 },
- };
- const result = reducerConceptsNotes(
- { id1: { 1: { status: LOADED, results: 'id1 notes v1' } } },
- action
- );
- expect(result).toEqual({
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADING },
- },
- });
- });
- test('action LOAD_NOTES_VERSION_SUCCESS', () => {
- const action = {
- type: A.LOAD_NOTES_VERSION_SUCCESS,
- payload: { id: 'id1', version: 2, results: 'id1 notes v2' },
- };
- const result = reducerConceptsNotes(
- { id1: { 1: { status: LOADED, results: 'id1 notes v1' } } },
- action
- );
- expect(result).toEqual({
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADED, results: 'id1 notes v2' },
- },
- });
- });
-});
-
-describe('getNotes', () => {
- test('getNotes selector should extract nothing', () => {
- const result = getNotes(
- {
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADED, results: 'id1 notes v2' },
- },
- },
- 'id1',
- 3
- );
- expect(result).toEqual();
- });
- test('getNotes selector should extract results', () => {
- const result = getNotes(
- {
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADED, results: 'id1 notes v2' },
- },
- },
- 'id1',
- 2
- );
- expect(result).toEqual('id1 notes v2');
- });
-});
-
-describe('getAllNotes', () => {
- test('getAllNotes selector should extract nothing', () => {
- const result = getAllNotes(
- {
- id2: {},
- },
- 'id1'
- );
- expect(result).toBeNull();
- });
- test('getAllNotes selector should extract results', () => {
- const result = getAllNotes(
- {
- id1: {
- 1: { status: LOADED, results: 'id1 notes v1' },
- 2: { status: LOADED, results: 'id1 notes v2' },
- },
- },
- 'id1',
- 2
- );
- expect(result).toEqual({ 1: 'id1 notes v1', 2: 'id1 notes v2' });
- });
-});
diff --git a/app/src/js/reducers/concepts/index.js b/app/src/js/reducers/concepts/index.js
deleted file mode 100644
index 0788aeb4f..000000000
--- a/app/src/js/reducers/concepts/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import conceptGeneral from './by-id/general';
-import conceptNotes from './by-id/notes';
-import conceptLinks from './by-id/links';
-import listReducer from '../utils/list-reducer';
-import * as A from 'js/actions/constants';
-import { handleReset } from 'js/reducers/utils/reset-reducer';
-
-const conceptList = handleReset(
- listReducer([
- A.LOAD_CONCEPT_LIST,
- A.LOAD_CONCEPT_LIST_SUCCESS,
- A.LOAD_CONCEPT_LIST_FAILURE,
- ]),
- [A.CREATE_CONCEPT, A.UPDATE_CONCEPT, A.DELETE_CONCEPT_SUCCESS]
-);
-
-const conceptToValidateList = handleReset(
- listReducer([
- A.LOAD_CONCEPT_VALIDATE_LIST,
- A.LOAD_CONCEPT_VALIDATE_LIST_SUCCESS,
- A.LOAD_CONCEPT_VALIDATE_LIST_FAILURE,
- ]),
- [A.CREATE_CONCEPT, A.UPDATE_CONCEPT, A.VALIDATE_CONCEPT_LIST]
-);
-
-const conceptSearchList = handleReset(
- listReducer([
- A.LOAD_CONCEPT_SEARCH_LIST,
- A.LOAD_CONCEPT_SEARCH_LIST_SUCCESS,
- A.LOAD_CONCEPT_SEARCH_LIST_FAILURE,
- ]),
- [A.CREATE_CONCEPT, A.UPDATE_CONCEPT, A.VALIDATE_CONCEPT_LIST]
-);
-
-export default {
- conceptList,
- conceptSearchList,
- conceptToValidateList,
- conceptGeneral,
- conceptNotes,
- conceptLinks,
-};
diff --git a/app/src/js/reducers/dashboard/index.js b/app/src/js/reducers/dashboard/index.js
deleted file mode 100644
index 4653f4093..000000000
--- a/app/src/js/reducers/dashboard/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import listReducer from '../utils/list-reducer';
-import * as A from 'js/actions/constants';
-
-export const handleReset = (reducer, actions) => (state, action) => {
- //we pass the action to the reducer: it should have no effect, we just want
- //to reinitialize the reducer but we cannot pas `undefined` as an action
- if (actions.indexOf(action.type) !== -1) return reducer(undefined, action);
- return reducer(state, action);
-};
-
-const collectionDashboardList = handleReset(
- listReducer([
- A.LOAD_COLLECTION_DASHBOARD_LIST,
- A.LOAD_COLLECTION_DASHBOARD_LIST_SUCCESS,
- A.LOAD_COLLECTION_DASHBOARD_LIST_FAILURE,
- ]),
- [A.CREATE_COLLECTION, A.UPDATE_COLLECTION, A.VALIDATE_COLLECTION_LIST]
-);
-
-export default {
- collectionDashboardList,
-};
diff --git a/app/src/js/reducers/index.js b/app/src/js/reducers/index.js
index ae1b3bc43..9a4312cdc 100755
--- a/app/src/js/reducers/index.js
+++ b/app/src/js/reducers/index.js
@@ -2,14 +2,6 @@ import { getItems } from './utils/list-reducer';
import { combineReducers } from 'redux';
import app from './app';
import sharedReducers from './shared';
-import conceptReducers from './concepts';
-import * as conceptGeneral from './concepts/by-id/general';
-import * as notes from './concepts/by-id/notes';
-import * as links from './concepts/by-id/links';
-import * as collectionGeneral from './collections/by-id/general';
-import * as members from './collections/by-id/members';
-import collectionReducers from './collections';
-import dashboardReducers from './dashboard';
import classificationsReducers from './classifications';
import operationsReducers from './operations';
import codesListReducers from './operations/codesList';
@@ -21,9 +13,6 @@ import remoteCalls from './remote-calls';
export default combineReducers({
app,
...sharedReducers,
- ...conceptReducers,
- ...collectionReducers,
- ...dashboardReducers,
...classificationsReducers,
...operationsReducers,
...codesListReducers,
@@ -34,61 +23,6 @@ export default combineReducers({
remoteCalls,
});
-export const getConceptList = (state) => getItems(state.conceptList);
-export const getConceptSearchList = (state) =>
- getItems(state.conceptSearchList);
-export const getConceptValidateList = (state) =>
- getItems(state.conceptToValidateList);
-
-export const getConceptGeneral = (state, id) =>
- conceptGeneral.getGeneral(state.conceptGeneral, id);
-export const getNotes = (state, id, version) =>
- notes.getNotes(state.conceptNotes, id, version);
-export const getLinks = (state, id) => links.getLinks(state.conceptLinks, id);
-
-export function getAllNotes(state, id, lastVersion) {
- return notes.getAllNotes(state.conceptNotes, id, lastVersion);
-}
-
-export function getConcept(state, id) {
- const general = getConceptGeneral(state, id);
- const links = getLinks(state, id);
- let notes;
- if (general) {
- notes = getNotes(state, id, general.conceptVersion);
- }
-
- if (!(general && notes && links)) return;
-
- return {
- general,
- notes,
- links,
- };
-}
-
-export const getCollectionList = (state) => getItems(state.collectionList);
-export const getCollectionDashboardList = (state) =>
- getItems(state.collectionDashboardList);
-export const getCollectionValidateList = (state) =>
- getItems(state.collectionToValidateList);
-
-export const getCollectionGeneral = (state, id) =>
- collectionGeneral.getGeneral(state.collectionGeneral, id);
-export const getMembers = (state, id) =>
- members.getMembers(state.collectionMembers, id);
-
-export function getCollection(state, id) {
- const general = getCollectionGeneral(state, id);
- const members = getMembers(state, id);
-
- if (!(general && members)) return;
- return {
- general,
- members,
- };
-}
-
export const getRoleList = (state) => getItems(state.roleList);
export const getAgentList = (state) => getItems(state.agentList);
diff --git a/app/src/js/reducers/remote-calls.js b/app/src/js/reducers/remote-calls.js
index 7aef77a18..2207dead8 100644
--- a/app/src/js/reducers/remote-calls.js
+++ b/app/src/js/reducers/remote-calls.js
@@ -87,23 +87,5 @@ export const trackActionReducer = actions => (state = {}, action) => {
*
*/
export default trackActionReducer([
- [A.CREATE_CONCEPT, A.CREATE_CONCEPT_SUCCESS],
- [A.UPDATE_CONCEPT, A.UPDATE_CONCEPT_SUCCESS, A.UPDATE_CONCEPT_FAILURE],
- [
- A.DELETE_CONCEPT,
- A.DELETE_CONCEPT_SUCCESS,
- A.DELETE_CONCEPT_FAILURE,
- [A.LOAD_CONCEPT_GENERAL_SUCCESS, A.LOAD_CONCEPT_LIST_SUCCESS],
- ],
- [A.EXPORT_CONCEPT_LIST, A.EXPORT_CONCEPT_LIST_SUCCESS],
- [A.SEND_CONCEPT, A.SEND_CONCEPT_SUCCESS],
- [A.VALIDATE_CONCEPT_LIST, A.VALIDATE_CONCEPT_LIST_SUCCESS],
- [A.CREATE_COLLECTION, A.CREATE_COLLECTION_SUCCESS],
- [A.UPDATE_COLLECTION, A.UPDATE_COLLECTION_SUCCESS],
- [A.EXPORT_COLLECTION_LIST, A.EXPORT_COLLECTION_LIST_SUCCESS],
- [A.SEND_COLLECTION, A.SEND_COLLECTION_SUCCESS],
- [A.VALIDATE_COLLECTION_LIST, A.VALIDATE_COLLECTION_LIST_SUCCESS],
- [A.ADD_ROLE, A.ADD_ROLE_SUCCESS],
- [A.DELETE_ROLE, A.DELETE_ROLE_SUCCESS],
[A.EXPORT_VARBOOK, A.EXPORT_VARBOOK_SUCCESS],
]);
diff --git a/app/src/js/utils/concepts/links.js b/app/src/js/utils/concepts/links.js
index 0985f9940..967f091e5 100644
--- a/app/src/js/utils/concepts/links.js
+++ b/app/src/js/utils/concepts/links.js
@@ -6,6 +6,7 @@ import {
SUCCEED,
RELATED,
NONE, CLOSE_MATCH,
+ IS_REPLACED_BY
} from 'js/constants';
const linkTypes = {
@@ -15,6 +16,8 @@ const linkTypes = {
[SUCCEED]: SUCCEED,
[RELATED]: RELATED,
[CLOSE_MATCH]: CLOSE_MATCH,
+ [IS_REPLACED_BY]: IS_REPLACED_BY,
+
};
const propTypesKindOfLink = PropTypes.oneOf([
@@ -24,6 +27,7 @@ const propTypesKindOfLink = PropTypes.oneOf([
SUCCEED,
RELATED,
NONE,
+ IS_REPLACED_BY
]);
export const propTypes = PropTypes.arrayOf(
diff --git a/package.json b/package.json
index bb2c1749a..c8ee39da6 100644
--- a/package.json
+++ b/package.json
@@ -20,16 +20,16 @@
"@inseefr/wilco": "0.0.5"
},
"devDependencies": {
- "@babel/core": "7.11.6",
- "@babel/preset-env": "7.11.5",
+ "@babel/core": "^7.16.12",
+ "@babel/preset-env": "^7.16.11",
"@storybook/addon-actions": "5.3.19",
"@storybook/addon-knobs": "5.3.19",
"@storybook/addon-links": "5.3.19",
"@storybook/addons": "5.3.19",
"@storybook/react": "5.3.19",
- "@testing-library/jest-dom": "5.14.1",
- "@testing-library/react": "11.2.7",
- "@testing-library/user-event": "13.1.9",
+ "@testing-library/jest-dom": "^5.16.1",
+ "@testing-library/react": "^12.1.2",
+ "@testing-library/user-event": "^13.5.0",
"@types/jest": "26.0.16",
"babel-eslint": "^10.1.0",
"babel-jest": "26.0.1",
@@ -39,30 +39,30 @@
"eslint-config-prettier": "6.15.0",
"eslint-config-react-app": "6.0.0",
"eslint-plugin-flowtype": "5.2.0",
- "eslint-plugin-import": "2.22.1",
+ "eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest-dom": "3.2.4",
- "eslint-plugin-jsx-a11y": "6.4.1",
- "eslint-plugin-react": "7.21.5",
- "eslint-plugin-react-hooks": "4.2.0",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-react": "^7.28.0",
+ "eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-testing-library": "3.9.2",
"husky": "4.3.0",
"jest": "26.6.0",
"jest-localstorage-mock": "2.4.3",
"lcov-result-merger": "3.1.0",
- "prettier": "2.3.2",
- "webpack": "5.58.1"
+ "prettier": "^2.5.1",
+ "webpack": "^5.67.0"
},
"dependencies": {
"dompurify": "2.2.9",
- "@babel/preset-react": "^7.12.13",
+ "@babel/preset-react": "^7.16.7",
"jest-environment-jsdom-sixteen": "^1.0.3",
- "prop-types": "15.7.2",
+ "prop-types": "^15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
- "react-redux": "7.2.0",
+ "react-redux": "^7.2.6",
"react-router-dom": "5.2.0",
- "redux": "4.0.5",
- "rollup": "^2.53.2"
+ "redux": "4.1.2",
+ "rollup": "^2.67.0"
},
"husky": {
"hooks": {
diff --git a/packages/codelists/package.json b/packages/codelists/package.json
index b346a2f7e..b9e44e7be 100644
--- a/packages/codelists/package.json
+++ b/packages/codelists/package.json
@@ -14,10 +14,10 @@
"lint": "eslint src"
},
"devDependencies": {
- "@babel/plugin-proposal-class-properties": "7.10.4",
- "@babel/plugin-transform-react-jsx": "7.10.4",
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
+ "@babel/plugin-transform-react-jsx": "^7.16.7",
"identity-obj-proxy": "^3.0.0",
- "rollup": "2.28.1",
+ "rollup": "^2.67.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-builtins": "^2.1.2",
diff --git a/packages/codelists/src/components/codelist-detail/edit.js b/packages/codelists/src/components/codelist-detail/edit.js
index c677d0762..56d5dee86 100644
--- a/packages/codelists/src/components/codelist-detail/edit.js
+++ b/packages/codelists/src/components/codelist-detail/edit.js
@@ -26,17 +26,20 @@ export const deleteNodes = (codes, currentNode) => {
);
const findParent = (lengthCheck, parentNode) => {
- return codes.filter(
- (code) =>
- lengthCheck(code.parents?.length) &&
- code.parents?.find(({ code }) => code === parentNode.code)
- ) || [];
-
- }
- findParent(length => length === 1, currentNode).forEach((child) => deleteNode(child));
+ return (
+ codes.filter(
+ (code) =>
+ lengthCheck(code.parents?.length) &&
+ code.parents?.find(({ code }) => code === parentNode.code)
+ ) || []
+ );
+ };
+ findParent((length) => length === 1, currentNode).forEach((child) =>
+ deleteNode(child)
+ );
- const childrenToUpdate = findParent(length => length > 1, currentNode);
- updatedCodes = updatedCodes.map(( updatedCode ) => {
+ const childrenToUpdate = findParent((length) => length > 1, currentNode);
+ updatedCodes = updatedCodes.map((updatedCode) => {
const isPresent = !!childrenToUpdate.find(
({ code }) => code === updatedCode.code
);
@@ -55,8 +58,8 @@ export const deleteNodes = (codes, currentNode) => {
};
deleteNode(currentNode);
- return updatedCodes
-}
+ return updatedCodes;
+};
const defaultCodelist = {
contributor: 'DG75-L201',
@@ -115,7 +118,6 @@ const DumbCodelistDetailEdit = ({
const updateCode = useCallback(
(codeObject) => {
- console.log(codeObject)
const existing = codes.find((c) => c.code === codeObject.code);
if (!existing) {
// Create
@@ -203,7 +205,7 @@ const DumbCodelistDetailEdit = ({
name="lastClassUriSegment"
onChange={handleChange}
value={codelist.lastClassUriSegment || ''}
- /* disabled={updateMode} */
+ disabled={updateMode}
/>
diff --git a/packages/codelists/src/components/codelist-partial-detail/codes-tree-edit.js b/packages/codelists/src/components/codelist-partial-detail/codes-tree-edit.js
index 22a28f730..984cce568 100644
--- a/packages/codelists/src/components/codelist-partial-detail/codes-tree-edit.js
+++ b/packages/codelists/src/components/codelist-partial-detail/codes-tree-edit.js
@@ -1,48 +1,28 @@
-import React, { useCallback, useState, useEffect, useContext } from 'react';
-import PropTypes from 'prop-types';
+import React, { useCallback, useState } from 'react';
import { useSelector } from 'react-redux';
+import PropTypes from 'prop-types';
+import SlidingPanel from 'react-sliding-side-panel';
+import { ActionToolbar, Panel } from '@inseefr/wilco';
import { Stores } from 'bauhaus-utilities';
+import D from '../../i18n/build-dictionary';
+import { CollapsiblePanel } from '../collapsible-panel';
import RmesTree from '../tree';
-import { TreeContext } from '../tree/treeContext';
-import { CodeDetailEdit } from '../code-detail/edit';
-import { treedData } from '../../utils';
-import { emptyCode } from '../code-detail/empty-code';
+import { CodeDetailView } from '../code-detail/view';
+import CodeTitle from '../code-detail/title';
-export const syncNodes = (previousNodes = [], nextNodes = []) => {
- if (previousNodes.length !== nextNodes.length) {
- return nextNodes;
- }
- return nextNodes.map((node) => {
- const previousNode = previousNodes.find(({ code }) => code === node.code);
-
- return {
- ...node,
- expanded: previousNode?.expanded || false,
- position:
- previousNode?.position ||
- (previousNodes.position ? Math.max(previousNodes.position) + 1 : 1),
- children: syncNodes(previousNode?.children, node.children),
- };
- });
-};
-
-const CodesTreeEdit = ({
+const PartialCodesTreeEdit = ({
+ hidden = false,
codes,
- deleteCode,
- deleteCodeWithChildren,
- updateCode,
- createCode,
+ tree,
+ handleChangeTree,
+ addClickHandler,
+ removeClickHandler,
+ addAllClickHandler,
+ removeAllClickHandler,
}) => {
+ const [openPanel, setOpenPanel] = useState(false);
const secondLang = useSelector(Stores.SecondLang.getSecondLang);
- const [selectedCode, setSelectedCode] = useState(emptyCode);
- const [tree, setTree] = useContext(TreeContext);
-
- useEffect(() => {
- const currentTree = treedData(Object.values(codes || {}));
- setTree(syncNodes(tree, currentTree));
- // needs not to depend on tree to allow react-sortable-tree to update "expanded"
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [codes]);
+ const [selectedCode, setSelectedCode] = useState(null);
const seeClickHandler = useCallback(
(e) => {
@@ -51,38 +31,98 @@ const CodesTreeEdit = ({
);
if (chosenCode) {
setSelectedCode(chosenCode);
+ setOpenPanel(true);
}
},
[codes]
);
return (
-