-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix 41: Create/Delete Provider Types #983
Conversation
04e41bf
to
9eb058c
Compare
2036122
to
d2fd69d
Compare
fd94e0a
to
e428ee1
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.
This is a big improvement, thanks @frankduncan ! There's a lot here. Everything worked as expected when I tried it out. (Adding, editing, deleting provider types, adding licenses to them, and seeing the licenses show up on a new application of the new type.) I had a few minor comments. Given the size, it could probably use another look by another pair of eyes, particularly some of the Java code changes and the unit tests. Thanks for all the code improvements and the solid test coverage.
<div class="col2"> | ||
<c:forEach var="licenseType" items="${licenseTypes}"> | ||
<div class="row"> | ||
<span>${licenseType.description}</span> |
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.
You can omit the <span>
here, as it's not doing anything.
@@ -62,6 +62,32 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="tableHeader"><span>Applicable Licenses</span></div> |
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.
Do you need the span here? I see they exist in similar places elsewhere in 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.
There is a css specifically for these, yeah. I am definitely wary of the different style interactions, so I just copy paste from other sections in the page when I'm doing "make a new section that looks like that one please."
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.
Ah, gotcha, makes sense.
<c:forEach var="licenseType" items="${allLicenseTypes}"> | ||
<option | ||
value="${licenseType.code}" | ||
${licenseType.code eq selectedLicenseType.code ? 'selected' : ''} |
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.
Optional suggestion: use "==" instead of "eq" because it's less cryptic and easier for JPS novices to understand.
@@ -1274,7 +1274,7 @@ input.date{ | |||
width:160px; | |||
} | |||
|
|||
.tableData table .remove{ | |||
.remove{ |
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.
👍
</c:forEach> | ||
<c:forEach var="doc" items="${remainingAgreements}"> | ||
<div class="row"> | ||
<input id="remaining_provider_agreement_${doc.id}" type="checkbox" name="providerAgreements" value="${doc.id}"/> |
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 lines are a little long. I see they are already that way, but if you feel inclined to split them up on several lines while we're here, feel free.
@@ -105,7 +103,6 @@ public void setContactEmail(String contactEmail) { | |||
} | |||
|
|||
public void checkForFeinError() throws Exception { | |||
assertThat($(".errorInfo > ._15_fein").getText()) | |||
.contains(ORGANIZATION_FEIN_ERROR_MESSAGE); | |||
checkForFormError("_15_fein", ORGANIZATION_FEIN_ERROR_MESSAGE); |
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.
👍
<span class="floatL"><b>:</b></span> | ||
<form:input id="createEditProviderTypeProviderType" path="description" cssClass="text"/> | ||
<label for="editProviderTypeProviderType">Provider Type</label> | ||
<span class="floatL"><b>:</b></span> |
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.
Let's take out this line to avoid the unnecessary colon (see #376).
<c:forEach var="selectedLicenseCode" items="${selectedLicenseCodes}"> | ||
<div class="providerTypeLicenseRow"> | ||
<label> | ||
<div class="providerTypeLicenseRowLabel">Applicable License:</div> |
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.
Let's remove the colon here (see #376).
</form:form> | ||
<div id="licenseTemplate" class="providerTypeLicenseRow"> | ||
<label> | ||
<div class="providerTypeLicenseRowLabel">Applicable License:</div> |
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.
Let's remove the colon here (see #376).
.providerTypeLicenseRow .remove { | ||
float:left; | ||
margin-top:10px; | ||
} |
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.
Hmmm, this brings up the BEM approach again. Would these work without the parent .providerTypeLicenseRow
? Maybe with more specific class names? If so, then it would be better to avoid the inheritance. And for the label
one it would need its own class. But I won't insist if you want to stick with this approach.
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.
Hmmmm. I'm not sure if these would work without that.
As some context, the css for this gave me a lot of issues, because this page brought in a lot of css intended for the enrollment application screens. When I brought in selects and the remove button, things just looked bad until I started overriding some of those general css (for instance, all selects in a newEnrollmentPanel are float:left). I attempted a more organized, architected approach, but every time I played around with that, things went really weird, really fast, so I just kind of kept throwing styles at it until it looked right. I surmised that doing it the right way and rebuilding the page intelligently would involve a bit too much work.
The consequence is that if you remove the newEnrollmentPanel class from the top level div, none of these are even necessary anymore, much less useful as anything other than a bandaid for this specific case, so having them be reusable via BEM might not be a win.
However! I'm very welcome to doing that in the interim if you think it's the right move with this context.
I'm still somewhat unused to the BEM approach. This would be replaced by .providerTypeLicenseRow__remove
and that class added to the remove span? And then similarly with other items that I did specifically for this page?
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 hear you on the CSS issues... These kinds of difficulties are the reason I'm interested in moving towards a more BEM-style approach (since they usually involve unwanted inheritance and needing greater and greater selector specificity to override existing styles with new ones).
We haven't adopted the full BEM naming convention (but maybe we should...). I've just been trying to avoid inheritance when creating new styles, when possible and straightforward, and using unique class names instead. But it's an uphill battle, to say the least, given the current size and state of our CSS file.
I'm still getting used to BEM, but I think .providerTypeLicenseRow__remove
is the right idea, if we say that the row is a block and the remove button is an element that belongs to that block and will only appear in it (so we have a block__element
class). (If we wanted to say that the remove button is its own block, and could appear in other contexts, then we'd just have a block-only name, something like .remove-button
. If we were starting from scratch that probably would be the way to go, but since we're not, I think it would be best to just go with the block__element class.)
Let me look a little closer at this particular case and see what makes sense. Curious about what removing the newEnrollmentPanel
would do. More in a bit.
6c4e4bd
to
eebb454
Compare
Thanks for the review @PaulMorris ! I did some discussion inline before I make some of the changes you were requesting. I'm also requesting a quick review from @jasonaowen as a secondary sanity check. |
Per discussion on zulip, I've added some commits for the CSS part. I'm +1 to merge pending @jasonaowen taking a look. |
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.
Overall the code looks good, but for a few small (non-blocking) concerns below. Testing now!
Also, I'm sorry for introducing merge conflicts, @frankduncan - I should have prioritized reviewing this over making further changes.
/** | ||
* This method gets a provider type by its description. If not found, returns null. | ||
* | ||
* @param string - the description of the provider type to retrieve |
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.
Typo: string
should be description
.
* | ||
* @param string - the description of the provider type to retrieve | ||
* @return - the requested provider type | ||
* @throws PortalServiceException - If there are any errors during the execution of this method |
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 method doesn't declare PortalServiceException
as an exception it throws, so this @throws
line should be deleted.
pt.code == '00' | ||
} | ||
|
||
def "Get ProviderType then update"() { |
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'm having trouble understanding this test. What do you want it to do? Would you mind splitting out a given:
section for test setup so that the when:
section can contain only the bit you want to test? Does it need to be broken out into multiple different tests?
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.
Take a look now, I think it's clearer.
@frankduncan this is pretty amazing! Awesome job. In particular, I like the logic around disabling deletion if there are existing enrollments with that provider type or if there are provider type settings. Is there a way to add organizational provider types, or only individual? There is, I think, follow-up work to fully complete the feature of "adding and editing provider types", but this PR is probably enough to resolve #41. Can you help me figure out the remaining steps necessary, and then we can open issues?
|
923c986
to
6d09acd
Compare
75879c5
to
d66e16e
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.
Thank you, @frankduncan! Those follow-up issues are perfect, and this looks good to me.
Having two entity graphs for completeness is unneeded by the application and blocking the ability to easily edit provider types. To fetch eagerly when getting a single providertype requires the agreements and license type to be sets.
Consolodating them all in ProviderTypeService makes further enhancements cleaner.
Issue #41: Fix or remove provider type creation/deletion
Issue #41: Fix or remove provider type creation/deletion When re-enabling editing, license types were getting lost. This adds a UI to keep/add them.
d66e16e
to
6bdf723
Compare
This grew to more than just #41, as it appeared the entire provider type editing UI was incomplete.
Test by adding, editing, and deleting provider types from the admin interface. Additional check to see if agreements and license options are added to enrollments.