Skip to content

Commit

Permalink
js lint cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Aug 26, 2017
1 parent 6c1e64b commit 43ef0e4
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 161 deletions.
4 changes: 2 additions & 2 deletions pkg/ui/src/components/cluster/ClusterPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {blueA400, grey500, grey600, blueA100, white } from 'material-ui/styles/colors'
import { blueA400, blueA100 } from 'material-ui/styles/colors'
import sizeMe from 'react-sizeme'
import {Tabs, Tab} from 'material-ui/Tabs'
import { Tabs, Tab } from 'material-ui/Tabs'
import NodesTab from './NodesTab'
import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'
Expand Down
53 changes: 3 additions & 50 deletions pkg/ui/src/components/cluster/ClusterResourceTab.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
import React from 'react'
import FloatingActionButton from 'material-ui/FloatingActionButton'
import {blueA400, grey200, grey300, grey500, grey600, blueA100, white, red900 } from 'material-ui/styles/colors'
import {blueA400, grey200, grey300, grey500, grey600, blueA100, white } from 'material-ui/styles/colors'
import { routerActions } from 'react-router-redux'
import { connect } from 'react-redux'
import { addFilter, removeFilter, removeResource } from '../../state/actions/cluster'
import { removeResource } from '../../state/actions/cluster'
import sizeMe from 'react-sizeme'
import FilterTable from '../filter-table/FilterTable'
import * as moment from 'moment'

import ChipInput from 'material-ui-chip-input'
import Chip from 'material-ui/Chip'
import { withRouter } from 'react-router-dom'
import { linkForResource } from '../../routes'
import IconButton from 'material-ui/IconButton'
import IconLogs from 'material-ui/svg-icons/action/receipt'
import IconShell from 'material-ui/svg-icons/hardware/computer'

import IconEdit from 'material-ui/svg-icons/editor/mode-edit'
import IconDelete from 'material-ui/svg-icons/action/delete'
import IconMore from 'material-ui/svg-icons/navigation/more-horiz'

import Popover from 'material-ui/Popover'
import Paper from 'material-ui/Paper'

import { arraysEqual } from '../../comparators'
import { resourceStatus as resourceStatusIcons } from '../icons'
import { compareStatuses } from '../../utils/resource-utils'
import { hostnameLabel } from '../../utils/filter-utils'
import KubeKinds from '../../kube-kinds'
import './ClusterResourceTab.css'

import Perf from 'react-addons-perf'

const mapStateToProps = function(store) {
return {
resourceRevision: store.cluster.resourceRevision,
Expand Down Expand Up @@ -284,18 +271,6 @@ class ClusterResourceTab extends React.Component {
}
}

// componentWillUpdate = () => {
// setTimeout(() => {
// Perf.start()
// }, 0)
// }

// componentDidUpdate = () => {
// Perf.stop()
// let m = Perf.getLastMeasurements()
// Perf.printWasted(m)
// }

componentWillReceiveProps = (nextProps) => {
this.rows = Object.entries(nextProps.resources).map(([k,v])=> v).filter(v => v.kind === nextProps.kind)
}
Expand Down Expand Up @@ -386,25 +361,3 @@ class ClusterResourceTab extends React.Component {
)
}
}))

class MultiResourceActionButton extends React.Component {

constructor(props) {
super(props);
this.state = {
disabled: props.disabled,
}
}

setDisabled = (disabled) => {
this.setState({disabled: disabled})
}

render() {
let { props } = this
return <FloatingActionButton {...props} disabled={this.state.disabled}>
{props.children}
</FloatingActionButton>
}

}
45 changes: 1 addition & 44 deletions pkg/ui/src/components/cluster/NamespacesTab.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@

import React from 'react'
import FloatingActionButton from 'material-ui/FloatingActionButton'
import {blueA400, grey500, grey600, blueA100, white } from 'material-ui/styles/colors'
import { routerActions } from 'react-router-redux'
import { connect } from 'react-redux'
import { addFilter, removeFilter, removeResource } from '../../state/actions/cluster'
import sizeMe from 'react-sizeme'
import FilterTable from '../filter-table/FilterTable'
import * as moment from 'moment'

import ChipInput from 'material-ui-chip-input'
import Chip from 'material-ui/Chip'
import { withRouter } from 'react-router-dom'
import { linkForResource } from '../../routes'
import IconLogs from 'material-ui/svg-icons/action/receipt'
import IconShell from 'material-ui/svg-icons/hardware/computer'
import IconEdit from 'material-ui/svg-icons/editor/mode-edit'

import Popover from 'material-ui/Popover'
import Paper from 'material-ui/Paper'

import { arraysEqual } from '../../comparators'
import { resourceStatus as resourceStatusIcons } from '../icons'
import { compareStatuses } from '../../utils/resource-utils'
import { hostnameLabel } from '../../utils/filter-utils'
import KubeKinds from '../../kube-kinds'
import './ClusterResourceTab.css'

import Perf from 'react-addons-perf'
import { white } from 'material-ui/styles/colors'
import ClusterResourceTab from './ClusterResourceTab'

const styles = {
Expand Down Expand Up @@ -62,22 +35,6 @@ export default class NamespacesTab extends React.Component {
return r.metadata.name
},
},
// {
// id: 'age',
// label: 'age',
// sortable: true,
// headerStyle: styles.header,
// style: { ...styles.cell,
// width: 90,
// },
// value: function(r) {
// return r.metadata.creationTimestamp
// },
// render: function(r) {
// let age = Date.now() - Date.parse(r.metadata.creationTimestamp)
// return moment.duration(age).humanize()
// }
// },
]
}

Expand Down
3 changes: 0 additions & 3 deletions pkg/ui/src/components/cluster/NodesTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import sizeMe from 'react-sizeme'
import FilterTable from '../filter-table/FilterTable'
import * as moment from 'moment'

import ChipInput from 'material-ui-chip-input'
import Chip from 'material-ui/Chip'
import { withRouter } from 'react-router-dom'
import { linkForResource } from '../../routes'
import IconLogs from 'material-ui/svg-icons/action/receipt'
import IconShell from 'material-ui/svg-icons/hardware/computer'
import IconEdit from 'material-ui/svg-icons/editor/mode-edit'

Expand Down
28 changes: 1 addition & 27 deletions pkg/ui/src/components/cluster/ResourceQuotasTab.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@

import React from 'react'
import FloatingActionButton from 'material-ui/FloatingActionButton'
import {blueA400, grey500, grey600, blueA100, white } from 'material-ui/styles/colors'
import { routerActions } from 'react-router-redux'
import { connect } from 'react-redux'
import { addFilter, removeFilter, removeResource } from '../../state/actions/cluster'
import sizeMe from 'react-sizeme'
import FilterTable from '../filter-table/FilterTable'
import { white } from 'material-ui/styles/colors'
import * as moment from 'moment'

import ChipInput from 'material-ui-chip-input'
import Chip from 'material-ui/Chip'
import { withRouter } from 'react-router-dom'
import { linkForResource } from '../../routes'
import IconLogs from 'material-ui/svg-icons/action/receipt'
import IconShell from 'material-ui/svg-icons/hardware/computer'
import IconEdit from 'material-ui/svg-icons/editor/mode-edit'

import Popover from 'material-ui/Popover'
import Paper from 'material-ui/Paper'

import { arraysEqual } from '../../comparators'
import { resourceStatus as resourceStatusIcons } from '../icons'
import { compareStatuses } from '../../utils/resource-utils'
import { hostnameLabel } from '../../utils/filter-utils'
import KubeKinds from '../../kube-kinds'
import './ClusterResourceTab.css'

import Perf from 'react-addons-perf'
import ClusterResourceTab from './ClusterResourceTab'

const styles = {
Expand Down
28 changes: 1 addition & 27 deletions pkg/ui/src/components/cluster/StorageClassesTab.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@

import React from 'react'
import FloatingActionButton from 'material-ui/FloatingActionButton'
import {blueA400, grey500, grey600, blueA100, white } from 'material-ui/styles/colors'
import { routerActions } from 'react-router-redux'
import { connect } from 'react-redux'
import { addFilter, removeFilter, removeResource } from '../../state/actions/cluster'
import sizeMe from 'react-sizeme'
import FilterTable from '../filter-table/FilterTable'
import { white } from 'material-ui/styles/colors'
import * as moment from 'moment'

import ChipInput from 'material-ui-chip-input'
import Chip from 'material-ui/Chip'
import { withRouter } from 'react-router-dom'
import { linkForResource } from '../../routes'
import IconLogs from 'material-ui/svg-icons/action/receipt'
import IconShell from 'material-ui/svg-icons/hardware/computer'
import IconEdit from 'material-ui/svg-icons/editor/mode-edit'

import Popover from 'material-ui/Popover'
import Paper from 'material-ui/Paper'

import { arraysEqual } from '../../comparators'
import { resourceStatus as resourceStatusIcons } from '../icons'
import { compareStatuses } from '../../utils/resource-utils'
import { hostnameLabel } from '../../utils/filter-utils'
import KubeKinds from '../../kube-kinds'
import './ClusterResourceTab.css'

import Perf from 'react-addons-perf'
import ClusterResourceTab from './ClusterResourceTab'

const styles = {
Expand Down
6 changes: 2 additions & 4 deletions pkg/ui/src/components/dashboard/InfoBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import './InfoBox.css'
export default class InfoBox extends React.PureComponent {

render() {
let {color, title, total, units, Icon} = this.props

let limitPercent = 35
let {color, title, total, units, Icon} = this.props
let data = {}

if ('usage' in this.props && total > 0) {
Expand Down Expand Up @@ -41,7 +39,7 @@ export default class InfoBox extends React.PureComponent {
}
}

let [newTotal, newUnits] = fixUnits(data.total, units)
let [ , newUnits] = fixUnits(data.total, units)
if (newUnits !== units) {
// data.total = newTotal
for (let v in data) {
Expand Down
2 changes: 0 additions & 2 deletions pkg/ui/src/components/dashboard/ResourceCounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import Divider from 'material-ui/Divider'
import Paper from 'material-ui/Paper'
import { white } from 'material-ui/styles/colors'
import { Link } from 'react-router-dom'
import queryString from 'query-string'
import { connect } from 'react-redux'
import KubeKinds from '../../kube-kinds'
import { linkForResourceKind } from '../../routes'
import HelpText from '../../i18n/help-text'

Expand Down
1 change: 1 addition & 0 deletions pkg/ui/src/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function fixUnits(number, units) {
return [number * 1024, 'bytes']
case 'cores':
return [number * 1000, 'millicores']
default:
}
}
return [number, units]
Expand Down
2 changes: 0 additions & 2 deletions pkg/ui/src/state/reducers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const initialState = {
latestError: null,
}

var errorId = 0

export default (state = initialState, action) => {
switch (action.type) {

Expand Down

0 comments on commit 43ef0e4

Please sign in to comment.