Skip to content

Commit 288fda3

Browse files
committed
fix: code-review
1 parent 1cafcbf commit 288fda3

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/containers/App/App.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ registerLanguages();
1717
class App extends React.Component {
1818
static propTypes = {
1919
isAuthenticated: PropTypes.bool,
20+
singleClusterMode: PropTypes.bool,
21+
clusterName: PropTypes.string,
2022
children: PropTypes.node,
2123
};
2224

@@ -40,9 +42,10 @@ class App extends React.Component {
4042
}
4143

4244
renderContentWithNavigation() {
45+
const {singleClusterMode, clusterName} = this.props;
4346
return (
4447
<AsideNavigation>
45-
<Content singleClusterMode={this.props.singleClusterMode} />
48+
<Content singleClusterMode={singleClusterMode} clusterName={clusterName} />
4649
<div id="fullscreen-root"></div>
4750
</AsideNavigation>
4851
);
@@ -58,6 +61,7 @@ function mapStateToProps(state) {
5861
isAuthenticated: state.authentication.isAuthenticated,
5962
internalUser: state.authentication.user,
6063
singleClusterMode: state.singleClusterMode,
64+
clusterName: state.cluster.data?.Name,
6165
};
6266
}
6367

src/containers/App/Content.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function Content(props) {
5959
};
6060
return (
6161
<React.Fragment>
62-
{!isClustersPage && <Header />}
62+
{!isClustersPage && <Header clusterName={props.clusterName} />}
6363
<main className={b('main')}>{renderRoute()}</main>
6464
<ReduxTooltip />
6565
<AppIcons />
@@ -70,6 +70,7 @@ export function Content(props) {
7070
Content.propTypes = {
7171
singleClusterMode: PropTypes.bool,
7272
children: PropTypes.node,
73+
clusterName: PropTypes.string,
7374
};
7475

7576
function ContentWrapper(props) {

src/containers/Header/Header.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ function ClusterName({name}: {name: string}) {
2626
);
2727
}
2828

29-
function Header() {
29+
interface HeaderProps {
30+
clusterName: string
31+
}
32+
33+
function Header({clusterName}: HeaderProps) {
3034
const dispatch = useDispatch();
3135
const {data: host}: {data: {ClusterName?: string}} = useSelector((state: any) => state.host);
3236
const {singleClusterMode, header}: {singleClusterMode: boolean; header: HeaderItemType[]} =
3337
useSelector((state: any) => state);
3438

35-
const clusterName: string = useSelector(
36-
(state: any) => state.cluster.data?.Name || state.clusterInfo?.title,
37-
);
38-
3939
const location = useLocation();
4040
const history = useHistory();
4141

0 commit comments

Comments
 (0)