Skip to content

Conversation

@jake-bassett
Copy link
Contributor

@jake-bassett jake-bassett commented Jan 13, 2021

Description

We want to remove the nested Service -> APIs list and just use a flat list. This PR makes that change.

It also:

  • Adds the ability to configure dropdown filters to the table controls
  • Introduces a secondary-entity-specification so we can have a second display: Entity column in the table that links to the service

Screen Shot 2021-01-13 at 2 31 54 PM

Screen Shot 2021-01-13 at 2 40 49 PM

Screen Shot 2021-01-13 at 2 32 10 PM

@jake-bassett jake-bassett requested a review from a team as a code owner January 13, 2021 22:41
@codecov
Copy link

codecov bot commented Jan 13, 2021

Codecov Report

Merging #499 (16d27dc) into main (4002603) will decrease coverage by 0.14%.
The diff coverage is 54.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
- Coverage   85.69%   85.54%   -0.15%     
==========================================
  Files         751      754       +3     
  Lines       15417    15479      +62     
  Branches     1834     1836       +2     
==========================================
+ Hits        13212    13242      +30     
- Misses       2174     2206      +32     
  Partials       31       31              
Impacted Files Coverage Δ
projects/components/src/select/select.component.ts 93.75% <ø> (ø)
...specifiers/mapped-attribute-specification.model.ts 57.14% <ø> (ø)
...src/pages/apis/services/services-list.dashboard.ts 100.00% <ø> (ø)
src/app/shared/navigation/navigation.component.ts 100.00% <ø> (ø)
...d/widgets/table/table-widget-renderer.component.ts 58.82% <34.61%> (-8.53%) ⬇️
...raphql/entity/entities-values-data-source.model.ts 46.15% <46.15%> (ø)
...nts/src/table/controls/table-controls.component.ts 96.07% <50.00%> (-3.93%) ⬇️
.../widgets/table/table-widget-select-filter.model.ts 60.00% <60.00%> (ø)
.../attribute/entities-attribute-data-source.model.ts 75.00% <75.00%> (ø)
projects/components/src/public-api.ts 100.00% <100.00%> (ø)
... and 8 more

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 4002603...16d27dc. Read the comment docs.

@github-actions

This comment has been minimized.

public searchPlaceholder?: string = 'Search...';

@Input()
public selectMap?: Map<string, SelectFilter>;
Copy link
Contributor

Choose a reason for hiding this comment

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

What should be the key and the value? The property name could be more descriptive.

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 am cleaning up this code. Agreed its too confusing. Update incoming.

<!-- Selects -->
<ht-select
*ngFor="let selectFilter of this.selectMap | keyvalue"
Copy link
Contributor

Choose a reason for hiding this comment

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

*ngFor="let selectFilter of this.selectMap | keyvalue"

can we call this selectFilterEntry as the current name conflicts with the value type.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why is this a map? What does key represent here?

Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand, each map entry represents a separate select dropdown? Do we need support for multiple (considering we don't for any other control type)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. In the case of multiple select boxes (we currently have a use case for three of them on the same table), the key is how the user knows which filter changes. It is passed back to the user.

<!-- Selects -->
<ht-select
*ngFor="let selectFilter of this.selectMap | keyvalue"
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand, each map entry represents a separate select dropdown? Do we need support for multiple (considering we don't for any other control type)?


public getData(): Observable<PrimitiveValue[]> {
return this.api
.getData<Dictionary<PrimitiveValue>[]>()
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this model supposed to represent? where is it getting data from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is getting the data to populate the dropdown filter. We query for the Entities, then pull out the values by attribute. frontend and backend as shown in the screenshots.

This is the code that is related to your questions here about using SERVICE instead of API. It shows why we can't index into a SERVICE entity returned by api.getData() when we are working with API entities and attributes in this model.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Jan 15, 2021

Choose a reason for hiding this comment

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

I proposed one tweak in another comment, but alternately, do we even need a fetch? Could we use the fetched data to populate this and just pass the data to the filter model to transform into a filters? That's basically what we're doing with the existing table filters right? The downside would be the same, that our filter options are only based on the queried data.

Copy link
Contributor Author

@jake-bassett jake-bassett Jan 15, 2021

Choose a reason for hiding this comment

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

Aaaaah, right. Agree they should be consistent. Fixed mine to just provide an array of attributes instead of the full Entity. Much better.

As for the single fetch, I think that the independent fetch is still a better route. I don't really like the way I did the header filters where we tie it to the table data. It couple everything too closely. Granted, if you are filtering on a table, the data between the filer and the table should match so technically they are coupled.

But by having them independently fetched we have more freedom to fetch results that might not be fetched by the table due to pagination or other filters (maybe debatable if that second part is good or bad). It also allows us to have filters for columns we don't even fetch/show.

I think I'd like to go with what we have now (along with your other suggestions).

@github-actions

This comment has been minimized.


public getData(): Observable<PrimitiveValue[]> {
return this.api
.getData<Dictionary<PrimitiveValue>[]>()
Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Jan 15, 2021

Choose a reason for hiding this comment

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

I proposed one tweak in another comment, but alternately, do we even need a fetch? Could we use the fetched data to populate this and just pass the data to the filter model to transform into a filters? That's basically what we're doing with the existing table filters right? The downside would be the same, that our filter options are only based on the queried data.

@github-actions

This comment has been minimized.

></ht-search-box>
<!-- Selects -->
<ht-select
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the select dropdown be a multi select dropdown? For example: Show me all the APIs which lies in Service A or Service B or Service C

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually good feedback. I think multi select makes sense. That said, let me get the single select version out and demoed. I'll make the switch to IN filtering once everyone is onboard with the new changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes. that makes sense

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 actually good feedback

What are you saying?!

@github-actions

This comment has been minimized.

const changedSelectFilter = selectFilterModel.getTableFilter(changed.value.value);

const selectFilters = [...existingSelectFiltersWithChangedRemoved, changedSelectFilter].filter(
f => f.value !== undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

does the undefined filtering mean we can't switch back to unfiltered (isn't undefined the "All Services" option) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. The select option returning a value of undefined signals to the widget to drop that filter, so we remove it from the request all together.

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 confused - I would expect to not use that filter in the request, but it should still remain in the dropdown list if I want to return to see all apis across services. The behavior I read/you describe sounds like it is removed from the selection list once an option is chosen, never to return.

@jake-bassett jake-bassett merged commit c5ae452 into main Jan 20, 2021
@jake-bassett jake-bassett deleted the top-level-apis branch January 20, 2021 18:03
@github-actions
Copy link

Unit Test Results

    4 files  ±0  231 suites  ±0   12m 41s ⏱️ +48s
814 tests ±0  814 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
818 runs  ±0  818 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit c5ae452. ± Comparison against base commit 4002603.

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.

5 participants