Remove all reference to KubernetesDashboard

pull/1344/head
Andrew Watkins 2017-04-27 10:44:19 -07:00
parent 788be8a3dc
commit 2d62082fe1
7 changed files with 3 additions and 197 deletions

View File

@ -32,11 +32,8 @@ const DashboardHeader = ({
<ul className="dropdown-menu" aria-labelledby="dropdownMenu1"> <ul className="dropdown-menu" aria-labelledby="dropdownMenu1">
{children} {children}
</ul> </ul>
</div> </div>}
} {headerText}
{headerText &&
<h1>Kubernetes Dashboard</h1>
}
</div> </div>
<div className="page-header__right"> <div className="page-header__right">
<GraphTips /> <GraphTips />

View File

@ -111,14 +111,6 @@ const DashboardsPage = React.createClass({
}) : }) :
null null
} }
<tr>
<td className="monotype">
<Link to={`${dashboardLink}/kubernetes`}>
{'Kubernetes'}
</Link>
</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -9,7 +9,6 @@ import App from 'src/App'
import AlertsApp from 'src/alerts' import AlertsApp from 'src/alerts'
import CheckSources from 'src/CheckSources' import CheckSources from 'src/CheckSources'
import {HostsPage, HostPage} from 'src/hosts' import {HostsPage, HostPage} from 'src/hosts'
import {KubernetesPage} from 'src/kubernetes'
import {Login, UserIsAuthenticated, UserIsNotAuthenticated} from 'src/auth' import {Login, UserIsAuthenticated, UserIsNotAuthenticated} from 'src/auth'
import {KapacitorPage, KapacitorRulePage, KapacitorRulesPage, KapacitorTasksPage} from 'src/kapacitor' import {KapacitorPage, KapacitorRulePage, KapacitorRulesPage, KapacitorTasksPage} from 'src/kapacitor'
import DataExplorer from 'src/data_explorer' import DataExplorer from 'src/data_explorer'
@ -108,7 +107,6 @@ const Root = React.createClass({
<Route path="chronograf/data-explorer" component={DataExplorer} /> <Route path="chronograf/data-explorer" component={DataExplorer} />
<Route path="hosts" component={HostsPage} /> <Route path="hosts" component={HostsPage} />
<Route path="hosts/:hostID" component={HostPage} /> <Route path="hosts/:hostID" component={HostPage} />
<Route path="kubernetes" component={KubernetesPage} />
<Route path="kapacitors/new" component={KapacitorPage} /> <Route path="kapacitors/new" component={KapacitorPage} />
<Route path="kapacitors/:id/edit" component={KapacitorPage} /> <Route path="kapacitors/:id/edit" component={KapacitorPage} />
<Route path="kapacitor-tasks" component={KapacitorTasksPage} /> <Route path="kapacitor-tasks" component={KapacitorTasksPage} />

View File

@ -1,107 +0,0 @@
import React, {PropTypes} from 'react'
import classnames from 'classnames'
import LayoutRenderer from 'shared/components/LayoutRenderer'
import DashboardHeader from 'src/dashboards/components/DashboardHeader'
import timeRanges from 'hson!../../shared/data/timeRanges.hson'
const {
arrayOf,
bool,
func,
number,
shape,
string,
} = PropTypes
export const KubernetesDashboard = React.createClass({
propTypes: {
source: shape({
links: shape({
proxy: string.isRequired,
}).isRequired,
telegraf: string.isRequired,
}),
layouts: arrayOf(shape().isRequired).isRequired,
autoRefresh: number.isRequired,
handleChooseAutoRefresh: func.isRequired,
inPresentationMode: bool.isRequired,
handleClickPresentationButton: func,
},
getInitialState() {
const fifteenMinutesIndex = 1
return {
timeRange: timeRanges[fifteenMinutesIndex],
}
},
renderLayouts(layouts) {
const {timeRange} = this.state
const {source, autoRefresh} = this.props
let layoutCells = []
layouts.forEach((layout) => {
layoutCells = layoutCells.concat(layout.cells)
})
layoutCells.forEach((cell, i) => {
cell.queries.forEach((q) => {
q.text = q.query
q.database = source.telegraf
})
cell.x = (i * 4 % 12) // eslint-disable-line no-magic-numbers
cell.y = 0
})
return (
<LayoutRenderer
timeRange={timeRange}
cells={layoutCells}
autoRefresh={autoRefresh}
source={source.links.proxy}
/>
)
},
handleChooseTimeRange({lower}) {
const timeRange = timeRanges.find((range) => range.lower === lower)
this.setState({timeRange})
},
render() {
const {layouts, autoRefresh, handleChooseAutoRefresh, inPresentationMode, handleClickPresentationButton, source} = this.props
const {timeRange} = this.state
const emptyState = (
<div className="generic-empty-state">
<span className="icon alert-triangle"></span>
<h4>No Kubernetes configuration found</h4>
</div>
)
return (
<div className="page">
<DashboardHeader
headerText="Kubernetes Dashboard"
autoRefresh={autoRefresh}
handleChooseAutoRefresh={handleChooseAutoRefresh}
timeRange={timeRange}
handleChooseTimeRange={this.handleChooseTimeRange}
isHidden={inPresentationMode}
handleClickPresentationButton={handleClickPresentationButton}
source={source}
/>
<div className={classnames({
'page-contents': true,
'presentation-mode': inPresentationMode,
})}>
<div className="container-fluid full-width dashboard">
{layouts.length ? this.renderLayouts(layouts) : emptyState}
</div>
</div>
</div>
)
},
})
export default KubernetesDashboard

View File

@ -1,72 +0,0 @@
import React, {PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {fetchLayouts} from 'shared/apis'
import KubernetesDashboard from 'src/kubernetes/components/KubernetesDashboard'
import {setAutoRefresh} from 'shared/actions/app'
import {presentationButtonDispatcher} from 'shared/dispatchers'
const {
bool,
func,
number,
shape,
string,
} = PropTypes
export const KubernetesPage = React.createClass({
propTypes: {
source: shape({
links: shape({
proxy: string.isRequired,
}).isRequired,
}),
autoRefresh: number.isRequired,
handleChooseAutoRefresh: func.isRequired,
inPresentationMode: bool.isRequired,
handleClickPresentationButton: func,
},
getInitialState() {
return {
layouts: [],
}
},
componentDidMount() {
fetchLayouts().then(({data: {layouts}}) => {
const kubernetesLayouts = layouts.filter((l) => l.app === 'kubernetes')
this.setState({layouts: kubernetesLayouts})
})
},
render() {
const {layouts} = this.state
const {source, autoRefresh, handleChooseAutoRefresh, inPresentationMode, handleClickPresentationButton} = this.props
return (
<KubernetesDashboard
layouts={layouts}
source={source}
autoRefresh={autoRefresh}
handleChooseAutoRefresh={handleChooseAutoRefresh}
inPresentationMode={inPresentationMode}
handleClickPresentationButton={handleClickPresentationButton}
/>
)
},
})
const mapStateToProps = ({app: {ephemeral: {inPresentationMode}, persisted: {autoRefresh}}}) => ({
inPresentationMode,
autoRefresh,
})
const mapDispatchToProps = (dispatch) => ({
handleChooseAutoRefresh: bindActionCreators(setAutoRefresh, dispatch),
handleClickPresentationButton: presentationButtonDispatcher(dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(KubernetesPage)

View File

@ -1,2 +0,0 @@
import KubernetesPage from './containers/KubernetesPage'
export {KubernetesPage}

View File

@ -94,7 +94,7 @@ export const LayoutRenderer = React.createClass({
return cells.map((cell) => { return cells.map((cell) => {
const qs = cell.queries.map((query) => { const qs = cell.queries.map((query) => {
// TODO: Canned dashboards (and possibly Kubernetes dashboard) use an old query schema, // TODO: Canned dashboards use an old query schema,
// which does not have enough information for the new `buildInfluxQLQuery` function // which does not have enough information for the new `buildInfluxQLQuery` function
// to operate on. We will use `buildQueryForOldQuerySchema` until we conform // to operate on. We will use `buildQueryForOldQuerySchema` until we conform
// on a stable query representation. // on a stable query representation.