-
Notifications
You must be signed in to change notification settings - Fork 77
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
Conversation
Pull Request Test Coverage Report for Build 175
💛 - Coveralls |
dictionaryName: PropTypes.string, | ||
})).isRequired, | ||
}; | ||
export default ListDictionaries; |
There was a problem hiding this comment.
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)); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line required here
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True
There was a problem hiding this comment.
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 = ( |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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>); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
src/redux/reducers/index.js
Outdated
@@ -3,13 +3,16 @@ import AuthReducers from './authReducers'; | |||
import sources from './sourcesReducer'; | |||
import organizations from './dictionaryReducer'; | |||
import concepts from './ConceptReducers'; | |||
import dictionaries from './dictionaryReducers'; | |||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line needed here
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
99268f6
to
1d163a8
Compare
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()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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