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

feat(invntory groups): added new group column behind feature flag #1772

Merged
merged 8 commits into from
Mar 3, 2023
Merged

feat(invntory groups): added new group column behind feature flag #1772

merged 8 commits into from
Mar 3, 2023

Conversation

Fewwy
Copy link
Contributor

@Fewwy Fewwy commented Feb 22, 2023

This pr is adding a Group column to the Inventory table
I had to create a new array of default columns and wrap it in the feature flag
image

@Fewwy Fewwy requested a review from a team as a code owner February 22, 2023 15:04
src/store/entities.js Outdated Show resolved Hide resolved
invConfig: {},
sortBy: {
key: 'updated',
direction: 'desc'
}
};

export const defaultColumns = () => ([
export const defaultColumns = (groupsEnabled = useFeatureFlag('hbi.ui.inventory-groups')) => [
Copy link
Contributor

Choose a reason for hiding this comment

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

I never saw such pattern and not sure it's a good way of calling hooks in the parameters disclosure. Can we just strictly send the boolean parameter with the default value to false?

Suggested change
export const defaultColumns = (groupsEnabled = useFeatureFlag('hbi.ui.inventory-groups')) => [
export const defaultColumns = (groupsEnabled = false) => [

Copy link
Contributor

Choose a reason for hiding this comment

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

And then in the component where you call defaultColumns, call the hook there and only then pass the parameter to this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's a better solution

@gkarat gkarat added the enhancement New feature or request label Mar 2, 2023
@RedHatInsights RedHatInsights deleted a comment from gkarat Mar 3, 2023
@Fewwy
Copy link
Contributor Author

Fewwy commented Mar 3, 2023

/retest

@@ -16,13 +18,13 @@ const useColumns = (columnsProp, disableDefaultColumns, showTags, columnsCounter
);
const disabledColumns = Array.isArray(disableDefaultColumns) ? disableDefaultColumns : [];
const defaultColumnsFiltered = useMemo(() => (disableDefaultColumns === true) ?
[] : defaultColumns().filter(({ key }) =>
[] : defaultColumns(groupsEnabled).filter(({ key }) =>
isColumnEnabled(key, disabledColumns, showTags)
), [disabledColumns, disableDefaultColumns, showTags]);
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add groupsEnabled to these deps array so that the value is updated when the flag changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: -0.97 ⚠️

Comparison is base (884609f) 68.60% compared to head (e44edda) 67.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1772      +/-   ##
==========================================
- Coverage   68.60%   67.63%   -0.97%     
==========================================
  Files         124      124              
  Lines        2758     2762       +4     
  Branches      912      915       +3     
==========================================
- Hits         1892     1868      -24     
- Misses        866      894      +28     
Impacted Files Coverage Δ
src/store/entities.js 33.33% <75.00%> (+1.23%) ⬆️
src/components/InventoryTable/hooks/useColumns.js 100.00% <100.00%> (ø)
src/api/api.js 45.78% <0.00%> (-18.08%) ⬇️
src/routes/InventoryTable.js 60.34% <0.00%> (-7.76%) ⬇️
src/components/InventoryTable/InventoryTable.js 94.73% <0.00%> (-5.27%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Fewwy
Copy link
Contributor Author

Fewwy commented Mar 3, 2023

/retest

Copy link
Contributor

@gkarat gkarat left a comment

Choose a reason for hiding this comment

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

good job

@gkarat gkarat merged commit 94db33f into RedHatInsights:master Mar 3, 2023
gkarat pushed a commit that referenced this pull request Mar 3, 2023
# [1.7.0](v1.6.0...v1.7.0) (2023-03-03)

### Features

* **Inventory table:** Add static groups column ([#1772](#1772)) ([94db33f](94db33f))
@gkarat
Copy link
Contributor

gkarat commented Mar 3, 2023

🎉 This PR is included in version 1.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@gkarat gkarat added the released label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants