Skip to content

Commit

Permalink
Convert textualempty table to react
Browse files Browse the repository at this point in the history
  • Loading branch information
GilbertCherrie committed Oct 31, 2024
1 parent 11cae0f commit 2f3a474
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
6 changes: 3 additions & 3 deletions app/helpers/generic_object_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def textual_updated

def textual_group_attribute_details_list
if @record.property_attributes.count.zero?
TextualEmpty.new(_('Attributes'), _('No Attributes defined'))
TextualEmpty.new(_('Attributes'))
else
TextualMultilabel.new(
_('Attributes'),
Expand All @@ -33,7 +33,7 @@ def textual_group_attribute_details_list

def textual_group_associations
if @record.property_associations.count.zero?
TextualEmpty.new(_('Associations'), _('No Associations defined'))
TextualEmpty.new(_('Associations'))
else
TextualGroup.new(_("Associations"), associations)
end
Expand Down Expand Up @@ -62,7 +62,7 @@ def textual_group_methods
end

if methods.count.zero?
TextualEmpty.new(_('Methods'), _('No Methods defined'))
TextualEmpty.new(_('Methods'))
else
TextualGroup.new(_('Methods'), methods)
end
Expand Down
21 changes: 7 additions & 14 deletions app/javascript/components/textual_summary/empty_group.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import MiqStructuredList from '../miq-structured-list';

export default function EmptyGroup(props) {
const { title, text } = props;
const { title } = props;
return (
<table className="table table-bordered table-striped table-summary-screen">
<thead>
<tr>
<th>{title}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{text}</td>
</tr>
</tbody>
</table>
<MiqStructuredList
rows={[]}
title={title}
mode="generic_group"
/>
);
}

EmptyGroup.propTypes = {
title: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
};
6 changes: 3 additions & 3 deletions spec/helpers/generic_object_helper/textual_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
it "displays 'No Attributes defined' when Attributes do not exist" do
@record = FactoryBot.create(:generic_object, :generic_object_definition_id => @generic_obj_defn.id)

expected = TextualEmpty.new('Attributes', 'No Attributes defined')
expected = TextualEmpty.new('Attributes')

expect(textual_group_attribute_details_list).to eq(expected)
end
Expand All @@ -59,7 +59,7 @@
it "displays 'No Associations defined' when do not Associations exist" do
@record = FactoryBot.create(:generic_object, :generic_object_definition_id => @generic_obj_defn_with_no_properties.id)

expected = TextualEmpty.new('Associations', 'No Associations defined')
expected = TextualEmpty.new('Associations')

expect(textual_group_associations).to eq(expected)
end
Expand All @@ -75,7 +75,7 @@
it "displays 'No Methods defined' when do not Methods exist" do
@record = FactoryBot.create(:generic_object, :generic_object_definition_id => @generic_obj_defn_with_no_properties.id)

expected = TextualEmpty.new('Methods', 'No Methods defined')
expected = TextualEmpty.new('Methods')

expect(textual_group_methods).to eq(expected)
end
Expand Down

0 comments on commit 2f3a474

Please sign in to comment.