Skip to content

Commit

Permalink
add node link in pod details
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Oct 31, 2017
1 parent 268382e commit 5c20b6e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 29 deletions.
53 changes: 35 additions & 18 deletions pkg/ui/src/components/FilterChip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {blueA400, blueA100} from 'material-ui/styles/colors';

import { blueA400, blueA100 } from 'material-ui/styles/colors';
import { Link } from 'react-router-dom'
import Chip from 'material-ui/Chip';

// use functional component style for representational components
Expand All @@ -13,22 +13,39 @@ export default function FilterChip(props) {
</span>
)

return (
let onTouchTap = props.onTouchTap
if (props.link && !onTouchTap) {
onTouchTap = function(){}
}

<Chip
style={{...props.style, ...{
margin: '8px 8px 0 0',
padding: 0,
float: 'left',
pointerEvents: props.isDisabled ? 'none' : 'all'
}}}
labelStyle={{...{'lineHeight': '22px', fontSize: '12px',...props.labelStyle}}}
backgroundColor={props.isFocused ? blueA100 : null}
onTouchTap={props.onTouchTap}
onRequestDelete={props.onRequestDelete}
>
{labelText}
</Chip>
)
let chip = (
<Chip
style={{...{
margin: '8px 8px 0 0',
padding: 0,
float: 'left',
pointerEvents: props.isDisabled ? 'none' : 'all'
}, ...props.style}}
labelStyle={{...{'lineHeight': '22px', fontSize: '12px',...props.labelStyle}}}
backgroundColor={props.isFocused ? blueA100 : null}
onTouchTap={onTouchTap}
onRequestDelete={props.onRequestDelete}
>
{labelText}
</Chip>
)

let content
if (props.link) {
content = (
<Link to={props.link}>
{chip}
</Link>
)
} else {
content = chip
}

return content
}

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class ConfigurationPane extends React.Component {
return <div key={container.name} className="col-xs-12 col-sm-6 col-md-6 col-lg-4" style={{marginBottom: 15, paddingLeft: 0}}>
<ContainerPanel container={container}
namespace={resource.metadata.namespace}
linkGenerator={linkGenerator}
status={resource.status.containerStatuses[index]}
/>
</div>
Expand Down
5 changes: 2 additions & 3 deletions pkg/ui/src/components/configuration-pane/ContainerPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class ContainerPanel extends React.Component {
render() {

let { props } = this
let { container, namespace, initIndex, linkGenerator, status } = props
let { container, namespace, initIndex, status } = props
let initHeader = null
let statusHeader = null
if (initIndex !== undefined) {
Expand Down Expand Up @@ -111,8 +111,7 @@ export default class ContainerPanel extends React.Component {
<TableRow style={styles.tableRow} displayBorder={false}>
<TableRowColumn style={styles.tableRowKeyCol}>Env:</TableRowColumn>
<TableRowColumn style={styles.tableRowValCol}>
<EnvironmentExpander data={container.env} title={'env'} namespace={namespace}
linkGenerator={linkGenerator}/>
<EnvironmentExpander data={container.env} title={'env'} namespace={namespace} />
</TableRowColumn>
</TableRow>
}
Expand Down
12 changes: 8 additions & 4 deletions pkg/ui/src/components/configuration-pane/PodDetailsPanel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {Card, CardText} from 'material-ui/Card'
import {grey800} from 'material-ui/styles/colors'
import { Card, CardText } from 'material-ui/Card'
import { grey800 } from 'material-ui/styles/colors'
import {
Table,
TableBody,
Expand All @@ -10,6 +10,7 @@ import {
import sizeMe from 'react-sizeme'
import Volumes from './Volumes'
import yaml from 'js-yaml'
import FilterChip from '../FilterChip'

import './PodDetailsPanel.css'

Expand Down Expand Up @@ -95,7 +96,10 @@ class PodDetailsPanel extends React.Component {
tableLayout: 'inherit',
}} selectable={false} headerStyle={{display: 'none'}}>
<TableBody displayRowCheckbox={false}>
{spec.nodeName && tableRow('Node:', spec.nodeName)}
{spec.nodeName && tableRow('Node:',
<FilterChip key={spec.nodeName} style={{margin: '0'}} prefix={'node'} suffix={spec.nodeName}
link={linkGenerator.linkForResource(`Node/~/${spec.nodeName}`)}/>)
}
{spec.dnsPolicy && tableRow('DNS Policy:', spec.dnsPolicy)}
{spec.restartPolicy && tableRow('Restart Policy:', spec.restartPolicy)}
{spec.nodeSelector && tableRow('Node-Selectors:', spec.nodeSelector)}
Expand Down Expand Up @@ -127,7 +131,7 @@ function tableRow(key, val) {

function renderValue(value) {
let rendered = value
if (typeof value === 'object') {
if (typeof value === 'object' && !value.type) {
rendered = <pre style={styles.valueStyle}>{yaml.safeDump(value)}</pre>
}
return rendered
Expand Down
4 changes: 1 addition & 3 deletions pkg/ui/src/components/configuration-pane/PodTemplatePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,14 @@ class PodTemplatePane extends React.Component {
resource.spec.template.spec.initContainers.map(container => {
return <div key={container.name} className="col-xs-12 col-sm-6 col-md-6 col-lg-6" style={{marginBottom: 15, paddingLeft: 0}}>
<ContainerPanel key={container.name} container={container}
namespace={resource.metadata.namespace} isInit={true}
linkGenerator={linkGenerator}/>
namespace={resource.metadata.namespace} isInit={true}/>
</div>
})
}
{resource.spec.template.spec.containers.map(container => {
return <div key={container.name} className="col-xs-12 col-sm-6 col-md-6 col-lg-6" style={{marginBottom: 15, paddingLeft: 0}}>
<ContainerPanel key={container.name} container={container}
namespace={resource.metadata.namespace}
linkGenerator={linkGenerator}
/>
</div>
})}
Expand Down

0 comments on commit 5c20b6e

Please sign in to comment.