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-44: A user should be able to view all dictionaries #34

Merged
merged 1 commit into from
Jun 20, 2018

Conversation

EleisonC
Copy link
Contributor

JIRA TICKET NAME:

OCLOMRS-44

Summary:

A user should be able to retrieve all dictionaries both the one created by them and are private to them and all other public dictionaries

@coveralls
Copy link

coveralls commented Jun 18, 2018

Pull Request Test Coverage Report for Build 175

  • 26 of 34 (76.47%) changed or added relevant lines in 8 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.2%) to 68.016%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/dashboard/components/dictionary/ListDictionaries.jsx 5 8 62.5%
src/redux/actions/dictionaries/dictionaryActionCreators.js 4 9 44.44%
Files with Coverage Reduction New Missed Lines %
src/components/dashboard/components/ListWrapper.jsx 1 83.33%
src/components/dashboard/components/dictionary/AddDictionary.jsx 1 20.0%
Totals Coverage Status
Change from base Build 161: 0.2%
Covered Lines: 258
Relevant Lines: 351

💛 - Coveralls

dictionaryName: PropTypes.string,
})).isRequired,
};
export default ListDictionaries;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line required here

dispatch(isFetching(false));
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line required

"references": [],
"active_concepts": 0,
"active_mappings": 0
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line required here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will work on that

import AddDictionary from './dictionary/AddDictionary';

import{ Link }from 'react-router-dom'
Copy link
Contributor

@mwaz mwaz Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint spaces not present on the import, also missing a semicolon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will deal with that thank you for the feedback

font-size: 11px;
border: none;
}
Copy link
Contributor

@mwaz mwaz Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dictionary css file, i think it might make more sense if all the css for dictionaries is in that file rather than in the index file of the dashboard.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I placed that there, is I am reusing the CSS that Emma had written hence avoid repetition of code. In the dictionary CSS file

@@ -27,3 +28,25 @@ export const fetchingOrganizations = () => dispatch =>
.fetchOrganizations()
.then(payload =>
dispatch(fetchOrganizations(payload)));

export const fetchDictionaries = (
Copy link
Contributor

@mwaz mwaz Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should get some member contribution on the same but i think this would look much neater in the api.js file.
Something like
export const fetchDictionaries = (query, limit, page) => dispatch => api.dictionaries .fetchDictionaries(query, limit, page)
then you can copy everything else from here to fetchDictionaries function in api.js. (This is just but a suggestion just to keep the consistency)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mwaz
Copy link
Contributor

mwaz commented Jun 19, 2018

apart from the minor changes, PR looks solidly good

@@ -17,7 +18,7 @@ describe('Dashboard Component', () => {
clearSources: jest.fn(),
hasMore: false,
};
const wrapper = mount(<SourceSearch {...props} />);
const wrapper = shallow(<MemoryRouter><SourceSearch {...props} /></MemoryRouter>);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you have to change this file, I thought you were to work on dictionaries only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made changes to the SideNavigation.jsx file to use the Link element hence I had to wrap the component being tested in the MemoryRouter

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah and that should be another ticket I guess because I had also changed anchors to Links and someone commented on that, or maybe change only yours to avoid many irrelevant changes as per this ticket

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would leave all the other test files failing as a result of rendering the Link out of the MemoryRouter

@@ -15,7 +16,7 @@ describe('Dashboard Concept Component', () => {
concepts: [],
isFetching: false,
};
const wrapper = mount(<ConceptSearch {...props} />);
const wrapper = mount(<MemoryRouter><ConceptSearch {...props} /></MemoryRouter>);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you have to change this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made changes to the SideNavigation.jsx file to use the Link element hence I had to wrap the component being tested in the MemoryRouter

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, you can only change for your link so as to stay focused to your ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's part of the sideNavigation component which is rendered in all containers that are tested

@@ -3,13 +3,16 @@ import AuthReducers from './authReducers';
import sources from './sourcesReducer';
import organizations from './dictionaryReducer';
import concepts from './ConceptReducers';
import dictionaries from './dictionaryReducers';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we leaving many lines than required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will deal with that thank you

dispatch(isFetching(false));
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here new line

dictionaryName: PropTypes.string,
})).isRequired,
};
export default ListDictionaries;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line needed here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this wasn't resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was resolved

</li>
<li className="nav-item">
Copy link
Collaborator

@hadijahkyampeire hadijahkyampeire Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you put dictionaries in their own 'li' why not follow the convention

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it is a list item

@EleisonC EleisonC force-pushed the OCLOMRS-44 branch 3 times, most recently from 99268f6 to 1d163a8 Compare June 19, 2018 16:39
OCLOMRS-44: A user should be able to view all dictionaries

OCLOMRS-44: A user should be able to view all dictionaries

OCLOMRS-44: A user should be able to view all dictionaries

OCLOMRS-44: A user should be able to view all dictionaries

OCLOMRS-44: A user should be able to view all dictionaries

export class AddDictionary extends React.Component {
submit = data => (
data.owner === 'Individual' ? this.props.createDictionaryUser(data).then(this.props.handleHide)
: this.props.createDictionary(data).then(this.props.handleHide))
: this.props.createDictionary(data).then(this.props.handleHide)).then(this.props.fetchDictionaries())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These promises should not be resolved in the component, you should create an action creator (thunk) for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making a new ticket to fix that because that particular file was created by someone else and what I added was their suggestion to update state after creating a new dictionary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

@shakirandagire shakirandagire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mwaz
Copy link
Contributor

mwaz commented Jun 20, 2018

LGTM

Copy link
Collaborator

@hadijahkyampeire hadijahkyampeire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkayiwa dkayiwa merged commit 583ef9f into openmrs:master Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants