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

refactor: update invoice registry to latest standards #1760

Merged

Conversation

jniles
Copy link
Contributor

@jniles jniles commented Jun 2, 2017

This PR updates the Invoice Registry to the latest standard. It should help developers of other registries figure out how to update their registries as well.

Note: The 5K+ line change is because I've committed a package-lock.json file that comes by default with npm v5+. You can find it in the release notes. If you would prefer me to remove it and us to ignore it, that's cool. I've removed the package-lock.json as it appears to cause issues with previous NPM versions.

For reference of what changed, all components of #1749 were tackled here.

Code Changes

  1. I've refined the FilterParser implementation on the server by turning off autoParseStatements (see (refactor) Deprecate automatic equals filters  #1454). Every filter must be specified. I've also changed cashReference comparison statement to convert the binary uuid in JS, since this is what most other modules do.
  2. I've migrated the filters to using the client FilterService.
  3. I've ensured the filter modal to latest standards. This includes using bhClear (see refactor: use bhClear for all grid search modals #1702).
  4. The end-to-end tests have been updated to reflect these changes. They now use a combined SearchModal service, shared with the Cash Payments Registry. It provides simple control of the filters.
  5. Two options for downloading have been added: PDF and CSV. For uniformity, they both use the server to serve files to an HTML <a href download> tag. If needed, I can try to implement the CSV rendering with the Exporter service ... but I worry about the difference in UX. I'll look to review for guidance.
  6. I've implemented the GridState service on this grid. It works as the Journal's works.
  7. I've implemented the Grid Column service. It also uses the GridState as described above... however, there is a bug in the Grid Column service reported in bug: Column Configuration limits length of visible columns to 3 #1759.

A Note on End to End Tests

I've combined the Cash Payment Registry's SearchModal page object with the Invoice Registry's SearchModal. Basically, any search form should be able to leverage this page object without writing their own massive test suite. It prefers convention over configuration though, so you'll have to name your controllers $ctrl, your search parameters searchQueries (as done in the Journal and Cash Payments registry) and your default search paramters defaultQueries.

Screenshots

Pics or it didn't happen, right?

New User Interface
invoiceregistrynewui

New Menu Demo
invoiceregistrydropdownmenu

Download as CSV Option
invoiceregistrydownloadascsv png

Column Configuration Modal
invoiceregistrycolumnconfigurationmodal

Column Changes Saved in Save State
invoiceregistrycolumnconfigurationsaved

Closes #1749.


Thank you for contributing!

Before submitting this pull request, please verify that you have:

  • Run your code through ESLint. Check out our styleguide.
  • Run integration tests.
  • Run end-to-end tests.
  • Accurately described the changes your are making in this pull request.

For a more detailed checklist, see the official review checklist that this PR will be evaluated against.

Ensuring that the above checkboxes are completed will help speed the review process and help build a stronger application. Thanks!

@jniles jniles added the Refactor label Jun 2, 2017
@jniles jniles requested a review from sfount June 2, 2017 22:18
@jniles jniles force-pushed the refactor-invoice-registry-to-standards branch from 44df95e to dde37f8 Compare June 5, 2017 08:39
@jniles
Copy link
Contributor Author

jniles commented Jun 5, 2017

Before this gets merged, I need to figure out how to show the grid footer on the same page. I think it's just a CSS class on the grid. 👍

@sfount
Copy link
Contributor

sfount commented Jun 5, 2017

This looks like a great refactor! From the feature review this morning there was only one comment:

  • Many of our grids/ registries overflow on the bottom of the page so that you cannot see the footer row - we should add to all issues that this should be resolved on each registry.

This commit migrates the server-side code to use FilterParser without
autoParseStatements turned on.  It removes a test invalidated by this
change, as well as cleans up a few whitespace issues in other modules.

Partially addresses IMA-WorldHealth#1454.
This commit migrates the client side of the Invoice Registry to use the
FilterService.  To do this, the logic is heavily changed in the Invoice
Registry controller, removing the old DeprecatedFilterService and
replacing it completely.  The InvoiceService now manages caching
filters.  Additionally, the form is separated in two tabs with default
filters and specialized filters.

I've also taken the liberty to remove some style hacks and implemented a
search-modal class in bhima-bootstrap.less.  This class simply
transplants the styles to a location where they can be shared.

Progress towards IMA-WorldHealth#1749.
This commit migrates the cash modal search harness into a global search
form harness.  It is used by the Invoice Registry, updating the invoice
registry's end to end tests.
This commit adds a dropdown menu with two links - the CSV downloader and
the PDF downloader.  Both of these use the server-side download at the
moment.  We could easily switch the CSV exporter to use the client-side
exporter.  It also removes the bhPrintButton in doing so.

Partially addresses IMA-WorldHealth#1749.
This commit implements ui-grid's save-state feature on the invoice
registry, and compliments it with a column configuration service.  This
service is slightly buggy, but that is outside the scope of these
changes.

