Skip to content

Commit 581f316

Browse files
committed
Simplification
1 parent eaa1f19 commit 581f316

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

dashboard/src/App.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ const PodInfoView = ({pod, namespace}) => (
1818
);
1919

2020
const OperatorsView = ({error, deployment, storage, pod, namespace}) => {
21-
const podInfoView = (<PodInfoView pod={pod} namespace={namespace}/>);
22-
if (deployment) {
23-
return (<DeploymentOperator podInfoView={podInfoView} error={error}/>);
24-
}
25-
if (storage) {
26-
return (<StorageOperator podInfoView={podInfoView} error={error}/>);
27-
}
28-
return (<NoOperator podInfoView={podInfoView} error={error}/>);
21+
let Operator = NoOperator;
22+
if (deployment)
23+
Operator = DeploymentOperator;
24+
else if (storage)
25+
Operator = StorageOperator;
26+
return (
27+
<Operator
28+
podInfoView={<PodInfoView pod={pod} namespace={namespace} />}
29+
error={error}
30+
/>
31+
);
2932
}
3033

3134
const LoadingView = () => (
@@ -55,7 +58,7 @@ class App extends Component {
5558
this.setState({
5659
error: e.message
5760
});
58-
if (sUnauthorized(e)) {
61+
if (isUnauthorized(e)) {
5962
this.props.doLogout();
6063
}
6164
}

0 commit comments

Comments
 (0)