1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

addressed review comments (replaced <p> with <div>, moved key attribute to proper element)

This commit is contained in:
Jim Ehrismann 2020-07-29 18:54:04 -04:00
parent a97427bc03
commit 43853d7302
4 changed files with 11 additions and 13 deletions

View File

@ -63,11 +63,10 @@ export class ServiceDetails extends React.Component<Props> {
<DrawerItem name={<Trans>Ports</Trans>}> <DrawerItem name={<Trans>Ports</Trans>}>
<div> <div>
{ {
service.getPorts().map((port) => { service.getPorts().map((port) => (
return( <ServicePortComponent service={service} port={port} key={port.toString()}/>
<ServicePortComponent service={service} port={port}/> )
); )
})
} }
</div> </div>
</DrawerItem> </DrawerItem>

View File

@ -35,14 +35,14 @@ export class ServicePortComponent extends React.Component<Props> {
render() { render() {
const { port } = this.props; const { port } = this.props;
return ( return (
<p className={cssNames("ServicePortComponent", { waiting: this.waiting })} key={port.toString()}> <div className={cssNames("ServicePortComponent", { waiting: this.waiting })}>
<span title={_i18n._(t`Open in a browser`)} onClick={() => this.portForward() }> <span title={_i18n._(t`Open in a browser`)} onClick={() => this.portForward() }>
{port.toString()} {port.toString()}
{this.waiting && ( {this.waiting && (
<Spinner /> <Spinner />
)} )}
</span> </span>
</p> </div>
); );
} }
} }

View File

@ -13,7 +13,6 @@ import { Spinner } from "../spinner"
interface Props { interface Props {
pod: Pod; pod: Pod;
containerName: string;
port: { port: {
name?: string; name?: string;
containerPort: number; containerPort: number;
@ -38,19 +37,18 @@ export class PodContainerPort extends React.Component<Props> {
} }
render() { render() {
const { containerName, port } = this.props; const { port } = this.props;
const { name, containerPort, protocol } = port; const { name, containerPort, protocol } = port;
const key = `${containerName}-port-${containerPort}-${protocol}`
const text = (name ? name + ': ' : '')+`${containerPort}/${protocol}` const text = (name ? name + ': ' : '')+`${containerPort}/${protocol}`
return ( return (
<p className={cssNames("PodContainerPort", { waiting: this.waiting })} key={key}> <div className={cssNames("PodContainerPort", { waiting: this.waiting })}>
<span title={_i18n._(t`Open in a browser`)} onClick={() => this.portForward() }> <span title={_i18n._(t`Open in a browser`)} onClick={() => this.portForward() }>
{text} {text}
{this.waiting && ( {this.waiting && (
<Spinner /> <Spinner />
)} )}
</span> </span>
</p> </div>
) )
} }
} }

View File

@ -67,8 +67,9 @@ export class PodDetailsContainer extends React.Component<Props> {
<div> <div>
{ {
ports.map((port) => { ports.map((port) => {
const key = `${container.name}-port-${port.containerPort}-${port.protocol}`
return( return(
<PodContainerPort pod={pod} containerName={container.name} port={port}/> <PodContainerPort pod={pod} port={port} key={key}/>
) )
}) })
} }