Skip to content
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

Convert textualempty table to react #9261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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