-
Notifications
You must be signed in to change notification settings - Fork 22
NETOBSERV-2056 manage field types & formats from config #681
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
Skipping CI for Draft Pull Request. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #681 +/- ##
==========================================
+ Coverage 56.83% 59.22% +2.39%
==========================================
Files 197 159 -38
Lines 10154 6919 -3235
Branches 1192 1192
==========================================
- Hits 5771 4098 -1673
+ Misses 4015 2620 -1395
+ Partials 368 201 -167
Flags with carried forward coverage won't be shown. Click here to find out more. |
8761eee
to
3d66d39
Compare
/retest |
config/sample-config.yaml
Outdated
- 2: Inner (with the same source and destination node) | ||
- name: IfDirections | ||
type: number | ||
type: number array |
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.
in another PR ( https://github.com/netobserv/network-observability-operator/pull/999/files#diff-1fc45b6b65862012ab2d4a19e8f92ce31c1801f0ed7c464c13ac3f0dc5a3b756R1268 - which you can review btw ;-) ), I'm doing the same kind of thing, except I use a new field name to avoid breaking something in the console. So, I guess it means I can rollback that part.
Just, I used the brackets convention to describe an array, like number[]
; wdyt, I'd say it's sufficiently known convention so we can use it?
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 can change the array
keyword to []
indeed 👌
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.
an advantage of []
is that it takes less space here https://docs.openshift.com/container-platform/4.17/observability/network_observability/json-flows-format-reference.html
On my screen, the table isn't displayed full-width (also because of the TOC column) - IMO it could be better to keep it small
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.
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.
web/src/utils/fields.ts
Outdated
@@ -1,8 +1,11 @@ | |||
export type FieldType = 'string' | 'number'; | |||
export type FieldType = 'string' | 'string array' | 'number' | 'number array'; |
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.
isn't it going to break something in the forceType
function? This was the concern I had in netobserv/network-observability-operator#999 and the reason why I introduced docType
instead ...
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.
(actually, reading the code again, maybe it was because I used object[]
for net events that I had to introduce docType
)
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.
forceType
is skipping arrays so it should be good for now:
network-observability-console-plugin/web/src/utils/column-parser.ts
Lines 86 to 91 in 8fb9a44
const forceType = (id: ColumnsId, value: ColValue, type?: FieldType): ColValue => { | |
if (!type) { | |
console.error('Column ' + id + " doesn't specify type"); | |
} | |
// check if value type match and convert it if needed | |
if (value && value !== '' && typeof value !== type && !Array.isArray(value)) { |
We may improve it if needed. We could force arrays too 🤔
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.
/lgtm
I will update the mocks in a followup since I need a cluster with fresh data |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: 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 |
@jpinsonneau: The following tests failed, say
Full PR test history. Your PR dashboard. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Merging this as the field test is now passing.
|
Description
Add array type and format to field configs.
Dependencies
netobserv/network-observability-operator#999
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.