-
Notifications
You must be signed in to change notification settings - Fork 76
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-1044:Bug Fix: Pick Concepts from Source and Dictionaries #746
base: master
Are you sure you want to change the base?
Conversation
This is a screenshot of what is implemented in the first part of this ticket. |
color="primary" | ||
onClick={() => setShowSources(!showSources)} | ||
> | ||
{showSources ? "Choose a source/dictionary" : "Select a different source/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.
Maybe this?
{showSources ? "Choose a source/dictionary" : "Select a different source/dictionary"} | |
{showSources ? "Select a recommended source" : "Select an alternative source"} |
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.
@ibacher thanks for the review.
a7abcd0
to
41bf3d7
Compare
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.
@jwnasambu Thanks for this initial step. A few small adjustments and this button should be good.
<Button | ||
variant="contained" | ||
color="primary" | ||
onClick={() => setShowSources(!showSources)} |
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.
onClick={() => setShowSources(!showSources)} | |
onClick={() => setShowSources(!showSources)} |
/> | ||
<Button | ||
variant="contained" | ||
color="primary" |
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 isn't a "primary" button... in fact, we probably don't really want any color for it, so the default is probably good enough.
color="primary" |
onClick={() => setShowSources(!showSources)} | ||
/> | ||
<Button | ||
variant="contained" |
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 would be better to use the text
variant here so it keeps the same UX
variant="contained" | |
variant="text" |
@ibacher kindly I implemented the proposed changes above and I tried to introduce a search box, i.e., a blank text field that we can use to filter the shown sources and dictionaries but am stack and I kindly need your help! I want to use a |
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
>
</Grid> |
@ibacher thanks so so much! I really appreciate your help |
@ibacher with the current changes this is what I have |
@ibacher With the current changes this is the output kindly feel free to comment. screencast.2021-09-30.8.AM-45-54.mp4 |
{/* <Button | ||
variant="text" | ||
onClick={() => setShowSources(!showSources)} | ||
> | ||
{showSources ? "Select a recommended source" : "Select an alternative source"} | ||
</Button> */} | ||
<Input | ||
// onChange={e => setQ(e.target.value)} | ||
// value={q} | ||
color="secondary" | ||
type="search" | ||
fullWidth | ||
placeholder={`choose a source`} | ||
data-testid="searchInput" | ||
endAdornment={ | ||
<InputAdornment position="end"> | ||
<IconButton | ||
onClick={() => setShowSources(!showSources)} | ||
data-testid="searchButton" | ||
> | ||
<SearchIcon /> | ||
</IconButton> | ||
</InputAdornment> | ||
} | ||
/> |
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.
@jwnasambu I can see where you're going here, but we really do want two independent elements that have relatively independent functions. Part of this is because it's very counter-intuitive (I think) to switch the list based on the icon in the search bar when that has... no obvious connection to the two lists displayed.
The onClick
handler in the IconButton
should trigger a search against the current list of sources (and we should only display the search bar when looking at the alternative sources, not the default sources.
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 mentioned on Talk, I think, that we should use a Grid
component to keep everything here orientated in a single column. So I would wrap both the Button and the Input in an element like this:
<Grid
container
direction="column">
// content
</Grid>
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.
@ibacher kindly ignore my current changes for I made without reading through your comment.
ac109cb
to
ac397b8
Compare
@ibacher just to ensure I don't take a wrong direction kindly help me review this work please! |
d59aba1
to
a3aa7d6
Compare
@ibacher Am scared of diverting from the workflow you gave me. With the changes made this is what I have screencast.2021-10-05.3.PM-24-37.mp4 |
@jwnasambu We always want the button to switch between recommended and alternative sources to be visible (and the first thing in the list). It's only the Input field whose visibility should be toggled by which view we're on. So, rather than placing things in a big ternary (... ? ... : ...), we should have: <Grid>
<Button />
{showSources && <Input />}
</Grid> |
@ibacher I desire to be with you on the same page. Kindly review my changes please! |
5365eca
to
50effd5
Compare
@ibacher kindly help me review this PR please!(thought still fixing the issue) |
@iabcher when I use this format
I'm unable to see the search box, but when I remove the button this is what I have screencast.2021-10-07.12.AM-23-28.mp4 |
bf1d1fd
to
d85ff7a
Compare
@ibacher this is the current output locally though the build is failing on the PR. screencast.2021-10-14.12.AM-07-18.mp4 |
6a0bc2e
to
c93b4c6
Compare
@@ -381,7 +381,7 @@ export const recursivelyAddConceptsToDictionaryAction = ( | |||
} | |||
|
|||
if (!concept.hasOwnProperty("source_url") || !!!concept.source_url) { | |||
concept.source_url = concept.url.split("/", 5).join("/") + "/"; | |||
return{...concept,source_url: concept.url.split("/", 5).join("/") + "/"} |
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.
return{...concept,source_url: concept.url.split("/", 5).join("/") + "/"} | |
return {...concept, source_url: concept.url.split("/", 5).join("/") + "/"}; |
@@ -231,7 +232,8 @@ const ViewConceptsPage: React.FC<Props> = ({ | |||
generalFilters: generalFilters, | |||
sourceFilters: sourceFilters, | |||
page: 1, | |||
q | |||
q, | |||
|
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 the empty line here?
dictionaries={dictionaries} | ||
showOnlyVerified={showOnlyVerified} | ||
toggleShowVerified={(e)=>setShowOnlyVerified(e.target.checked)} | ||
|
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 the empty line here?
@@ -84,6 +97,27 @@ const ViewConceptsHeader: React.FC<Props> = ({ | |||
} else setPreferredSources(defaultSources); | |||
}, [showSources, sources, dictionaries]); | |||
|
|||
const fetchMoreData = () =>{ | |||
setTimeout(()=>{ | |||
const previousSources =preferredSources?.filter(Boolean).concat(Array.from({length:10})); |
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.
const previousSources =preferredSources?.filter(Boolean).concat(Array.from({length:10})); | |
const previousSources = preferredSources?.filter(Boolean).concat(Array.from({length: 10})); |
setTimeout(()=>{ | ||
const previousSources =preferredSources?.filter(Boolean).concat(Array.from({length:10})); | ||
setPreferredSources(previousSources) | ||
|
||
},1000); |
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 looks like some sort of simulated code? I think before we get all of these elements looped in we need to start smaller, with just either the search or the toggle. It might be easiest, oddly to just start with a search box and show a default page of 10 results or w/e.
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.
@ibacher I have just commended out the code for now!
36f3f37
to
c616572
Compare
@ibacher kindly feel free to review what I have though still flopping. |
placeholder= {"Select an alternative source"} | ||
value={q} | ||
onChange = {e => setQ(e.target.value)} | ||
data-testid="switch-source" |
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.
data-testid
is just used to supply an id to identify something with via tests. It should only be used as a last resort. Since we don't need it here, we shouldn't have it. If we do need to assign a testid
to this element, it must not be one that we've used elsewhere. This probably also applies to the other data-testid
attributes in this PR.
data-testid="switch-source" |
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.
@ibacher I have removed all the data-testid="switch-source"
that I added. Kindly feel free to review my PR again.
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.
@jwnasambu Since there's a unit test looking for the data-testid="switch-source"
, we can leave it in, we just need to have it assigned to as single element as it was before.
b15f9f8
to
9b34f06
Compare
Cool! We've got all the existing tests passing. So, one thing: would you mind reformatting the code? You should be able to do this by running Then we need to work on getting the data properly. So what we've been trying to do with this is change the menu to select sources so that when you are selecting from "all available" you have a list either filtered to sources or dictionaries. This allows us to provide (I hope) a better experience. The first thing we need is an accurate count of the number of sources and / or dictionaries to fill into the So what we want to do is issue a query to the backend to get all the sources / dictionaries and use the |
@ibacher thanks so so much am going to do it after the call and share the experience. Thanks for the review! |
@ibacher thank you for your kind words! @jwnasambu let me know if you want to get anything clarified from PR 754. |
@merovingienne Thanks so much! I will surely do it. Am so humbled for your wiliness to help. |
835272c
to
c6fb970
Compare
9f84dab
to
fe7a7bb
Compare
f417ea7
to
629adfd
Compare
@ibacher kindly help me review the changes made at your convenient time please! |
d02faec
to
7683e91
Compare
a6ffa09
to
f64d756
Compare
cca44f6
to
3b1ecf2
Compare
JIRA TICKET NAME:
Bug Fix: Pick Concepts from Source and Dictionaries
Summary of what I worked on: