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

Issue 147/multi doc pathways #381

Merged
merged 11 commits into from
Mar 16, 2020

Conversation

samshuster
Copy link
Contributor

@samshuster samshuster commented Jan 28, 2020

Summary of Changes

mr to get feedback as part of amundsen-io/amundsen#147
Currently blocked by amundsen-common being merged and getting feedback.

Here is current screenshot. You can see the added sections in bottom left.
Screen Shot 2020-02-13 at 1 46 14 PM
Screen Shot 2020-02-13 at 1 46 20 PM

Current features:

  • supports 0 to n separate programmatic sections
  • supports markdown
  • does not support editing
  • does not currently support search, but very easy to add that
  • supports configurable display names for the sections as well as order

Tests

Updated python api tests for configuring the order of the sections
Updated the javascript tests to the best of my ability, but I believe more tests could be used here.

Documentation

Updated some documentation on how to configure these sections

CheckList

Make sure you have checked all steps below to ensure a timely review.

  • PR title addresses the issue accurately and concisely. Example: "Updates the version of Flask to v1.0.2"
  • PR includes a summary of changes, including screenshots of any UI changes.
  • PR adds unit tests, updates existing unit tests, OR documents why no test additions or modifications are needed.
  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public python functions and the classes in the PR contain docstrings that explain what it does
  • PR passes all tests documented in the developer guide

@feng-tao feng-tao added the keep fresh Disables stalebot from closing an issue label Jan 31, 2020
@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from 8862232 to 2f61f8c Compare February 3, 2020 22:28
@samshuster samshuster changed the title WIP: Issue 147/multi doc pathways Issue 147/multi doc pathways Feb 13, 2020
@samshuster samshuster changed the title Issue 147/multi doc pathways WIP: Issue 147/multi doc pathways Feb 13, 2020
@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from 67b1b59 to 8a7d9f1 Compare February 13, 2020 21:46
@codecov-io
Copy link

codecov-io commented Feb 13, 2020

Codecov Report

Merging #381 into master will decrease coverage by 0.02%.
The diff coverage is 76.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #381      +/-   ##
==========================================
- Coverage   78.33%   78.30%   -0.03%     
==========================================
  Files         194      194              
  Lines        4819     4845      +26     
  Branches      625      633       +8     
==========================================
+ Hits         3775     3794      +19     
- Misses        998     1003       +5     
- Partials       46       48       +2     
Impacted Files Coverage Δ
...ication/static/js/components/TableDetail/index.tsx 0.00% <0.00%> (ø)
...plication/static/js/ducks/tableMetadata/reducer.ts 88.88% <ø> (ø)
...dsen_application/static/js/fixtures/globalState.ts 100.00% <ø> (ø)
amundsen_application/api/utils/metadata_utils.py 79.31% <80.00%> (-0.18%) ⬇️
amundsen_application/config.py 100.00% <100.00%> (ø)
...s/components/TableDetail/EditableSection/index.tsx 100.00% <100.00%> (ø)
...ication/static/js/components/common/Flag/index.tsx 100.00% <100.00%> (ø)
amundsen_application/api/utils/search_utils.py 96.00% <0.00%> (ø)
...dsen_application/static/js/interfaces/Resources.ts 100.00% <0.00%> (ø)
...ts/common/ResourceListItem/TableListItem/index.tsx 100.00% <0.00%> (ø)

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 2f7930d...b50c038. Read the comment docs.

@samshuster samshuster changed the title WIP: Issue 147/multi doc pathways Issue 147/multi doc pathways Feb 13, 2020
@samshuster
Copy link
Contributor Author

ok @ttannis this is ready for you to review!

@samshuster samshuster requested a review from ttannis February 13, 2020 22:06
@jornh
Copy link
Contributor

jornh commented Feb 25, 2020

Would be good to mention PROGRAMMATIC_DISPLAY config in https://github.com/lyft/amundsenfrontendlibrary/pull/381/files#diff-da4c534f10ac33888daef3b30ba35474 In the Flask config documentation: https://github.com/lyft/amundsenfrontendlibrary/blob/master/docs/flask_config.md

Also, maybe worth showcasing the demo screenshots above in the same document? I’d prefer that over keeping adding optional customization screenshots to the main README (otherwise it’s just getting longer and longer)

Finally maybe also worth to point to how to ingest data as introduced in databuilder amundsen-io/amundsendatabuilder#187?

@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch 3 times, most recently from 1fa85c3 to 1044592 Compare February 26, 2020 16:33
@samshuster
Copy link
Contributor Author

ok @jornh documentation for frontend added. I will go back and add in some documentation to databuilder too.

Copy link
Contributor

@jornh jornh left a comment

Choose a reason for hiding this comment

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

Overall great write up! Thanks @samshuster for all your effort on this great feature.

One clarifying question, does the sentence I marked below imply that:

If PROGRAMMATIC_DISPLAY is left at None all added fields are still showing up, so that display is entirely dynamically data-driven without configuration. Meaning configuration merely adds the (nice) benefit of setting display order.

If so, I’ll leave it to you if you think it’s worth to add this to the documentation...

Looking forward to see if there’s any Lyft designer team input 👍

docs/flask_config.md Outdated Show resolved Hide resolved
@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from 108fe93 to b70bf7a Compare March 6, 2020 13:39
@ttannis
Copy link
Contributor

ttannis commented Mar 9, 2020

Hey @samshuster below is a screenshot for what our designer would like to see, and what you have is basically almost there. The design concepts we want to maintain are:

  1. The programmatic descriptions will be in their own section which will live at the bottom left hand panel. The reason is that since this information can be any number of descriptions, we would not want them to push down all other metadata, especially things related to quality features.
  2. This programmatic description section will have header as seen the mocks to make it clear the the information is read only and auto-generated.
  3. Since we do not know what the data in these descriptions will be, each description will take up the full width of the panel.
  4. Maintain existing section header styles, more specifically here the fact that we use "Title Case", which means s3 crawler header should be rendered as S3 Crawler

Copy link
Contributor

@ttannis ttannis left a comment

Choose a reason for hiding this comment

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

Initial review. Let me know your thoughts and let's discuss any questions before moving forward.

@samshuster
Copy link
Contributor Author

hey @ttannis thanks for the great feedback!
Will be going over this later today and tomorrow

@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from 8bbfa2d to cc3c536 Compare March 11, 2020 13:35
@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from d522f1c to 4bfc576 Compare March 12, 2020 14:26
@samshuster
Copy link
Contributor Author

Ok @ttannis thank you so much for your feedback, learning a lot!

At this point I believe I am ready for another review. I have also made the design changes per the recommendations. Please find a screenshot of what it looks like now:

Screen Shot 2020-03-12 at 8 16 20 AM

Per our long conversation about optional configuration. I have include the Flag convertText function by default.

Known issues:
- is_editable property not respecected

Added NonEditable Section

Now no longer need to sort in index page.
Uses the display title for title now.
Added currently untested code in the api for programmatic display

programmatic descriptions no longer needs to be returned by metadata service for backwards compatibility
Tests added for the programmatic display component

Caught a bug where display_title was not being set if configuration wasn't set.
change source_id to source
Make code more robust
Rebasing with the upstream changes that have been made.
adding documentation
removing the comment in the config.py class

Fixing upstream merge conflicts.

Update docs/flask_config.md

Co-Authored-By: jornh <[email protected]>

Removing non editable section!

readOnly is now an optional Property
Added in a programmatic header and <hr> per design doc

adding test for button rendering

Adding in convertText function
Changing SENTENCE_CASE -> Upper Upper. Need to confirm that this is ok, otherwise can create a new case

Reverting SentenceCase
Creating PascalCase
Removing custom title

Moving convert text to EditableSection. Applying by default
@samshuster samshuster force-pushed the issue-147/multi-doc-pathways branch from 72d4cdb to 44fb8d3 Compare March 12, 2020 20:08
@ttannis ttannis added the 2.1.0 label Mar 12, 2020
@samshuster
Copy link
Contributor Author

ok @ttannis it is ready for you to take another look at it.

Copy link
Contributor

@ttannis ttannis left a comment

Choose a reason for hiding this comment

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

@samshuster looks good, a few more small comments. If any of the comments on the unit tests don't make sense just let me know, I can always address them after this is merged and you can have that PR for future reference.

amundsen_application/api/utils/metadata_utils.py Outdated Show resolved Hide resolved
amundsen_application/api/utils/metadata_utils.py Outdated Show resolved Hide resolved
amundsen_application/api/utils/metadata_utils.py Outdated Show resolved Hide resolved
docs/flask_config.md Show resolved Hide resolved
@@ -312,6 +370,85 @@ def test_get_table_metadata_success(self) -> None:
self.assertEqual(response.status_code, HTTPStatus.OK)
self.assertCountEqual(data.get('tableData'), self.expected_parsed_metadata)

@responses.activate
def test_get_table_programmatic_metadata_success(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of needing a new test and a new object, you could add programmatic_descriptions to self.mock_metadata and self.expected_parsed_metadata. Beyond that I think the new tests you'd have to write wouldn't be in this file.

The new functionality you added can be summarized as:

  1. _marshall_table_full updates the programmatic_descriptions with _update_prog_descriptions
  2. _update_prog_descriptions acts updates progrmmatic_descriptions according to certain criteria
  3. _sort_prog_descriptions returns a order value according to certain criteria

Since the idea is to unit test new functionality I would expect to see tests for these new methods. However I notice we are lacking a test file for metadata_utils. Overall I'd say we could add programmatic_descriptions to the test input and output for test_get_table_metadata_success, but beyond that we would want to just make a test_metadata_utils.py in tests/unit/utils and add a test for those methods you added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, here is what I did, hopefully this is pretty much in line with your recommendations:

  • I added programmatic_descriptions to mock_data
  • I removed the two separate programmatic_description tests from test_v0
  • I added a new test_metadata_utils file and added a single test for marshall_table_full at this time. My thought is that by testing this method, it tests the other private methods.

Copy link
Contributor

@ttannis ttannis Mar 16, 2020

Choose a reason for hiding this comment

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

  • My thought is that by testing this method, it tests the other private methods.

While that is true, it's a good practice for unit tests to isolate logic and explicitly test behaviors. For example if method A() calls method B() and returns some output C, we could call method A(), check that C is returned and consider both A() and B() tested.

However with this approach if the logic in B() ever changes then the test fails. Then the question becomes why should a change in the internal logic for B() be able to break a unit test for A()? We would address this by mocking B() with some fake logic in the unit test. I will tag you in a PR that demonstrates this.

Thanks for your work on this feature!

Copy link
Contributor

@ttannis ttannis left a comment

Choose a reason for hiding this comment

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

Thanks @samhuster. We will merge this today and I'll make some tweaks to unit tests. This will be part of the next version of amundsenfrontendlibrary. You can expect it within the next week, unless we discover and major bugs with the other new features we've been testing internally.

@@ -75,7 +79,7 @@ def setUp(self) -> None:
'name': 'test_name',
'id': 'test_id',
'description': 'This is a test'
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing commas are okay in python and for a couple of nuanced reasons can be desirable. No need to put them back in (we should have a linter handle this at some point), but also no need to remove them in the future:
https://stackoverflow.com/questions/11597901/why-are-trailing-commas-allowed-in-a-list

local_app = create_app('amundsen_application.config.TestConfig', 'tests/templates')


class MetadataUtilsTest(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't exactly what I meant but I can modify this after merging and tag you for reference. Ideally, we would have already had a test_metadata_utils set up with at least one example to make things easier.

@ttannis ttannis merged commit ef49b88 into amundsen-io:master Mar 16, 2020
ttannis added a commit that referenced this pull request Mar 18, 2020
* Allow users to create JIRA tickets associated with a table (#389)

* add jira connection

* update location of report data issue

* add some reducers

* add to global state

* fix saga/redux flow for the jira issues view

* use redux to handle reporting a data issue
:

* fix build

* add jira sdk to requirements.txt, run fix lint errors for js

* add comment

* add data quality icon

* move constants into a separate file

* add tests for reducer and api

* add some more tests

* add more tests, do some refactoring

* still working on tests

* fix unit tests that don't quite work

* fix lint errors

* add some python tests

* add more tests for jira client

* remove unused imports

* remove unused import

* fix lint errors

* for some reason i have to add types?

* re-fix tests

* update comments

* address some comments

* respond to comments

* respond to comments

* remove jira project id requirement:

* add base class for issue tracking

* add resource for issue endpoint

* interim commit while refactoring into more generic

* do some refactor, add a generic base client

* refactor name from jira -> issue

* fix spec per changes in the api

* respond to some pr comments, add some error handling if no jira component is enabled

* update per pr comments

* remove utils for trucation, use ellipsis

* add custom exception class, make sure it returns config error on api call

* fix tests, refactor

* fix lint

* hopefully fix build

* css fix

* try removing jira from requirements

* update tests, add total count of remaining results to api call

* add comment, see if this fixes the build

* update tests

* update build steps

* try making the extras a string like in examples

* try to follow example exactly

* try without quotes

* update tests, make method to generate url

* try string again

* try using jira as a string

* remove references to extras and just install the package

* mock urllib

* update tests

* add tests for rending extra issues

* update text on issues view

* fix some lint issues

* respond to pr comments

* update per pr comments

* respond to pr comments

* fix some lint errors

* respond to comments, some lint fixes

* fix more lint

* respond to pr comments

* remove todo

* add definition of api calls in fe

* hide issue integration by default

* fix tests, increase test coverage a bit

* update some text

* update per some product feedback

* update test

* Apply suggestions from code review

Co-Authored-By: Tamika Tannis <[email protected]>

* update per pr comments

Co-authored-by: Tamika Tannis <[email protected]>

* Add documenation for JIRA feature (#395)

* Add documenation for JIRA feature

* update link

* update docs a little bit

* add some more clarification

* remove whitespace

* Search Filtering Support (#384)

* Initial Filter React/Redux Modifications (#357)

* Update configs and SearchFilter UI

* Remove search syntax logic in SearchBar; Add RegEx validatation for SearchBar

* Add filter state and ducks logic

* Update filter UI; Code cleanup

* Some python lint fixes

* Code cleanup

* Update request utils

* Filter UX Improvements (#361)

* SearchFilter UX improvements

* Filter url updates; Modify no search results message

* Support loading filters from pasted url

* InputFilter apply changes on 'enter'

* Simplify reducer logic + lint cleanup

* Some cleanup based on comments

* Fix build

* Mypy fix

* Mypy fix

* Filter UI Improvements: Part 1 (#370)

* Change 'Type' to 'Source'

* Prevent SearchPanel width increase when InputFilter is present

* Re-lower coverage while in development

* Managed input autocomplete (#375)

* Disabled autocomplete for some email input fields
* Removed the hard coded font size for autocomplete

* Improve user search experience (#376)

* Fix a merge issue

* Allow no search term; Persist filters on SearchPage

* Lint fix

* Add a TODO

* Add support for configurable filter section help text (#377)

* Add support for configurable filter section help text

* Support on CheckboxFilterSection as well

* Add default filterCategories for tables

* Add default helpText

* Update search flow (some more) (#383)

* Add a Breadcrumb on HomePage that makes filters discoverable

* Switch to using explicit clearing of search term; Revert to requiring term for SearchBar submit

* Allow for html in InforButton text

* WIP: Comment out some tests

* Fix an edge case

* Cleanup python logic; Add comments; Add tests;

* Fix indentation error; Cleanup python tests;

* Cleanup HomePage, Breadcrumb, InfoButton; Update tests

* Connect SearchBar to router for executing special SearchPage logic

* Cleanup SearchBar; Add tests;

* Cleanup SearchPage; Add tests

* Cleanup SearchFiilter components; Add tests; Increase jest threshold;

* Fix build; Update FilterSection types

* Cleanup config; Add tests; Update jest threshold;

* Add another config test

* Fix SearchFilter; Add filter action types; Code cleanup; Add tests;

* Cleanup search reducer; Update/add tests;

* Cleanup ducks + utils; Add tests;

* Update application config documentation

* Update endpoint to match search library change

* Remove unused lines

* Update input styles

* rename filterconfig 'value' reference to 'categoryId'

* Add new filter logic to support TagInfo case

* Lint fix

* Restructure filter components to leverage mapStateToProps; Update FilterType enums

* Lint fix

* Fix bad merge

* Apply suggestions from code review

Co-authored-by: Daniel <[email protected]>

* Adds some responsiveness to table detail layouts (#391)

* Improve granularity of logging search actions (#396)

* WIP: One approach

* Second approach

* Fix a few errors; Add tests

* Fix test

* Code cleanup

* Change value for when user selects inline result & searchAll is needed

* Update SearchType enum

* Use snake_case for consistency in backend until we have some auto-convert

* Filter Fixes (#399)

* Reset pageIndex to 0 on filter update

* Allow CheckBoxItem to handle checked = undefined

* Create TableHeaderBullets component (#397)

* Create TableHeaderBullets component

* Fix mocks

* Update search_table endpoint (#400)

* Update search_table endpoint

* Update test docstring

* Add reporter for JIRA Issue Creation (#401)

* WIP test commit

* Update reporter object

* Testing user id

* Another test

* Update fix

* Update jira logic. Move default configs

* Add issue link; Add reported by in description

* Update logic to transform filters then call _search_table (#402)

* Update logic to transform filters then call _search_table

* Update tests

* Upgrade redux & react-redux (#373)

* Update search results to include badges and display them (#398)

* update search to include badges

* fix test

* slight change

* remove mapping for badges

* fix lint

* remove badge as a search term since its not in the filters in ui

* update test, remove unneeded import

* Caste input to lowercase like we do for SearchBar (#404)

* Issue 147/multi doc pathways (#381)

* This adds "programmatic descriptions" into the frontend.

Known issues:
- is_editable property not respecected

Added NonEditable Section

Now no longer need to sort in index page.
Uses the display title for title now.
Added currently untested code in the api for programmatic display

programmatic descriptions no longer needs to be returned by metadata service for backwards compatibility
Tests added for the programmatic display component

Caught a bug where display_title was not being set if configuration wasn't set.
change source_id to source
Make code more robust
Rebasing with the upstream changes that have been made.
adding documentation
removing the comment in the config.py class

Fixing upstream merge conflicts.

Update docs/flask_config.md

Co-Authored-By: jornh <[email protected]>

Removing non editable section!

readOnly is now an optional Property
Added in a programmatic header and <hr> per design doc

adding test for button rendering

Adding in convertText function
Changing SENTENCE_CASE -> Upper Upper. Need to confirm that this is ok, otherwise can create a new case

Reverting SentenceCase
Creating PascalCase
Removing custom title

Moving convert text to EditableSection. Applying by default

* removing pascal case

* fixing doc

* Update amundsen_application/api/utils/metadata_utils.py

Co-Authored-By: Tamika Tannis <[email protected]>

* Update amundsen_application/api/utils/metadata_utils.py

Co-Authored-By: Tamika Tannis <[email protected]>

* cleaning up

* Fixing unit test to have static method

* changing to edit-button

* Moving tests to test_metadata_utils

* Fixing lint

* updating the sample image

Co-authored-by: Tamika Tannis <[email protected]>

* Clean up some tests; Create constant for hardcoded text (#407)

* Fix overflow for issue tracking feature (#406)

* Fix overflow for issues from issue tracking feature

* try using flex properties

* use truncated class

* add span

Co-authored-by: christina stead <[email protected]>
Co-authored-by: Daniel <[email protected]>
Co-authored-by: samshuster <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep fresh Disables stalebot from closing an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants