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

Fix 41: Create/Delete Provider Types #983

Merged
merged 12 commits into from
Aug 29, 2018

Conversation

frankduncan
Copy link

@frankduncan frankduncan commented Jul 23, 2018

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.

@kfogel kfogel added the review label Jul 23, 2018
@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch 2 times, most recently from 04e41bf to 9eb058c Compare July 23, 2018 04:55
@frankduncan frankduncan changed the title Fix 41: Create/Delete Provider Types Fix 41: Create/Delete Provider Types - WIP Jul 23, 2018
@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch from 2036122 to d2fd69d Compare July 24, 2018 14:55
@frankduncan frankduncan changed the title Fix 41: Create/Delete Provider Types - WIP Fix 41: Create/Delete Provider Types Jul 24, 2018
@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch 2 times, most recently from fd94e0a to e428ee1 Compare July 25, 2018 16:02
@PaulMorris PaulMorris self-requested a review July 25, 2018 21:17
Copy link
Contributor

@PaulMorris PaulMorris left a 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>
Copy link
Contributor

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>
Copy link
Contributor

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.

Copy link
Author

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."

Copy link
Contributor

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' : ''}
Copy link
Contributor

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{
Copy link
Contributor

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}"/>
Copy link
Contributor

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);
Copy link
Contributor

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>
Copy link
Contributor

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>
Copy link
Contributor

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>
Copy link
Contributor

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;
}
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

@PaulMorris PaulMorris Jul 26, 2018

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.

@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch 2 times, most recently from 6c4e4bd to eebb454 Compare July 26, 2018 10:10
@frankduncan
Copy link
Author

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.

@frankduncan frankduncan requested a review from jasonaowen July 26, 2018 10:15
@PaulMorris
Copy link
Contributor

Per discussion on zulip, I've added some commits for the CSS part. I'm +1 to merge pending @jasonaowen taking a look.

Copy link
Contributor

@jasonaowen jasonaowen left a 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
Copy link
Contributor

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
Copy link
Contributor

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"() {
Copy link
Contributor

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?

Copy link
Author

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.

@jasonaowen
Copy link
Contributor

jasonaowen commented Aug 24, 2018

@frankduncan this is pretty amazing! Awesome job.

screenshot 2018-08-24 15 32 22

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?

@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch 3 times, most recently from 923c986 to 6d09acd Compare August 28, 2018 19:57
@frankduncan
Copy link
Author

I've opened #1060, #1061, and #1062 for these issues. Yay!

@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch 2 times, most recently from 75879c5 to d66e16e Compare August 28, 2018 20:36
Copy link
Contributor

@jasonaowen jasonaowen left a 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.

Frank Duncan added 5 commits August 28, 2018 16:15
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.
Frank Duncan added 7 commits August 28, 2018 16:15
Provider Types must have unique descriptions, and this adds the UI for
that enforcement.

Issue #41: Fix or remove provider type creation/deletion
Issue #41: Fix or remove provider type creation/deletion
Issue #41: Fix or remove provider type creation/deletion
@frankduncan frankduncan force-pushed the 41-Fix-Provider-Types-Interface branch from d66e16e to 6bdf723 Compare August 28, 2018 21:27
@frankduncan frankduncan merged commit 06698f1 into master Aug 29, 2018
@frankduncan frankduncan deleted the 41-Fix-Provider-Types-Interface branch August 29, 2018 10:01
@kfogel kfogel removed the review label Aug 29, 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
Development

Successfully merging this pull request may close these issues.

4 participants