-
Notifications
You must be signed in to change notification settings - Fork 186
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
Replace empty registry value name in FIM inventory #3279
Replace empty registry value name in FIM inventory #3279
Conversation
All the tables in the Integrity monitoring section that show an empty field now display a label with an icon noting them as empty, to help distinguish them from whitespace strings and to improve the look.
9616105
to
3803ee9
Compare
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.
Just some conventions to apply. Great Job!
/* | ||
* Wazuh app - Integrity monitoring components | ||
* Copyright (C) 2015-2021 Wazuh, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Find more information about this on the LICENSE file. | ||
*/ | ||
|
||
import { EuiCode, EuiIcon } from '@elastic/eui' | ||
import React from 'react' | ||
|
||
/* This function can be used to render possibly empty fields. | ||
It takes a render function suitable for an EuiTable and returns another. */ | ||
export const emptyFieldHandler = (renderFn = (value,record) => value) => { | ||
return (value, record) => { | ||
if (value === "" || value === undefined) { | ||
return ( | ||
<> | ||
<EuiIcon type="iInCircle"/> | ||
<EuiCode> | ||
Empty field | ||
</EuiCode> | ||
</> | ||
) | ||
} else { | ||
return renderFn(value,record); | ||
} | ||
} | ||
} |
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.
- The name of this file should be with kebab-case:
empty-field-handler.js
(if possible we have legacy files with camel case) - We use 2 spaces on code style. Maybe you are not using
prettier
on your IDE.
@@ -15,6 +15,7 @@ import { WzRequest } from '../../../../../react-services'; | |||
import React, { useEffect, useState } from 'react'; | |||
import valuesMock from './values.json'; | |||
import { DIRECTIONS } from '@elastic/eui/src/components/flex/flex_group'; | |||
import { emptyFieldHandler } from '../lib' |
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.
Semicolon ;
}), | ||
'syscheck.value_name': (content, rowData, element, options) => { | ||
if (content) return; | ||
const container = document.createElement("tr"); |
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.
It was meant to be a td
element to match the rest of the cells in the table. Fixed in 97821ec
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.
Cell in the table should be contained by a "td" tag not a "tr"
}), | ||
'syscheck.value_name': (content, rowData, element, options) => { | ||
if (content) return; | ||
const container = document.createElement("td"); |
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.
Maybe a div
or span
instead of an HTML related to a table. The td
/tr
elements are set by the table itself.
I need to redo the test to verify 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.
Just checked and you were right, replaced the element with a span
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.
CR: ✔️
Testing: ✔️ it works fine but as @Desvelao commented when you reduce the window the cell looks a little strange.
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.
CR: small improvements
}, | ||
{ | ||
field: 'value', | ||
name: 'Value name', | ||
sortable: true, | ||
render: (item) => item.name, | ||
render: emptyFieldHandler((item) => item.name), |
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.
remove please emptyFieldHandler
from all but this.
we'll only notify this field when is empty.
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.
addressed in 3b07cd1
…ped values and not the root object.
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.
Test: ✔️
CR: ✔️
LGTM! Great job 🎉
Closes #3220
Presented empty fields with a notice
Added a function that returns a render method compatible with EuiColumn objects that, if the object is either an empty string or undefined, shows a label stating as such (for now only in Value Name on Registry details).
Also replicated the same functionality for the
syscheck.value_name
in the FIM Discovery dashboard to address the situation in the issue #3220Testing
Create a enviroment with at least 1 windows agent with
syscheck
enabledpublic/kibana-integrations/discover/application/components/table/table.tsx
withvalue={""}
will empty all the information displayed in all the extended rows of FIM discovery, checking thesyscheck.value_name
field should show the label.Screenshots