1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

93 lines
2.3 KiB
React
Raw Normal View History

2017-05-16 13:34:00 +02:00
import {debounce} from 'underscore'
2017-05-16 13:34:00 +02:00
import React from 'react'
import {connect} from 'react-redux'
2018-09-16 20:07:35 +02:00
import {replace} from 'react-router-redux'
2017-05-16 13:34:00 +02:00
import PageHeader from 'components/page-header'
import Details from './details'
import Status from './status'
import SearchInput from 'components/search-input'
import Protocols from './protocols'
2018-09-09 19:19:47 +02:00
import QuickLinks from './protocols/quick-links'
2017-05-16 13:34:00 +02:00
2018-09-16 19:56:22 +02:00
import {setFilterValue} from './protocols/actions'
import {makeQueryLinkProps} from './protocols/routing'
2017-05-16 13:34:00 +02:00
class RouteserversPage extends React.Component {
constructor(props) {
super(props);
this.dispatchDebounced = debounce(this.props.dispatch, 350);
}
2017-05-16 13:34:00 +02:00
setFilter(value) {
// Set filter value (for input rendering)
2018-09-16 19:56:22 +02:00
this.props.dispatch(setFilterValue(value));
// Update location delayed
2018-09-16 20:07:35 +02:00
this.dispatchDebounced(replace(
2018-09-16 19:56:22 +02:00
makeQueryLinkProps(
this.props.routing,
value,
this.props.sortColumn,
this.props.sortOrder)));
}
2017-05-16 13:34:00 +02:00
render() {
return(
<div className="routeservers-page">
<PageHeader>
<Details routeserverId={this.props.params.routeserverId} />
</PageHeader>
<div className="row details-main">
2018-10-15 14:55:58 +02:00
<div className="col-main col-lg-9 col-md-12">
2017-05-16 13:34:00 +02:00
<div className="card">
<SearchInput
2018-09-16 19:56:22 +02:00
value={this.props.filterValue}
2017-05-16 13:34:00 +02:00
placeholder="Filter by Neighbour, ASN or Description"
onChange={(e) => this.setFilter(e.target.value)}
/>
</div>
2018-09-09 19:19:47 +02:00
<QuickLinks />
2017-05-16 13:34:00 +02:00
<Protocols protocol="bgp" routeserverId={this.props.params.routeserverId} />
</div>
2018-10-15 14:55:58 +02:00
<div className="col-lg-3 col-md-12 col-aside-details">
2017-05-16 13:34:00 +02:00
<div className="card">
2018-10-02 10:48:57 +02:00
<Status routeserverId={this.props.params.routeserverId}
cacheStatus={this.props.cacheStatus} />
2017-05-16 13:34:00 +02:00
</div>
</div>
</div>
</div>
);
}
}
export default connect(
(state) => {
return {
2018-09-16 19:56:22 +02:00
routing: state.routing.locationBeforeTransitions,
filterValue: state.neighbors.filterValue,
sortColumn: state.neighbors.sortColumn,
2018-10-02 10:48:57 +02:00
sortOrder: state.neighbors.sortOrder,
cacheStatus: {
generatedAt: state.neighbors.cachedAt,
ttl: state.neighbors.cacheTtl,
}
2017-05-16 13:34:00 +02:00
};
}
)(RouteserversPage);