Skip to content

Commit

Permalink
Merge pull request #9199 from GilbertCherrie/fix_surveys_table
Browse files Browse the repository at this point in the history
Fix survey table readability
  • Loading branch information
jeffibm authored Jun 4, 2024
2 parents 486e88a + b49c63c commit 73a5ebc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/helpers/configuration_script_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def textual_group_surveys
TextualTable.new(
_("Surveys"),
items,
headers
headers,
'survey-table'
)
end

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/textual_table.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TextualTable = Struct.new(:title, :rows, :labels) do
TextualTable = Struct.new(:title, :rows, :labels, :className) do
def locals
{:title => title, :rows => rows, :labels => labels, :component => 'SimpleTable'}
{:title => title, :rows => rows, :labels => labels, :component => 'SimpleTable', :className => className}
end
end
4 changes: 2 additions & 2 deletions app/javascript/components/miq-structured-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { hasClickEvents } from './helpers';

/** Component to render the items in summary pages */
const MiqStructuredList = ({
title, headers, rows, mode, onClick, message,
title, headers, rows, mode, onClick, message, className = '',
}) => {
const clickEvents = hasClickEvents(mode);

Expand All @@ -35,7 +35,7 @@ const MiqStructuredList = ({
};

const accordionList = () => (
<Accordion align="start" className={classNames('miq-structured-list-accordion', mode)}>
<Accordion align="start" className={classNames('miq-structured-list-accordion', mode, className)}>
<AccordionItem title={title} open>
{simpleList()}
</AccordionItem>
Expand Down
7 changes: 6 additions & 1 deletion app/javascript/components/textual_summary/simple_table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import PropTypes from 'prop-types';
import MiqStructuredList from '../miq-structured-list';

export default function SimpleTable(props) {
const { rows, labels, title } = props;
const {
rows, labels, title, className,
} = props;

return (
<MiqStructuredList
className={className}
headers={labels}
rows={rows}
title={title}
Expand All @@ -25,9 +28,11 @@ SimpleTable.propTypes = {
])),
rows: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.any)),
onClick: PropTypes.func.isRequired,
className: PropTypes.string,
};

SimpleTable.defaultProps = {
rows: [],
labels: '',
className: undefined,
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const renderComponent = (props) => {
case 'SimpleTable':
return (
<SimpleTable
className={group.className}
labels={group.labels}
rows={group.rows}
title={group.title}
Expand Down
14 changes: 14 additions & 0 deletions app/stylesheet/miq-structured-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,17 @@
}
}
}

.templates-summary-page {
.col-lg-6 {
width: 100%;
}

.miq-structured-list-accordion {
width: 50%;
}

.survey-table {
width: 100%;
}
}
3 changes: 2 additions & 1 deletion app/views/configuration_script/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
= render :partial => "layouts/flash_msg"
= render :partial => "layouts/textual_groups_generic"
.templates-summary-page
= render :partial => "layouts/textual_groups_generic"

0 comments on commit 73a5ebc

Please sign in to comment.