-
Notifications
You must be signed in to change notification settings - Fork 22
NETOBSERV-1959: Remove hardcoded columns rendering + other enhancements #633
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
Conversation
@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
1 similar comment
@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
6b7b546
to
23bba4c
Compare
const getConfig = () => { | ||
const file = fs.readFileSync('../config/sample-config.yaml', 'utf8'); | ||
const config = parse(file); | ||
const columnsConfig: ColumnConfigDef[] = config.frontend.columns; | ||
const fields: FieldConfig[] = config.frontend.fields; | ||
return { columnsConfig, fields }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have some config sample with columns / fields in https://github.com/netobserv/network-observability-console-plugin/blob/main/web/src/components/__tests-data__/config.ts
I guess it would be better to reuse these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<ResourceIcon kind={kind} /> | ||
<Text component={TextVariants.p} className="co-resource-item__resource-name" data-test-id={value}> | ||
{value} | ||
{value} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a padding or marging using a new classname instead
<div data-test={`field-resource-${kind}.${ns}.${value}`} className="force-truncate"> | ||
{resourceIconText(value, kind, ns)} | ||
<TextContent className="record-field-tooltip netobserv-no-child-margin"> | ||
{/* Note: THIS IS THE TOOLTIP */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not clear here, you can create a kubeObjTooltip
function returning the whole TextContent
element. I would avoid having brackets for this comment
return !forbiddenColumns.includes(c.id) && value !== null && value !== '' && !Number.isNaN(value); | ||
return ( | ||
!forbiddenColumns.includes(c.id) && | ||
value !== undefined && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was on purepose to keep undefined
values here.
The goal was having null
to skip a column display when misconfigured and undefined when the data is missing from the record which will result in empty text display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I missed this subtelty and it's probably why I have some tests failing.
I'd like somehow to make this more obvious ... but not sure how
web/src/utils/column-parser.ts
Outdated
const obj: KubeObj = { | ||
kind: String(getColumnOrRecordValue(columns, record, args[0], '')), | ||
namespace: String(getColumnOrRecordValue(columns, record, args[1], '')), | ||
name: String(getColumnOrRecordValue(columns, record, args[2], '')), | ||
showNamespace: args[3] === '1' | ||
}; | ||
if (!obj.name || !obj.kind) { | ||
return undefined; | ||
} | ||
// Remove empty namespace | ||
if (obj.namespace === '') { | ||
delete obj.namespace; | ||
} | ||
return obj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would feel easier to read building the KubeObj at return statement:
const obj: KubeObj = { | |
kind: String(getColumnOrRecordValue(columns, record, args[0], '')), | |
namespace: String(getColumnOrRecordValue(columns, record, args[1], '')), | |
name: String(getColumnOrRecordValue(columns, record, args[2], '')), | |
showNamespace: args[3] === '1' | |
}; | |
if (!obj.name || !obj.kind) { | |
return undefined; | |
} | |
// Remove empty namespace | |
if (obj.namespace === '') { | |
delete obj.namespace; | |
} | |
return obj; | |
const kind = String(getColumnOrRecordValue(columns, record, args[0], '')); | |
const namespace = String(getColumnOrRecordValue(columns, record, args[1], '')); | |
const name = String(getColumnOrRecordValue(columns, record, args[2], '')); | |
const showNamespace = args[3] === '1' | |
}; | |
if (!name || !kind) { | |
return undefined; | |
} else if (namespace === '') { | |
return { kind, name }; | |
} | |
return { kind, namespace, name, showNamespace }; |
export interface KubeObj { | ||
name: string; | ||
kind: string; | ||
namespace?: string; | ||
showNamespace: boolean; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
following kubeObject parser suggestion:
export interface KubeObj { | |
name: string; | |
kind: string; | |
namespace?: string; | |
showNamespace: boolean; | |
} | |
export interface KubeObj { | |
name: string; | |
kind: string; | |
namespace?: string; | |
showNamespace?: boolean; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did (almost) what you suggested but kept showNamespace strict boolean
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #633 +/- ##
==========================================
+ Coverage 55.75% 56.54% +0.78%
==========================================
Files 195 196 +1
Lines 10065 10063 -2
Branches 1200 1195 -5
==========================================
+ Hits 5612 5690 +78
+ Misses 4084 4008 -76
+ Partials 369 365 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@jotak: This pull request references NETOBSERV-1959 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
- Remove hardcoded columns - Change some of the rendering scripted functions: - getConcatenatedValue -> concat now dedicated to just concatenate values - they can now accept litterals (e.g. concat(DstAddr,':',DstPort)) - remove getSrcOrDstValue since there was also "[...]" for the same role - add new kubeObject func to show kind-name-namespace sort of things - Improve performance by avoiding re-parsing everything for every rendered flow - there's probably more that we could do on that side - Add unit tests
Previously, visible fields were determined out of several criteria including: - fields with calculated values were filtered out - record with null value was filtered out (as opposed to undefined) Also, "Common" columns was determined by having a calculated value (ie. non-common columns were prohibited to use calculated) This must change since columns can now have calculated and still must be visible (e.g. SrcK8S_Name is a kubeObject calculated value) - So, Common now is when calculated in the form of "[a,b]" - Visible columns for side panel is now based on being tied to fields
Those fields should be correctly displayed when ICMP data is present, and not displayed (in side panel) when ICMP data is absent.
New changes are detected. LGTM label has been removed. |
Description
Dependencies
operator: netobserv/network-observability-operator#835
Checklist
If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.