Skip to content

Commit

Permalink
fix: Fix workload ports missing when update replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jul 13, 2020
1 parent c3d9bef commit 26cac9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ class ResourceStatus extends React.Component {
return null
}

const { isResourcesLoading } = this.store
const { resources, isResourcesLoading } = this.store
const ports = []
Object.values(this.store.resources).forEach(resource => {
Object.values(resources).forEach(resource => {
if (resource && resource.containers) {
ports.push(
...uniqBy(
flatten(
resource.containers.map(container =>
isEmpty(container.ports) ? [] : container.ports
isEmpty(container.ports) ? [] : container.ports.slice()
)
),
'name'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import { isEmpty, get } from 'lodash'

import { ICON_TYPES } from 'utils/constants'

import { Icon } from '@pitrix/lego-ui'
import { Panel } from 'components/Base'
import { Panel, Text } from 'components/Base'

import styles from './index.scss'

Expand Down Expand Up @@ -54,33 +53,21 @@ export default class ServiceCard extends React.Component {

if (isEmpty(service)) return null

const { name, namespace, type } = service
const { name, namespace } = service

return (
<div className={styles.item}>
<Icon className={styles.icon} name={ICON_TYPES['services']} size={40} />
<div className={styles.info}>
<div className={styles.base}>
<strong>
<Link
to={`/${workspace}/federatedprojects/${namespace}/services/${name}`}
>
{name}
</Link>
</strong>
<p>{type}</p>
</div>
<div className={styles.ports}>
<div className={styles.record}>
<label>{t('Ports')}:</label>
<div className={styles.text}>
{this.ports.map((item, i) => (
<p key={i}>{item}</p>
))}
</div>
</div>
</div>
</div>
<Text
icon={ICON_TYPES['services']}
title={
<Link
to={`/${workspace}/federatedprojects/${namespace}/services/${name}`}
>
{name}
</Link>
}
description={get(service, 'resource.type')}
/>
</div>
)
}
Expand Down

0 comments on commit 26cac9c

Please sign in to comment.