Closes IMA-WorldHealth#1749.
This commit renders the registry footer visible on all screen sizes by
default.  It was accidentally nuked while introducing the new filters.
@jniles jniles force-pushed the refactor-invoice-registry-to-standards branch from dde37f8 to 5aeb188 Compare June 5, 2017 11:07
@jniles
Copy link
Contributor Author

jniles commented Jun 5, 2017

@sfount, changes have been made.

Copy link
Contributor

@sfount sfount left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Changes from this morning's functionality review have been factored in.

This will be a good standard to reference from the upcoming work on registries.

<div class="toolbar-item">
<div uib-dropdown dropdown-append-to-body data-action="open-menu">
<a class="btn btn-default" uib-dropdown-toggle>
<span class="fa fa-bars"></span> <span class="hidden-xs" translate>FORM.LABELS.MENU</span> <span class="caret"></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good standard 👍

@sfount
Copy link
Contributor

sfount commented Jun 5, 2017

@bors r+

bors bot added a commit that referenced this pull request Jun 5, 2017
1760: refactor: update invoice registry to latest standards r=sfount
This PR updates the Invoice Registry to the latest standard.  It should help developers of other registries figure out how to update their registries as well.

~~**Note**: The 5K+ line change is because I've committed a package-lock.json file that comes by default with npm v5+.  You can find it in the [release notes](https://github.com/npm/npm/releases/tag/v5.0.0).  If you would prefer me to remove it and us to ignore it, that's cool.~~ I've removed the `package-lock.json` as it appears to cause issues with previous NPM versions.

For reference of what changed, all components of #1749 were tackled here.

#### Code Changes
 1. I've refined the `FilterParser` implementation on the server by turning off `autoParseStatements` (see #1454).  Every filter must be specified.  I've also changed cashReference comparison statement to convert the binary uuid in JS, since this is what most other modules do.
 2. I've migrated the filters to using the client `FilterService`.
 3. I've ensured the filter modal to latest standards.  This includes using `bhClear` (see #1702).
 4. The end-to-end tests have been updated to reflect these changes.  They now use a combined `SearchModal` service, shared with the Cash Payments Registry.  It provides simple control of the filters.
 5. Two options for downloading have been added: PDF and CSV.  For uniformity, they both use the server to serve files to an HTML `<a href download>` tag.  If needed, I can try to implement the CSV rendering with the Exporter service ... but I worry about the difference in UX.  I'll look to review for guidance.
 6. I've implemented the GridState service on this grid.  It works as the Journal's works.
 7. I've implemented the Grid Column service.  It also uses the GridState as described above... however, there is a bug in the Grid Column service reported in #1759.

#### A Note on End to End Tests
I've combined the Cash Payment Registry's `SearchModal` page object with the Invoice Registry's `SearchModal`.  Basically, any search form should be able to leverage this page object without writing their own massive test suite.  It prefers convention over configuration though, so you'll have to name your controllers `$ctrl`, your search parameters `searchQueries` (as done in the Journal and Cash Payments registry) and your default search paramters `defaultQueries`.

#### Screenshots
Pics or it didn't happen, right?

**New User Interface**
![invoiceregistrynewui](https://cloud.githubusercontent.com/assets/896472/26746668/ef0bcfa8-47e8-11e7-8bd7-819f9a4e1dea.png)

**New Menu Demo**
![invoiceregistrydropdownmenu](https://cloud.githubusercontent.com/assets/896472/26746674/f928966a-47e8-11e7-9026-2fe054b33142.png)

**Download as CSV Option**
![invoiceregistrydownloadascsv png](https://cloud.githubusercontent.com/assets/896472/26746727/42f4b8e6-47e9-11e7-8e63-fabd55f071fa.png)

**Column Configuration Modal**
![invoiceregistrycolumnconfigurationmodal](https://cloud.githubusercontent.com/assets/896472/26746763/7fb6e542-47e9-11e7-8669-2eb8536517f8.png)

**Column Changes Saved in Save State**
![invoiceregistrycolumnconfigurationsaved](https://cloud.githubusercontent.com/assets/896472/26746774/9109f7da-47e9-11e7-98b6-d01faf5ca512.png)

Closes #1749.

----
Thank you for contributing!

Before submitting this pull request, please verify that you have:
 - [x] Run your code through ESLint.  [Check out our styleguide](https://github.com/IMA-WorldHealth/bhima-2.X/blob/master/docs/STYLEGUIDE.md).
 - [x] Run integration tests.
 - [x] Run end-to-end tests.
 - [x] Accurately described the changes your are making in this pull request.

For a more detailed checklist, [see the official review checklist](https://docs.google.com/document/d/1nupLVLRXgSZJQo_acLgrwvPnN8RukfSiwRhSToj81uU/pub) that this PR will be evaluated against.

Ensuring that the above checkboxes are completed will help speed the review process and help build a stronger application.  Thanks!
@bors
Copy link
Contributor

bors bot commented Jun 5, 2017

Build succeeded

@bors bors bot merged commit 5aeb188 into IMA-WorldHealth:master Jun 5, 2017
@jniles jniles deleted the refactor-invoice-registry-to-standards branch June 5, 2017 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants