Skip to content

ROX-10987: Splitting Components into Node and Image Components#2163

Merged
sachaudh merged 7 commits intomasterfrom
ROX-10987
Jun 30, 2022
Merged

ROX-10987: Splitting Components into Node and Image Components#2163
sachaudh merged 7 commits intomasterfrom
ROX-10987

Conversation

@sachaudh
Copy link
Contributor

@sachaudh sachaudh commented Jun 23, 2022

Description

  • Added two new entity types: IMAGE_COMPONENT and NODE_COMPONENT
  • It's difficult to feature flag the entityRelationships.ts because that module doesn't live within the React lifecycle so I'm open to suggestions on how to go about feature flagging it. For now, I commented out the changes so the entity relationships won't be updated right now

Checklist

  • Investigated and inspected CI test results
  • Unit test and regression tests added
  • Evaluated and added CHANGELOG entry if required
  • Determined and documented upgrade steps
  • Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)

If any of these don't apply, please comment below.

Testing Performed

Screen Shot 2022-06-24 at 4 28 44 PM

Screen Shot 2022-06-24 at 4 29 02 PM

Screen Shot 2022-06-24 at 4 29 20 PM

Screen Shot 2022-06-24 at 4 29 30 PM

@openshift-ci
Copy link

openshift-ci bot commented Jun 23, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ghost
Copy link

ghost commented Jun 23, 2022

Tag for build #723355 is 3.70.x-545-gd4e86e6221.

💻 For deploying this image using the dev scripts, run the following first:

export MAIN_IMAGE_TAG='3.70.x-545-gd4e86e6221'

🕹️ A roxctl binary can be downloaded from the CircleCI artifacts.

@sachaudh sachaudh changed the base branch from master to saif/vm-updates-feature-flag June 24, 2022 23:10
entityMenuTypes = [...baseEntityMenuTypes, ...splitComponentMenuTypes];
} else {
entityMenuTypes = [...baseEntityMenuTypes, ...componentMenuType];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feature flagged the entities we show in the VM dashboard menu dropdown

Screen Shot 2022-06-24 at 4 11 36 PM

Screen Shot 2022-06-24 at 4 11 53 PM


export function getCurriedImageTableColumns(watchedImagesTrigger) {
export function getCurriedImageTableColumns(watchedImagesTrigger, isFeatureFlagEnabled) {
const isFrontendVMUpdatesEnabled = isFeatureFlagEnabled('ROX_FRONTEND_VM_UDPATES');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feature flagging the count link for components

},
[entityTypes.NODE]: {
// @TODO: Uncomment this once we're using the new entity
// children: [entityTypes.NODE_COMPONENT],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open to suggestions on how to feature flag the following in entityRelationships. Since it's a separate module and outside the React lifecycle, I can't use the feature flag hook here

Copy link
Contributor

Choose a reason for hiding this comment

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

As long as we feature flag the links, it may not be worth feature-flagging the direct "sub-routes" built from this map. (Re-factoring this map everywhere it is used would be a risky change.)

@sachaudh sachaudh requested a review from vjwilson June 24, 2022 23:19
@sachaudh sachaudh force-pushed the ROX-10987 branch 2 times, most recently from ce55387 to ce1d820 Compare June 24, 2022 23:25
@sachaudh sachaudh force-pushed the saif/vm-updates-feature-flag branch from 6cddd70 to efdce6e Compare June 27, 2022 19:03
@sachaudh sachaudh marked this pull request as ready for review June 27, 2022 19:05
@sachaudh sachaudh force-pushed the saif/vm-updates-feature-flag branch from efdce6e to 48f536d Compare June 27, 2022 22:33
@sachaudh sachaudh requested a review from a team June 27, 2022 22:33
Base automatically changed from saif/vm-updates-feature-flag to master June 28, 2022 18:08
@ghost
Copy link

ghost commented Jun 28, 2022

Images are ready for the commit at d4e86e6.

To use with deploy scripts, first export MAIN_IMAGE_TAG=3.70.x-546-g4aaee764e0.

Copy link
Contributor

@vjwilson vjwilson left a comment

Choose a reason for hiding this comment

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

A good foundation.
A couple of places I think we should revisit as we integrate the split CVE types, and one stylistic suggestion for tile sidebar width.

Regardless, let's merge once tests pass.

const currentEntity = { [currentEntityType]: id };
const newEntityContext = { ...entityContext, ...currentEntity };

const entityGridContainerClassName = `${entityGridContainerBaseClassName} grid-columns-1 md:grid-columns-2 lg:grid-columns-2`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you switch to the other exported class and re-concatenate?

Copy link
Contributor Author

@sachaudh sachaudh Jun 30, 2022

Choose a reason for hiding this comment

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

So this is the before and after of this change

Before:
Screen Shot 2022-06-29 at 10 59 12 PM

After:
Screen Shot 2022-06-29 at 10 59 15 PM

I noticed that we were only showing two columns in the component overview so it differed from the class we were using in general, which was for 3 columns. So this change will instead use the base class and then append specific classes for this view

Copy link
Contributor

Choose a reason for hiding this comment

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

^ That's probably a side-effect of widening the tiles right sidebar.

I'm fine with your fix for it, but I'm afraid this may turn into whack-a-mole. Let's get UX suggestion on this. cc: @alanonthegit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh no, that wasn't the issue. We're using grid columns for the overview and it was using a 3 column grid before. If you look at the first image you'll see it looks like you can add another third element to the right. It was on master as well. It's not really related to splitting the components but I just did it anyway.

return (
<div
className={` h-full relative border-base-100 border-l w-32 ${
className={` h-full relative border-base-100 border-l w-43 ${
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than making the right tile bar wider, would it be better to make long entity names wrap to two lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, yea that's true. This probably wasn't the best solution. I could do two things:

  1. Remove the width restriction and add a max-width and wrapping
  2. Keep the width restriction and just add wrapping

I'll try #2 which is what you're suggesting.

Copy link
Contributor Author

@sachaudh sachaudh Jun 30, 2022

Choose a reason for hiding this comment

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

Seems like text wrapping does look a bit odd (at least to me)

Screen Shot 2022-06-29 at 11 25 40 PM

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 ended up doing #1 instead. So I'll remove the w-32, add max-w-43, and add a text wrap class in case the text might be longer than that

Screen Shot 2022-06-29 at 11 28 57 PM

Screen Shot 2022-06-29 at 11 29 01 PM

Screen Shot 2022-06-29 at 11 29 37 PM

let queryVulnCounterFieldName = 'vulnCounter';
let queryVulnsFieldName = 'vulns';
let queryCVEFieldsName = 'cveFields';
let queryFragment = VULN_CVE_LIST_FRAGMENT;
Copy link
Contributor

Choose a reason for hiding this comment

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

I was also experimenting with this file, because we will have to show all three kinds of fixable CVEs on the Cluster Overview, and choose the correct type for the other entities. We probably should have broken this down across both of these features.

For now, I'll pause my branch, until we get this version merged in, and then expand on this approach.

Comment on lines +189 to +198
const VulnMgmtNodeComponents = ({ selectedRowId, search, sort, page, data, totalResults }) => {
const query = gql`
query getComponents($query: String, $pagination: Pagination) {
results: nodeComponents(query: $query, pagination: $pagination) {
...nodeComponentFields
}
count: nodeComponentCount(query: $query)
}
${VULN_NODE_COMPONENT_LIST_FRAGMENT}
`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it is worth doing 2 different sets of files at this "container" level. We should compare the complexity of the single CVE list file with conditionals for the three new types of CVEs, and decide which way is better. Then we made them consistent one way or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can try to leave this as-is for now, and come back tomorrow and make refactors so it's more consistent with your changes


export const IMAGE_CVE_LIST_FRAGMENT = gql`
fragment cveFields on ImageVulnerability {
fragment imageCVEFields on ImageVulnerability {
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 we need to use this new name in the file ui/apps/platform/src/Containers/VulnMgmt/List/Cves/VulnMgmtListCves.js above, at line 321.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, good catch

},
[entityTypes.NODE]: {
// @TODO: Uncomment this once we're using the new entity
// children: [entityTypes.NODE_COMPONENT],
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as we feature flag the links, it may not be worth feature-flagging the direct "sub-routes" built from this map. (Re-factoring this map everywhere it is used would be a risky change.)

@sachaudh
Copy link
Contributor Author

@vjwilson I think the failed ui-unit-tests aren't related to this PR. Maybe @dvail you can let me know in case it is, since that component might be related to your recent changes

@dvail
Copy link
Contributor

dvail commented Jun 30, 2022

@sachaudh You're right, this is related to my stuff on not this PR. Investigating why this passed on my PR branch and not master now... :/

@sachaudh sachaudh enabled auto-merge (squash) June 30, 2022 17:56
@sachaudh sachaudh disabled auto-merge June 30, 2022 17:56
@sachaudh
Copy link
Contributor Author

@sachaudh You're right, this is related to my stuff on not this PR. Investigating why this passed on my PR branch and not master now... :/

Ah, yea let me know. I don't think I can push my changes in until it's fixed. I'll try re-running

@sachaudh sachaudh merged commit bf1e5e5 into master Jun 30, 2022
@sachaudh sachaudh deleted the ROX-10987 branch June 30, 2022 18:56
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.

3 participants