Skip to content

Conversation

@hillalex
Copy link
Contributor

@hillalex hillalex commented Jul 10, 2019

Contains commits from #105 so merge that one first

Found a nifty bootstrap typeahead vue component for this.

@codecov
Copy link

codecov bot commented Jul 10, 2019

Codecov Report

Merging #106 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #106      +/-   ##
============================================
+ Coverage     95.03%   95.07%   +0.04%     
- Complexity      518      519       +1     
============================================
  Files           141      141              
  Lines          2455     2479      +24     
  Branches        184      185       +1     
============================================
+ Hits           2333     2357      +24     
  Misses           77       77              
  Partials         45       45
Impacted Files Coverage Δ Complexity Δ
...rlyweb/app_start/routing/web/WebUserRouteConfig.kt 100% <100%> (ø) 2 <0> (ø) ⬇️
.../org/vaccineimpact/orderlyweb/db/UserRepository.kt 100% <100%> (ø) 0 <0> (ø) ⬇️
...ic/src/js/components/reports/reportReadersList.vue 100% <100%> (ø) 0 <0> (ø) ⬇️
...mpact/orderlyweb/controllers/web/UserController.kt 100% <100%> (ø) 5 <1> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41356ff...9f01535. Read the comment docs.

@hillalex hillalex marked this pull request as ready for review July 10, 2019 11:09
@hillalex hillalex requested a review from EmmaLRussell July 10, 2019 11:18
@hillalex hillalex removed the request for review from EmmaLRussell July 10, 2019 15:33
.transform()
.secure(usersManage)
.secure(usersManage),
WebEndpoint("/users/",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be /users/ or something more specific, like /emails/? It's just for returning valid user emails for the autocomplete...

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's just returning emails I'd probably expect a more specific route, since we already have endpoint which are returning user models, which in a RESTful way I'd expect to be the resource I'd find at /users/. But since this isn't a part of the REST API and is just for the web app's internal use I guess it isn't so important!

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, having said that, maybe we don't have anything returning the User model just now, as there's now a ReportReaderViewModel instead. Although maybe that will change once we've done the Admin screens.
I still think /users/emails might be a bit clearer!

@hillalex hillalex requested a review from EmmaLRussell July 10, 2019 16:21
@hillalex hillalex mentioned this pull request Jul 11, 2019
Copy link
Contributor

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

Yeah, that bootstrap-typeahead is nice, makes life a lot easier!

It might be nice if, after you've added a new user, it cleared the email control, so you could just click back in there and start typing to get more auto complete results, rather than having to clear the box first.
Ooh actually, having said that, I've just noticed that you do get a little blue cross (that's come from bootstrap-typeahead I guess) which makes that easy to do anyway.

.transform()
.secure(usersManage)
.secure(usersManage),
WebEndpoint("/users/",
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's just returning emails I'd probably expect a more specific route, since we already have endpoint which are returning user models, which in a RESTful way I'd expect to be the resource I'd find at /users/. But since this isn't a part of the REST API and is just for the web app's internal use I guess it isn't so important!

.transform()
.secure(usersManage)
.secure(usersManage),
WebEndpoint("/users/",
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, having said that, maybe we don't have anything returning the User model just now, as there's now a ReportReaderViewModel instead. Although maybe that will change once we've done the Admin screens.
I still think /users/emails might be a bit clearer!


fun getUserEmails(): List<String>
{
return userRepo.getUserEmails()
Copy link
Contributor

Choose a reason for hiding this comment

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

So we're assuming that we always have a manageable number of users to be able to return the full list on each call? No value in doing an initial filter with first few letters here? Probably not for the number we have in Montagu, would just make the UI less responsive.

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 think so, yeah. The number of users would have to be pretty high for this to be a problem.

}

@Test
fun `gets user emails in alphabetical order`()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test name misleading? I can't see ordering code, and I didn't think containsExactlyElementsOf checked order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

containsExactlyElementsOf is order sensitive. Seems sqlite returns the records in alphabetical order, hence no extra ordering logic.

@hillalex
Copy link
Contributor Author

hillalex commented Jul 11, 2019

Ok, /user/emails/ would end up giving us ambiguity problems if we wanted to implement /user/:user/ so I've gone with the super specific /typeahead/emails/. That way we'll always be clear about why we have this route! To be shortly followed by /typeahead/roles/ (and I guess at some point /typeahead/permissions.. reports... versions etc)

@hillalex hillalex requested a review from EmmaLRussell July 11, 2019 17:03
Copy link
Contributor

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

The first commit commit implies that the intention was to clear the email field after successful add, but it doesn't seem to. Not sure if I'm missing something!

@hillalex
Copy link
Contributor Author

hillalex commented Jul 12, 2019

Huh, ok, what I thought was the fix is this typo fixed here:
9b8a79e#diff-9b4909ce9cecd056a2e47e2dac8a916aR105 and tested here: 9b8a79e#diff-4ff6d71081ba63d542dd80f1a3ec4850R174

(slightly confusingly I also fixed the naming convention from camel case to snake case at the same time)

But it seems like resetting the v-model of the typeahead doesn't actually trigger a change in that component; in fact looks like they have an open PR that fixes this, so I''ll keep an eye on that and update once fixed: alexurquhart/vue-bootstrap-typeahead#21

@hillalex
Copy link
Contributor Author

Oh man, actually looks like that repo is dead. Last commit in October and lots of outstanding PRs. Maybe we should fork it and fix it.

@EmmaLRussell EmmaLRussell merged commit f0c58b7 into master Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants