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(topology filter): added filter for knative event sources #3774

Merged

Conversation

nemesis09
Copy link
Contributor

This PR adds functionality for topology filter option "event sources" under the "show" section
Jira issue - https://jira.coreos.com/browse/ODC-2458
this PR depends on #3746
screens
screen1
screen2

@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. component/dev-console Related to dev-console labels Dec 12, 2019
@@ -365,7 +365,9 @@ export const transformTopologyData = (

const knSvcResources: K8sResourceKind[] = _.get(resources, ['ksservices', 'data'], []);
knSvcResources.length && getKnativeTopologyData(knSvcResources, NodeType.KnService);
const knEventSources: K8sResourceKind[] = getKnativeEventSources();
const knEventSources: K8sResourceKind[] = filters.display.eventSources
Copy link
Contributor

Choose a reason for hiding this comment

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

you might want to write it like :

Suggested change
const knEventSources: K8sResourceKind[] = filters.display.eventSources
const knEventSources: K8sResourceKind[] = filters.display.eventSources && getKnativeEventSources();

Copy link
Contributor

Choose a reason for hiding this comment

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

I caution against this change. && is a sneaky beast in JavaScript. I am unsure if TypeScript properly catches this, but if your left-hand variable is falsey, you get that value. This isn't so much of a problem when rendering React as falsey usually means don't render it.

However if you do it with a JS statement, you can be getting unexpected values into your variable:

1 && 2
// 2
0 && 1
// 0
true && []
// []
false && []
// false
undefined && ['hello', 'world']
// undefined

Which can be confusing for your variable (in this case knEventSources). Especially if you want it to be an array.

Copy link
Contributor

@debsmita1 debsmita1 Dec 12, 2019

Choose a reason for hiding this comment

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

@andrewballantyne Thank you for this piece of information.
When I executed this PR locally (after pulling in #3746) it worked fine without an error so I went ahead and suggested the change. But I will make a note of the example you just shared

@vikram-raj
Copy link
Member

/retest

@vikram-raj
Copy link
Member

@nemesis09 All tests are failing. Can you please rebase your PR with the latest master.

@nemesis09
Copy link
Contributor Author

nemesis09 commented Dec 17, 2019

@nemesis09 All tests are failing. Can you please rebase your PR with the latest master.

@vikram-raj waiting for PR #3746 to get in.

@christianvogt
Copy link
Contributor

/hold

@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 Dec 17, 2019
@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
@andrewballantyne
Copy link
Contributor

/hold cancel
/retest

@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 3, 2020
@andrewballantyne
Copy link
Contributor

@nemesis09 looks like you failed unit tests. Please take a look when you get a chance.

/hold

@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 3, 2020
@andrewballantyne
Copy link
Contributor

/hold cancel
/retitle [WIP] feat(topology filter): added filter for knative event sources

Adding the WIP label to distinguish that this is not ready for reviews.

@nemesis09 Please see my previous message

@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 5, 2020
@openshift-ci-robot openshift-ci-robot changed the title feat(topology filter): added filter for knative event sources [WIP] feat(topology filter): added filter for knative event sources Jan 5, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 5, 2020
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 7, 2020
@nemesis09 nemesis09 changed the title [WIP] feat(topology filter): added filter for knative event sources feat(topology filter): added filter for knative event sources Jan 7, 2020
@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 Jan 7, 2020
@nemesis09
Copy link
Contributor Author

@nemesis09 looks like you failed unit tests. Please take a look when you get a chance.

/hold

I've added unit tests for the code change. PTAL

Comment on lines 295 to 304
const eventFilter: TopologyFilters = {
display: {
podCount: true,
eventSources: true,
knativeServices: true,
appGrouping: true,
operatorGrouping: true,
},
searchQuery: '',
};
Copy link
Contributor

Choose a reason for hiding this comment

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

declare it once either in beforeEach or out of describe block. and you should be importing this from redux/const.ts
and do something like this
const topologyFilters = {...DEFAULT_TOPOLOGY_FILTERS};
and change the topology filter in each test case as you need it.

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've added the changes. PTAL

@andrewballantyne
Copy link
Contributor

@christianvogt @jeff-phillips-18 This is a bit odd. When I toggle it on / off, the Knative snaps around a bit. Any ideas? I don't think this PR is at fault as it's just filtering.

Event Source snap

@openshift-bot
Copy link
Contributor

/retest

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

19 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@spadgett
Copy link
Member

/hold
due to a bug in CI

@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 10, 2020
@spadgett
Copy link
Member

/test e2e-gcp-console

@spadgett
Copy link
Member

/hold cancel

@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 10, 2020
@spadgett
Copy link
Member

/hold
let's make sure the test runs to completion

@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 10, 2020
@spadgett
Copy link
Member

/hold cancel
/retest

@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 11, 2020
@openshift-merge-robot openshift-merge-robot merged commit 1208567 into openshift:master Jan 11, 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/dev-console Related to dev-console kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet