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

[EuiInMemoryTable] pass items to BasicTable when message is provided #517

Merged
merged 3 commits into from
Mar 15, 2018
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `0.0.27`.
- `EuiInMemoryTable` pass items to BasicTable when message is provided ([#517](https://github.com/elastic/eui/pull/517)).

# [`0.0.27`](https://github.com/elastic/eui/tree/v0.0.27)

Expand Down
8 changes: 5 additions & 3 deletions src-docs/src/views/tables/in_memory/in_memory_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ const random = new Random();

const store = createDataStore();

const noItemsFoundMsg = 'No users match search criteria';

export class Table extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
users: [],
message: 'No users',
message: 'No users, click "Load Users" to load some',
selection: []
};
}
Expand All @@ -61,7 +63,7 @@ export class Table extends Component {
setTimeout(() => {
this.setState({
loading: false,
message: undefined,
message: noItemsFoundMsg,
error: undefined,
users: store.users
});
Expand All @@ -80,7 +82,7 @@ export class Table extends Component {
loading: false,
error: 'ouch!... again... ',
users: undefined,
message: undefined
message: noItemsFoundMsg
});
}, random.number({ min: 0, max: 3000 }));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`EuiInMemoryTable with items 1`] = `
/>
`;

exports[`EuiInMemoryTable with items and message - expecting to show the message and not the items 1`] = `
exports[`EuiInMemoryTable with items and message - expecting to show the items 1`] = `
<EuiBasicTable
columns={
Array [
Expand All @@ -60,7 +60,22 @@ exports[`EuiInMemoryTable with items and message - expecting to show the message
},
]
}
items={Array []}
items={
Array [
Object {
"id": "1",
"name": "name1",
},
Object {
"id": "2",
"name": "name2",
},
Object {
"id": "3",
"name": "name3",
},
]
}
noItemsMessage="show me!"
onChange={[Function]}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/basic_table/in_memory_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class EuiInMemoryTable extends Component {

const table = (
<EuiBasicTable
items={message ? [] : items} // If message is configured, we force showing it instead of the items
items={items}
columns={columns}
pagination={pagination}
sorting={sorting}
Expand Down
2 changes: 1 addition & 1 deletion src/components/basic_table/in_memory_table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('EuiInMemoryTable', () => {
expect(component).toMatchSnapshot();
});

test('with items and message - expecting to show the message and not the items', () => {
test('with items and message - expecting to show the items', () => {

const props = {
...requiredProps,
Expand Down