mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
61 lines
1.0 KiB
JavaScript
61 lines
1.0 KiB
JavaScript
|
|
/**
|
|
* Routeservers List component
|
|
*/
|
|
|
|
|
|
import React from 'react'
|
|
import { connect } from 'react-redux'
|
|
|
|
import{ push } from 'react-router-redux'
|
|
|
|
import { loadRouteservers } from 'components/routeservers/actions'
|
|
|
|
// Components
|
|
import Status from './status'
|
|
|
|
|
|
class RouteserversList extends React.Component {
|
|
|
|
componentDidMount() {
|
|
this.props.dispatch(
|
|
loadRouteservers()
|
|
);
|
|
}
|
|
|
|
showRouteserver(id) {
|
|
this.props.dispatch(
|
|
push(`/routeservers/${id}`)
|
|
);
|
|
}
|
|
|
|
render() {
|
|
let routeservers = this.props.routeservers.map((rs) =>
|
|
<li key={rs.id} onClick={() => this.showRouteserver(rs.id)}>
|
|
<span className="routeserver-id">{rs.name}</span>
|
|
<Status routeserverId={rs.id} />
|
|
</li>
|
|
);
|
|
|
|
return (
|
|
<div className="routeservers-list">
|
|
<h2>Routeservers</h2>
|
|
<ul>
|
|
{routeservers}
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
export default connect(
|
|
(state) => {
|
|
return {
|
|
routeservers: state.routeservers.all
|
|
};
|
|
}
|
|
)(RouteserversList);
|
|
|
|
|