Skip to content

Commit

Permalink
Merge pull request #352 from leoendless/hotfix/linkErrors
Browse files Browse the repository at this point in the history
fix: Fix some link errors
  • Loading branch information
leoendless authored Jun 7, 2020
2 parents cae9043 + 38a8339 commit e8f8961
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/components/Cards/Containers/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class ContainerItem extends React.Component {
const { cluster, podName } = this.props
const { namespace, name } = this.props.detail

const terminalUrl = `/terminal/clusters/${cluster}/projects/${namespace}/pods/${podName}/containers/${name}`
const terminalUrl = `/terminal/cluster/${cluster}/projects/${namespace}/pods/${podName}/containers/${name}`
window.open(
terminalUrl,
`Connecting ${name}`,
Expand Down
8 changes: 3 additions & 5 deletions src/components/Cards/Pods/index.jsx

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

16 changes: 16 additions & 0 deletions src/core/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export default class GlobalValue {
}

getClusterNavs(cluster) {
if (!get(globals.user, `clusterRules[${cluster}]`)) {
return []
}

if (!this._cache_[`cluster_${cluster}_navs`]) {
const navs = []

Expand Down Expand Up @@ -274,6 +278,10 @@ export default class GlobalValue {
}

getWorkspaceNavs(workspace) {
if (!get(globals.user, `workspaceRules[${workspace}]`)) {
return []
}

if (!this._cache_[`workspace_${workspace}_navs`]) {
const navs = []

Expand All @@ -300,6 +308,10 @@ export default class GlobalValue {
}

getProjectNavs({ cluster, workspace, project }) {
if (!get(globals.user, `projectRules[${cluster}][${project}]`)) {
return []
}

if (!this._cache_[`project_${cluster}_${project}_navs`]) {
const navs = []

Expand All @@ -322,6 +334,10 @@ export default class GlobalValue {
}

getDevOpsNavs({ cluster, workspace, devops }) {
if (!get(globals.user, `devopsRules[${cluster}][${devops}]`)) {
return []
}

if (!this._cache_[`devops_${cluster}_${devops}_navs`]) {
const navs = []

Expand Down
1 change: 1 addition & 0 deletions src/locales/en/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default {
CANCEL: 'Cancel',
NO_RESULTS_FOUND: 'No result found',
REACH_BOTTOM: 'Reach bottom',
CLEAR_VALUE: 'Clear',
QUOTA_LIMIT_TIP:
'The configuration here refers to Limits in Kubernetes resource management, which is mainly used to limit the maximum value of resources used by each container.',

Expand Down
1 change: 1 addition & 0 deletions src/locales/zh/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export default {
CANCEL: '取消',
NO_RESULTS_FOUND: '暂无结果',
REACH_BOTTOM: '已到底部',
CLEAR_VALUE: '清除',

'Edit Mode': '编辑模式',
'Load More': '加载更多',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
*/

import React from 'react'
import { inject } from 'mobx-react'
import ResourceUsage from 'projects/containers/Overview/ResourceUsage'

@inject('detailStore')
export default class Overview extends React.Component {
render() {
return <ResourceUsage match={this.props.match} />
const { detail } = this.props.detailStore
return (
<ResourceUsage match={this.props.match} workspace={detail.workspace} />
)
}
}
2 changes: 1 addition & 1 deletion src/pages/console/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default [
{ path: '/auditingsearch', exact: true, component: AuditingSearch },
{
path:
'/terminal/clusters/:cluster/projects/:namespace/pods/:podName/containers/:containerName',
'/terminal/cluster/:cluster/projects/:namespace/pods/:podName/containers/:containerName',
component: ContainerTerminal,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,47 @@ export default class ResourceCard extends React.Component {
return this.props.rootStore.routing
}

get prefix() {
const { workspace, namespace, cluster } = this.props
return `/${workspace}/clusters/${cluster}/projects/${namespace}`
}

handleClick = () => {
const { onClick, name, routeName } = this.props
const {
onClick,
name,
routeName,
workspace,
namespace,
cluster,
} = this.props
if (isFunction(onClick)) {
onClick(name)
} else if (routeName) {
this.routing.push(`${this.prefix}/${routeName}`)
this.routing.push(
workspace
? `/${workspace}/clusters/${cluster}/projects/${namespace}/${routeName}`
: `/clusters/${cluster}/${routeName}?namespace=${namespace}`
)
}
}

handleWarnClick = e => {
e.stopPropagation()

const { routeName, onClick, name } = this.props
const {
routeName,
onClick,
name,
workspace,
namespace,
cluster,
} = this.props
const status = routeName === 'volumes' ? 'pending' : 'updating'

if (isFunction(onClick)) {
onClick(name, status)
} else if (routeName) {
this.routing.push(`${this.prefix}/${routeName}?status=${status}`)
this.routing.push(
workspace
? `/${workspace}/clusters/${cluster}/projects/${namespace}/${routeName}?status=${status}`
: `/clusters/${cluster}/${routeName}?namespace=${namespace}&status=${status}`
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ class ResourceUsage extends React.Component {
routeName: 's2ibuilders',
num: used['count/s2ibuilders.devops.kubesphere.io'],
metric: 'namespace_s2ibuilder_count',
disabled: !globals.app.hasKSModule('devops'),
disabled:
!globals.app.hasKSModule('devops') ||
!this.props.match.params.workspace,
},
{
key: 'jobs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class UsageRanking extends React.Component {
const { workspace, cluster, namespace } = this.props.match.params
const prefix = `${
workspace ? `/${workspace}` : ''
}/clustes/${cluster}/projects/${namespace}`
}/clusters/${cluster}/projects/${namespace}`
const LINK_MAP = {
Deployment: `${prefix}/deployments/${workloadName}`,
StatefulSet: `${prefix}/statefulsets/${workloadName}`,
Expand Down
8 changes: 4 additions & 4 deletions src/pages/projects/containers/Pods/Containers/Detail.jsx

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

21 changes: 4 additions & 17 deletions src/pages/projects/containers/Pods/Detail/index.jsx

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

6 changes: 6 additions & 0 deletions src/pages/projects/containers/Volumes/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ import getRoutes from './routes'
@trigger
export default class VolumeDetail extends React.Component {
store = new Volume()

storageclass = new StorageClass()

storageclasscapabilities = new StorageClassCapability()

componentDidMount() {
Expand All @@ -49,6 +51,10 @@ export default class VolumeDetail extends React.Component {
return 'Volume'
}

get module() {
return 'volumes'
}

get authKey() {
return 'volumes'
}
Expand Down

0 comments on commit e8f8961

Please sign in to comment.