|
@@ -11,6 +11,7 @@ import NamespaceSelector from './NamespaceSelector';
|
|
|
import ExpandedChart from './expanded-chart/ExpandedChart';
|
|
import ExpandedChart from './expanded-chart/ExpandedChart';
|
|
|
|
|
|
|
|
type PropsType = {
|
|
type PropsType = {
|
|
|
|
|
+ currentCluster: string
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
type StateType = {
|
|
type StateType = {
|
|
@@ -24,9 +25,17 @@ export default class Dashboard extends Component<PropsType, StateType> {
|
|
|
currentChart: null as (ChartType | null)
|
|
currentChart: null as (ChartType | null)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ componentDidUpdate(prevProps: PropsType) {
|
|
|
|
|
+
|
|
|
|
|
+ // Reset namespace filter and close expanded chart on cluster change
|
|
|
|
|
+ if (prevProps.currentCluster !== this.props.currentCluster) {
|
|
|
|
|
+ this.setState({ namespace: '', currentChart: null });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Allows rollback to update the top-level chart
|
|
// Allows rollback to update the top-level chart
|
|
|
refreshChart = () => {
|
|
refreshChart = () => {
|
|
|
- let { currentCluster } = this.context;
|
|
|
|
|
|
|
+ let { currentCluster } = this.props;
|
|
|
api.getChart('<token>', {
|
|
api.getChart('<token>', {
|
|
|
namespace: this.state.namespace,
|
|
namespace: this.state.namespace,
|
|
|
context: currentCluster,
|
|
context: currentCluster,
|
|
@@ -41,7 +50,7 @@ export default class Dashboard extends Component<PropsType, StateType> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
renderContents = () => {
|
|
renderContents = () => {
|
|
|
- let { currentCluster } = this.context;
|
|
|
|
|
|
|
+ let { currentCluster } = this.props;
|
|
|
|
|
|
|
|
if (this.state.currentChart) {
|
|
if (this.state.currentChart) {
|
|
|
return (
|
|
return (
|