Skip to content

Commit

Permalink
fix: Fix project overview redirect in cluster management
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Jul 21, 2020
1 parent 7d041f3 commit 95512b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/pages/clusters/components/ResourceTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import React from 'react'
import { observer, inject } from 'mobx-react'
import { isEmpty } from 'lodash'
import { parse } from 'qs'

import {
Dropdown,
Expand All @@ -36,6 +37,17 @@ import ProjectSelect from './ProjectSelect'
class ResourceTable extends BaseTable {
routing = this.props.rootStore.routing

componentDidMount() {
super.componentDidMount()
const params = parse(location.search.slice(1))
if (
params.namespace &&
this.props.clusterStore.project !== params.namespace
) {
this.props.clusterStore.setProject(params.namespace)
}
}

get showEmpty() {
const { data, isLoading, filters, clusterStore } = this.props
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class ResourceCard extends React.Component {
this.routing.push(
workspace
? `/${workspace}/clusters/${cluster}/projects/${namespace}/${routeName}`
: `/clusters/${cluster}/${routeName}`
: `/clusters/${cluster}/${routeName}?namespace=${namespace}`
)
}
}
Expand Down

0 comments on commit 95512b3

Please sign in to comment.