-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,8 +1,11 @@ | ||||||||||||||
export type FieldType = 'string' | 'number'; | ||||||||||||||
export type FieldType = 'string' | 'string array' | 'number' | 'number array'; | ||||||||||||||
|
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.
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 👌Uh oh!
There was an error while loading. Please reload this page.
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.htmlOn 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.
although in the API reference

it's "array (string)", so yet something else. Honestly, I don't care too much :-) It's just that
string[]
felt more natural to me, of course I have my developer biasThere 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.
93b52dd