Skip to content

Commit

Permalink
fix(RHINENG-3653): Update Groups column default text (#296)
Browse files Browse the repository at this point in the history
* fix(RHINENG-3653): Update Groups column default text

* replace additional N/A Text
  • Loading branch information
adonispuente authored Dec 4, 2023
1 parent e378de7 commit 74aed92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Components/Reports/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const formatData = (data, type) => {
let rowValue;
if (rowKey === 'groups') {
rowValue = get(systemItem, rowKey, []);
rowValue = rowValue.length === 0 ? 'N/A' : rowValue[0].name;
rowValue = rowValue.length === 0 ? 'No group' : rowValue[0].name;

} else {
rowValue = get(systemItem, rowKey, '');
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Reports/Util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Util formatData method tests', () => {
it('should generate array of data in the format required to generate PDF', () => {
const expectedSystemsRowsData = [
['ip-172-31-28-69.ec2.internal', 'ros-for-OCP', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '29 Mar 2022 00:00 UTC'],
['ros-system.internal', 'N/A', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
['ros-system.internal', 'No group', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
];

const actualSystemsRowsData = formatData(sysResponseTestData, 'pdf');
Expand All @@ -93,7 +93,7 @@ describe('Util formatData method tests', () => {
it('should generate array of data (with 0%) in the format required to generate PDF', () => {
const expectedSystemsRowsData = [
['ip-172-31-28-69.ec2.internal', 'ros-for-OCP', 'RHEL 8.4', '0%', '0%', '0.314', '1', 'Undersized', '29 Mar 2022 00:00 UTC'],
['ros-system.internal', 'N/A', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
['ros-system.internal', 'No group', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
];

sysResponseTestData[0].performance_utilization.cpu = 0;
Expand All @@ -108,7 +108,7 @@ describe('Util formatData method tests', () => {
it('should generate array of data (handling null values) in the format required to generate PDF', () => {
const expectedSystemsRowsData = [
['ip-172-31-28-69.ec2.internal', 'ros-for-OCP', 'RHEL 8.4', 'N/A', 'N/A', '0.314', 'N/A', 'Undersized', '29 Mar 2022 00:00 UTC'],
['ros-system.internal', 'N/A', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
['ros-system.internal', 'No group', 'RHEL 8.4', '90%', '97%', '0.314', '1', 'Undersized', '30 Mar 2022 00:01 UTC']
];

sysResponseTestData[0].number_of_suggestions = null; /* eslint-disable-line camelcase */
Expand All @@ -125,7 +125,7 @@ describe('Util formatData method tests', () => {
describe('Util responseToCSVData test', () => {
it('should format the data into CSV format', () => {
// eslint-disable-next-line max-len
const expectedSystemsRowsData = `display_name,os,performance_utilization.cpu,performance_utilization.memory,performance_utilization.max_io,number_of_suggestions,state,cloud_provider,instance_type,idling_time,report_date,groups\r\nip-172-31-28-69.ec2.internal,RHEL 8.4,90%,97%,0.314,1,Undersized,aws,t2.micro,19.70%,29 Mar 2022 00:00 UTC,ros-for-OCP\r\nros-system.internal,RHEL 8.4,90%,97%,0.314,1,Undersized,aws,t2.micro,19.70%,30 Mar 2022 00:01 UTC,N/A`;
const expectedSystemsRowsData = `display_name,os,performance_utilization.cpu,performance_utilization.memory,performance_utilization.max_io,number_of_suggestions,state,cloud_provider,instance_type,idling_time,report_date,groups\r\nip-172-31-28-69.ec2.internal,RHEL 8.4,90%,97%,0.314,1,Undersized,aws,t2.micro,19.70%,29 Mar 2022 00:00 UTC,ros-for-OCP\r\nros-system.internal,RHEL 8.4,90%,97%,0.314,1,Undersized,aws,t2.micro,19.70%,30 Mar 2022 00:01 UTC,No group`;

sysResponseTestData[0].number_of_suggestions = 1; /* eslint-disable-line camelcase */
sysResponseTestData[0].performance_utilization.cpu = 90;
Expand Down
2 changes: 1 addition & 1 deletion src/Components/RosTable/RenderColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const displayLastReported = (data) => {
export const displayGroup = (data) => {
return (
data.length === 0 ?
<span>{ NO_DATA_VALUE }</span> :
<span className="pf-v5-u-disabled-color-200">No group</span> :
<span>{ data[0].name }</span>
);
};

0 comments on commit 74aed92

Please sign in to comment.