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

Dev catalog- group by Operator #3758

Merged

Conversation

debsmita1
Copy link
Contributor

@debsmita1 debsmita1 commented Dec 11, 2019

This PR includes:

  • adds a Group By dropdown, in the Developer Catalog, with None and Operator as options
  • when Group By Operator is selected then all the Installed Operators which are owned by a CSV are grouped together, and all the Non-Operators are grouped together separately

Refer JIRA story: https://jira.coreos.com/browse/ODC-2452

Screenshot from 2019-12-20 19-44-21

Watch video here: https://youtu.be/lbXgLkb05uo

ToDo:

  • waiting on UX for the final suggestions
  • handle the scenario where Group By Operator and the categories on top-left of the Dev Catalog are selected

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/core Related to console core functionality labels Dec 11, 2019
@debsmita1
Copy link
Contributor Author

debsmita1 commented Dec 11, 2019

^ @openshift/team-devconsole-ux
@christianvogt

@serenamarie125
Copy link
Contributor

Summary of the points we discussed in our meeting:

  • The order of the items in the Group by Operator should be changed. Operator should be first.
  • For a "catch all" grouping, for now use Non Operators. We can modify this at a later date if a better term is found
  • A single grey background should encompass all of the groupings, including the group by titles and tiles
  • Decrease the amount of space after the group by titles by 50%, this will help to create a stronger visual connection between the group title and its tiles
  • Move the Group by drop down closer to the filter component. Try using 32px (xl spacer) between the two components.
  • Once you make these changes, please share again. Currently the group by titles stand out a bit too much. Having them placed on the grey background may help. If not, I'd suggest making them regular font rather than bold.

@debsmita1 debsmita1 force-pushed the group-by-operator branch 3 times, most recently from 9f90bd0 to 409eced Compare December 17, 2019 18:42
@debsmita1
Copy link
Contributor Author

Summary of the points we discussed in our meeting:

* The order of the items in the Group by Operator should be changed. Operator should be first.

Done

* For a "catch all" grouping, for now use Non Operators. We can modify this at a later date if a better term is found

Done

* A single grey background should encompass all of the groupings, including the group by titles and tiles

* Decrease the amount of space after the group by titles by 50%, this will help to create a stronger visual connection between the group title and its tiles

Added 5px space between the title and the group

* Move the Group by drop down closer to the filter component. Try using 32px (xl spacer) between the two components.

Done. Using --pf-global--spacer--xl

* Once you make these changes, please share again. Currently the group by titles stand out a bit too much. Having them placed on the grey background may help. If not, I'd suggest making them regular font rather than bold.

Made the font regular. Using --pf-global--FontSize--lg

@serenamarie125 I have added a youtube link in the PR description. Please let me know if it looks good to you
cc @christianvogt

@debsmita1 debsmita1 force-pushed the group-by-operator branch 3 times, most recently from 1c586dc to 236e46e Compare December 18, 2019 11:25
@debsmita1 debsmita1 changed the title [WIP]: Dev catalog- group by Operator Dev catalog- group by Operator Dec 18, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 18, 2019
@debsmita1 debsmita1 force-pushed the group-by-operator branch 2 times, most recently from 8b72a4c to 060f6c8 Compare December 18, 2019 12:04
@debsmita1
Copy link
Contributor Author

/cc @christianvogt
/cc @abhinandan13jan


const CATEGORY_URL_PARAM = 'category';
const KEYWORD_URL_PARAM = 'keyword';
export const FilterType = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use enum here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better name it FilterTypes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

used const instead of enum because it's giving an error saying 'enum declarations' can only be used in a .ts file cc @christianvogt

Copy link
Contributor

Choose a reason for hiding this comment

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

oh haha... jsx... didn't pick up on that one :)
Time for an upgrade!

groupBy: 'groupBy',
};

export const groupByTypes = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor

Choose a reason for hiding this comment

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

A better name for the enum would be GroupTypes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not an enum?

export const FilterType = {
category: 'category',
keyword: 'keyword',
groupBy: 'groupBy',
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to use groupBy everywhere.

Suggested change
groupBy: 'groupBy',
group: 'group',

Copy link
Contributor

Choose a reason for hiding this comment

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

Grouping should not be a filter.

@@ -227,6 +235,17 @@ const filterByGroup = (items, filters) => {
);
};

export const filterByGroupByDropdown = (items, groupBy) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const filterByGroupByDropdown = (items, groupBy) => {
export const filterByGroup = (items, group) => {

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really a filter though. It's a sort or grouping. I'd remove filter from this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to groupItems

if (groupBy === groupByTypes.Operator) {
const installedOperators = _.filter(items, (item) => item.kind === 'InstalledOperator');
const nonOperators = _.filter(items, (item) => item.kind !== 'InstalledOperator');
const groupedOperators = _.groupBy(installedOperators, (item) => item.obj.csv.metadata.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can sanitize the operator name somehow to make it look better on the UI. The title currently looks really odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rohitkrai03 Do you think the version is making it look odd? cc @serenamarie125

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rohitkrai03 Let me know if this looks okay
Screenshot from 2019-12-19 23-40-18

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this looks much better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

const installedOperators = _.filter(items, (item) => item.kind === 'InstalledOperator');
const nonOperators = _.filter(items, (item) => item.kind !== 'InstalledOperator');
const groupedOperators = _.groupBy(installedOperators, (item) => item.obj.csv.metadata.name);
const groupAllItems = { ...groupedOperators, 'Non-Operators': nonOperators };
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add a hyphen in between when its a string?

Suggested change
const groupAllItems = { ...groupedOperators, 'Non-Operators': nonOperators };
const groupAllItems = { ...groupedOperators, 'Non Operators': nonOperators };

@@ -310,10 +329,13 @@ const determineAvailableFilters = (initialFilters, items, filterGroups) => {
return filters;
};

const getActiveFilters = (keywordFilter, groupFilters, activeFilters) => {
const getActiveFilters = (keywordFilter, groupByFilter, groupFilters, activeFilters) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, i see why you had to name it groupBy everywhere.

groupBy: 'groupBy',
};

export const groupByTypes = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not an enum?

(value, key) =>
value.length > 0 && (
<>
<div className="co-catalog-page__group-title">
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a standard header? h2 perhaps

className="catalog-tile-view-pf catalog-tile-view-pf-no-categories co-catalog-page__grid"
>
{_.map(value, (item) => (
<GalleryItem key={`gallery-${item.obj.metadata.uid}`}>
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 consistent with the other gallery item.
It's also duplicate code that should be extracted and reused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this part to renderGalleryItem and reusing it whereever required

</div>
<Gallery
gutter="sm"
className="catalog-tile-view-pf catalog-tile-view-pf-no-categories co-catalog-page__grid"
Copy link
Contributor

Choose a reason for hiding this comment

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

Gallery shouldn't have co-catalog-page__grid here.

) : (
<Gallery
gutter="sm"
className="catalog-tile-view-pf catalog-tile-view-pf-no-categories co-catalog-page__grid"
Copy link
Contributor

Choose a reason for hiding this comment

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

Move co-catalog-page__grid to a parent div so that this case and the grouping case use the same parent with this class.

Comment on lines 663 to 666
if (filterType === FilterType.keyword) {
updateURLParams(FilterType.keyword, `${value}`);
} else if (filterType === FilterType.groupBy) {
updateURLParams(FilterType.groupBy, `${value}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Grouping is not a filter and should be handled separately.

@@ -227,6 +235,17 @@ const filterByGroup = (items, filters) => {
);
};

export const filterByGroupByDropdown = (items, groupBy) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really a filter though. It's a sort or grouping. I'd remove filter from this.

Comment on lines 336 to 337
activeFilters.groupBy.value = groupByFilter || '';
activeFilters.groupBy.active = !!groupByFilter;
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. Group by does not actually filter anything, it only affects the visual appearance of the items.
This should not be mixed in with the filters on the page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@christianvogt Initially the ask was to display only the Installed Operators in groups. Later on when we decided to add the Non operators grouped together I should have updated the variable names which I missed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved it out of activeFilters

Comment on lines 352 to 354
} else if (filterType === FilterType.groupBy) {
_.set(activeFilters, 'groupBy.value', value);
_.set(activeFilters, 'groupBy.active', !!value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Grouping is not a filter.

export const FilterType = {
category: 'category',
keyword: 'keyword',
groupBy: 'groupBy',
Copy link
Contributor

Choose a reason for hiding this comment

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

Grouping should not be a filter.

@benjaminapetersen
Copy link
Contributor

benjaminapetersen commented Dec 18, 2019

/assign @christianvogt

I believe.
Also helpful to add a screenshot to your initial description, thx!

@debsmita1 debsmita1 force-pushed the group-by-operator branch 2 times, most recently from c0bb1d9 to a47ee18 Compare December 24, 2019 12:53
Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 27, 2019
@rohitkrai03
Copy link
Contributor

/assign @christianvogt

@debsmita1
Copy link
Contributor Author

/test e2e-gcp-console

@debsmita1
Copy link
Contributor Author

/test analyze

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

I think we should look to also convert these to Typescript, but I believe there is a dependency on other public files, so perhaps that's out of scope for this work.

const selectedCategoryId = categoryParam || 'all';

const groupBy = searchParams.get('groupBy') || 'None';
Copy link
Contributor

Choose a reason for hiding this comment

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

You use 'None' quite a few times, please make it a constant to avoid the magic string disconnect.

Comment on lines 794 to 800
<>
<Title className="co-catalog-page__group-title" headingLevel="h2" size="lg">
{key} ({_.size(value)})
</Title>
{this.renderItems(value, renderTile)}
<br />
</>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be better represented with css rather than a br. I think brs are old fashioned and we lose the fidelity to control the gap.

Also, you lack the key prop. Anytime you do map you need to use the key prop on returned JSX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • added key prop
  • removed
    and added a css class to handle the space between the groups

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 2, 2020
@@ -467,10 +468,12 @@ const defaultFilters = {
},
};

const none = 'None';
Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite what I meant :) For one, this will fail the linter as it's defined after its use... For two, this won't help using two different variables to match. You either need to use this exclusively... or use the enum we talked about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for that. Now using groupByTypes.None everywhere instead of 'None'

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

I don't see any issues with the OperatorHub around this change. Looks good in the Catalog too. Will probably need a UX look-over at some point too.

/assign @christianvogt

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 2, 2020
@andrewballantyne
Copy link
Contributor

/hold

e2e tests are still failing, no need for the bot to hammer after it fails.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2020
@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 2, 2020
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, christianvogt, debsmita1, rohitkrai03

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 2, 2020
@spadgett
Copy link
Member

spadgett commented Jan 2, 2020

/hold cancel
/retest
#3847 has fixed the e2e tests

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 17196ae into openshift:master Jan 3, 2020
@spadgett spadgett added this to the v4.4 milestone Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet