Skip to content

Commit

Permalink
fix: Fix pod link error
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jun 3, 2020
1 parent 9d4b6da commit 1648428
Show file tree
Hide file tree
Showing 20 changed files with 108 additions and 47 deletions.
3 changes: 3 additions & 0 deletions src/components/Base/Tag/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

.wrapper {
display: inline-block;
vertical-align: middle;
height: 20px;
padding: 0 4px;
font-size: $size-small;
line-height: 20px;
font-weight: 600;
border-radius: 2px;
max-width: 100px;
@include ellipsis;

&.default {
color: $white;
Expand Down
12 changes: 10 additions & 2 deletions src/components/Base/Text/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ import styles from './index.scss'

export default class Text extends React.PureComponent {
render() {
const { icon, title, description, className, extra, onClick } = this.props
const {
icon,
title,
description,
className,
ellipsis,
extra,
onClick,
} = this.props

return (
<div
className={classNames(
styles.wrapper,
{ [styles.clickable]: !!onClick },
{ [styles.clickable]: !!onClick, [styles.ellipsis]: ellipsis },
className
)}
onClick={onClick}
Expand Down
17 changes: 17 additions & 0 deletions src/components/Base/Text/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
}
}

.ellipsis {
flex: 1;
overflow: hidden;

.text {
flex: 1;
overflow: hidden;

& > div {
@include ellipsis;
}
& > p {
@include ellipsis;
}
}
}

.icon {
margin-right: 12px;
}
Expand Down
1 change: 1 addition & 0 deletions src/components/History/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class Card extends Component {
icon={this.getIcon()}
title={data.name}
description={data.description || t(data.type)}
ellipsis
/>
{data.isFedManaged && (
<Tag className={styles.tag}>{t('MULTI_CLUSTER')}</Tag>
Expand Down
12 changes: 10 additions & 2 deletions src/components/Inputs/SelectInput/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export default class SelectInput extends React.Component {
return (
<Menu onClick={this.handleOptionsClick}>
{options.map(option => (
<Menu.MenuItem key={option.value}>{option.label}</Menu.MenuItem>
<Menu.MenuItem key={option.value}>
{option.icon && <Icon name={option.icon} type="light" size={20} />}
{option.label}
</Menu.MenuItem>
))}
</Menu>
)
Expand All @@ -74,7 +77,12 @@ export default class SelectInput extends React.Component {
return (
<div className={styles.wrapper}>
<Input {...rest} />
<Icon name="caret-down" clickable onClick={this.toggleOptions} />
<Icon
className={styles.caret}
name="caret-down"
clickable
onClick={this.toggleOptions}
/>
<Dropdown
visible={this.state.showOptions}
className="dropdown-default"
Expand Down
12 changes: 6 additions & 6 deletions src/components/Inputs/SelectInput/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
width: 455px;
height: 32px;

.caret {
@include vertical-center;
right: 12px;
}

:global {
.icon {
@include vertical-center;
right: 12px;
}

.dropdown.dropdown-default .menu {
width: 455px;
}
Expand All @@ -24,4 +24,4 @@
top: 0;
right: 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,40 @@ export default class BaseInfo extends React.Component {
get groups() {
return [
{
label: t('production'),
label: 'production',
value: 'production',
},
{
label: t('development'),
label: 'development',
value: 'development',
},
{
label: 'testing',
value: 'testing',
},
{
label: 'demo',
value: 'demo',
},
]
}

get providers() {
return [
{
label: 'ACK',
value: 'ACK',
icon: 'windows',
},
{
label: 'AKS',
value: 'AKS',
icon: 'windows',
icon: 'aliyun',
},
{
label: 'CCE',
value: 'CCE',
icon: 'kubernetes',
},
{
label: 'EKS',
Expand All @@ -53,13 +71,18 @@ export default class BaseInfo extends React.Component {
{
label: 'GEK',
value: 'GEK',
icon: 'google',
icon: 'google-plus',
},
{
label: 'QKE',
value: 'QKE',
icon: 'qingcloud',
},
{
label: 'TKE',
value: 'TKE',
icon: 'kubernetes',
},
]
}

Expand Down
4 changes: 2 additions & 2 deletions src/pages/clusters/containers/Projects/Detail/Pods/index.jsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default class Cluster extends Component {
<Indicator className={styles.indicator} type={clusterDetail.status} />
<div className={styles.text}>
<div>{cluster}</div>
<p>{clusterDetail.description || '-'}</p>
<p>{clusterDetail.description || t('Cluster Name')}</p>
</div>
{clusterDetail.group && (
<Tag className={styles.group} type="info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
}

.text {
flex: 1;
overflow: hidden;
& > div {
@include TypographyTitleH6(#fff);
@include ellipsis;
}

& > p {
@include TypographyParagraph(#fff);
@include ellipsis;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class ResourceStatus extends React.Component {

get prefix() {
const path = this.props.match.path
const { cluster, namespace } = this.props.match.params
const { cluster } = this.props.match.params
if (path.startsWith('/clusters')) {
return `/clusters/${cluster}/projects/${namespace}`
return `/clusters/${cluster}`
}

return `/cluster/${cluster}/projects/${namespace}`
return `/cluster/${cluster}`
}

get enabledActions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ class JobsResourceStatus extends Base {
}

renderPods() {
const { params = {} } = this.props.match
const { cluster, namespace } = params
const { cluster } = this.props.match.params

return (
<PodsCard
prefix={`/cluster/${cluster}/projects/${namespace}`}
detail={this.store.jobDetail}
/>
<PodsCard prefix={`/cluster/${cluster}`} detail={this.store.jobDetail} />
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ export default class ResourceStatus extends React.Component {

get prefix() {
const path = this.props.match.path
const { cluster, namespace } = this.props.match.params
const { cluster } = this.props.match.params
if (path.startsWith('/clusters')) {
return `/clusters/${cluster}/projects/${namespace}`
return `/clusters/${cluster}`
}

return `/cluster/${cluster}/projects/${namespace}`
return `/cluster/${cluster}`
}

fetchDetail = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class ServicePort extends Component {
/>
<div className={styles.text}>
<div>{cluster}</div>
<p>{clusterDetail.description || '-'}</p>
<p>{clusterDetail.description || t('Cluster Name')}</p>
</div>
{clusterDetail.group && (
<Tag className={styles.group} type="info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@
}

.text {
flex: 1;
overflow: hidden;
& > div {
@include TypographyTitleH6(#fff);
@include ellipsis;
}

& > p {
@include TypographyParagraph(#fff);
@include ellipsis;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class ResourceStatus extends React.Component {

renderServiceAccess() {
const { name, namespace } = this.store.detail
const { clusters } = this.fedStore.detail
const { clusters = [] } = this.fedStore.detail
const gateway = this.routerStore.gateway.data
return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class ResourceStatus extends React.Component {

get prefix() {
const path = this.props.match.path
const { cluster, namespace } = this.props.match.params
const { cluster } = this.props.match.params
if (path.startsWith('/clusters')) {
return `/clusters/${cluster}/projects/${namespace}`
return `/clusters/${cluster}`
}

return `/cluster/${cluster}/projects/${namespace}`
return `/cluster/${cluster}`
}

constructor(props) {
Expand Down
16 changes: 4 additions & 12 deletions src/pages/projects/routes/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ import AlertMessagesDetail from '../containers/Alerting/Messages/Detail'
const PATH = '/cluster/:cluster/projects/:namespace'

export default [
{
path: `${PATH}/:module/:name/pods/:podName/containers/:containerName`,
component: ContainerDetail,
},
{
path: `${PATH}/:module/:name/pods/:podName`,
component: PodDetail,
},
{
path: `${PATH}/deployments/:name`,
component: DeploymentDetail,
Expand All @@ -66,14 +58,14 @@ export default [
path: `${PATH}/cronjobs/:name`,
component: CronJobDetail,
},
{
path: `${PATH}/pods/:podName`,
component: PodDetail,
},
{
path: `${PATH}/pods/:podName/containers/:containerName`,
component: ContainerDetail,
},
{
path: `${PATH}/pods/:podName`,
component: PodDetail,
},
{
path: `${PATH}/services/:name`,
component: ServiceDetail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class ClusterSettings extends Component {
icon={CLUSTER_PROVIDER_ICON[cluster.provider] || 'kubernetes'}
title={cluster.name}
description={cluster.description || t('Cluster Name')}
ellipsis
/>
{cluster.group && (
<Tag className={styles.tag} type="info">
Expand Down
6 changes: 5 additions & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,15 @@ export const COMPONENT_ICON_MAP = {
}

export const CLUSTER_PROVIDER_ICON = {
Custom: 'kubernetes',
QingCloud: 'qingcloud',
Google: 'google-plus',
Amazon: 'aws',
Azure: 'windows',
ACK: 'windows',
AKS: 'aliyun',
EKS: 'aws',
GEK: 'google-plus',
QKE: 'qingcloud',
}

export const ROLE_QUERY_KEY = {
Expand Down

0 comments on commit 1648428

Please sign in to comment.