diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js index 5c2cb6959b9..4d32077d566 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js @@ -20,6 +20,7 @@ import PropTypes from 'prop-types'; import React, {Component} from 'react'; import DataTableRow from './DataTableRow'; import DataTableHeader from './DataTableHeader'; +import RaisedButton from 'material-ui/RaisedButton'; import {Table, TableBody, TableHeader, TableRow} from 'material-ui/Table'; /** @@ -73,7 +74,14 @@ class DataTable extends Component { render() { const {data, headers} = this.state; - if (data.length > 0) { + + let noDataContent = null; + + if (this.props.noDataMessage.type === 'button') { + noDataContent =
+ } + + if (data) { return ( {data.map((dataItem) =>{ - return () + return () })} -
)} + ) + } - return (
No apps
); + return (
{noDataContent}
); } } @@ -101,7 +112,8 @@ DataTable.prototypes = { data: PropTypes.arrayOf(Object), headers: PropTypes.arrayOf(Object), sortData: PropTypes.func, - handleRowClick: PropTypes.func + handleRowClick: PropTypes.func, + noDataMessage: PropTypes.object }; export default DataTable; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.js index a8df991091b..fc6f638034d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.js @@ -37,6 +37,9 @@ class DataTableRow extends Component { this.setState({dataItem: this.props.dataItem}) } + /** + * Triggers the click event on the data table row. + * */ _handleClick() { this.props.handleClick(this.state.dataItem.id); } @@ -47,7 +50,8 @@ class DataTableRow extends Component { {Object.keys(dataItem).map((key) => { if (key !== 'id') { - return {dataItem[key]} + return {dataItem[key]} } else { return }