-
Notifications
You must be signed in to change notification settings - Fork 19
React components for ManageIQ textual summary #14
Conversation
| "dependencies": { | ||
| "lodash": "^4.17.4", | ||
| "patternfly-react": "^1.8.0", | ||
| "patternfly-react": "^1.16.4", |
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.
might make sense to bump to 2.x as it already introduced api changes (for something we dont use yet - but can't see the value of using an older version now).
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.
I need this compatible with ui-classic. The goal is to replace TextualSummaries in ui-classic. UI-classic is on 1.X.
| title: 'Operation Ranges', | ||
| items: [ | ||
| { | ||
| label: 'CPU', |
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.
should these strings be extracted? or are they used as props somewhere else?
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.
This is test data. It is used in stories and tests.
|
|
||
| export default function EmptyGroup(props) { | ||
| return ( | ||
| <table className="table table-bordered table-striped table-summary-screen"> |
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.
I can do it, but not in the first implementation. My goal in this PR is to create React components from HAML files.
|
my main concern is that it things that are kept for next version are often
skipped, also even if you are not using the pf table implementation, I do
think you need a table component instead of using html.
…On Thu, May 3, 2018 at 11:51 AM, Martin Povolny ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/textual_summary/empty_group.jsx
<#14 (comment)>
:
> @@ -0,0 +1,24 @@
+import * as React from 'react';
+import PropTypes from 'prop-types';
+
+export default function EmptyGroup(props) {
+ return (
+ <table className="table table-bordered table-striped table-summary-screen">
I can do it, but not in the first implementation. My goal in this PR is to
create React components from HAML files.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABOx30q8aNfEGmbkhNbwChsNpLBqlPWks5tusUUgaJpZM4Twnxu>
.
|
|
|
This pull request is not mergeable. Please rebase and repush. |
| import TableListView from './table_list_view'; | ||
| import EmptyGroup from './empty_group'; | ||
|
|
||
| const renderComponent = (props) => { |
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 rewriting this to hash might be better than using switch
const componentMapper = {
GenericGroup: props => (
<GenericGroup onClick={props.onClick} items={props.group.items} title={props.group.title} />
),
TagGroup: props => <TagGroup items={props.group.items} title={props.group.title} />,
SimpleTable: props => (
<SimpleTable
labels={props.group.labels}
rows={props.group.rows}
title={props.group.title}
/>
),
OperationRanges: props => <OperationRanges items={props.group.items} title={props.group.title} />,
MultilinkTable: props => (
<MultilinkTable
onClick={props.onClick}
items={props.group.items}
title={props.group.title}
/>
),
TableListView: props => (
<TableListView
rowLabel={props.group.rowLabel}
onClick={props.onClick}
title={props.group.title}
headers={props.group.headers}
values={props.group.values}
colOrder={props.group.colOrder}
/>
),
EmptyGroup: props => <EmptyGroup title={props.group.title} text={props.group.text} />
};That way you can specify which component is using which propTypes
componentMapper.GenericGroup.propTypes = {
group: PropTypes.shape({
title: PropTypes.string.isRequired,
items: PropTypes.any,
}).isRequired,
onClick: PropTypes.func.isRequired,
};
componentMapper.TagGroup.propTypes = {
group: PropTypes.shape({
title: PropTypes.string.isRequired,
items: PropTypes.any,
}).isRequired,
};Or use spread operator and inherit these properties.
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 rewriting this to hash might be better than using switch
If you mean a simple hash, that it would not work, because a hash is not lazy evaluated. All the branches would get called and then the apropriate result would be selected. So that approach would crash on the propTypes mismatch (different case branches need diffferent properties).
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.
Oh, you mean a hash of functions. Then yes, it would work but is a hash of functions actually better than what I have now?
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.
Anyway. If it's a 'maybe changing it will look better' then I am not changing it unless you insist. I see the difference as marginal.
1daee3c to
2b22d5f
Compare
|
Checked commits martinpovolny/react-ui-components@a143eb5~...2b22d5f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
This is a continuation of ManageIQ/manageiq-ui-classic#3420