Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: App categories name is 'all' #2783

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/pages/apps/containers/Home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export default class Home extends React.Component {

this.cateRef = React.createRef()
this.appRef = React.createRef()
this.state = {
tabName: t(`APP_CATE_All`),
}
}

get queryParams() {
Expand Down Expand Up @@ -141,7 +144,12 @@ export default class Home extends React.Component {
}
}

handleClickCate = category => {
handleClickCate = (category, tabName) => {
this.setState({
tabName: t(`APP_CATE_${tabName.toUpperCase()}`, {
defaultValue: tabName,
}),
})
this.props.rootStore.query({ category })
}

Expand Down Expand Up @@ -202,7 +210,7 @@ export default class Home extends React.Component {
className={classnames(styles.item, {
[styles.active]: category === category_id,
})}
onClick={() => this.handleClickCate(category_id)}
onClick={() => this.handleClickCate(category_id, name)}
>
<Icon
name={category_id === uncateKey ? 'tag' : description}
Expand All @@ -227,6 +235,7 @@ export default class Home extends React.Component {
const { list, allApps } = this.appStore
const { isLoading, total } = list
const { workspace, namespace, cluster } = this.queryParams
const { tabName } = this.state

return (
<div className={styles.wrapper}>
Expand All @@ -240,7 +249,7 @@ export default class Home extends React.Component {
<AppList
className={styles.apps}
appRef={this.appRef}
title={t('ALL')}
title={tabName}
apps={allApps.slice()}
isLoading={isLoading}
total={total}
Expand Down