Просмотр исходного кода

fix chart overview and manifests updating on revision change

Alexander Belanger 5 лет назад
Родитель
Сommit
8f92d2d3fc

+ 1 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -99,6 +99,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
       )
       )
       .then((res) => {
       .then((res) => {
         this.setState({ currentChart: res.data, loading: false }, () => {
         this.setState({ currentChart: res.data, loading: false }, () => {
+          this.updateResources();
           this.updateTabs();
           this.updateTabs();
         });
         });
       })
       })

+ 9 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/graph/GraphDisplay.tsx

@@ -8,6 +8,7 @@ import Edge from "./Edge";
 import InfoPanel from "./InfoPanel";
 import InfoPanel from "./InfoPanel";
 import ZoomPanel from "./ZoomPanel";
 import ZoomPanel from "./ZoomPanel";
 import SelectRegion from "./SelectRegion";
 import SelectRegion from "./SelectRegion";
+import _ from "lodash";
 
 
 const zoomConstant = 0.01;
 const zoomConstant = 0.01;
 const panConstant = 0.8;
 const panConstant = 0.8;
@@ -102,6 +103,7 @@ export default class GraphDisplay extends Component<PropsType, StateType> {
     );
     );
     let nodes = [] as NodeType[];
     let nodes = [] as NodeType[];
     let edges = [] as EdgeType[];
     let edges = [] as EdgeType[];
+
     if (!graph) {
     if (!graph) {
       nodes = this.createNodes(components);
       nodes = this.createNodes(components);
       edges = this.createEdges(components);
       edges = this.createEdges(components);
@@ -143,7 +145,7 @@ export default class GraphDisplay extends Component<PropsType, StateType> {
 
 
   // Live update on rollback/upgrade
   // Live update on rollback/upgrade
   componentDidUpdate(prevProps: PropsType) {
   componentDidUpdate(prevProps: PropsType) {
-    if (prevProps.components !== this.props.components) {
+    if (!(_.isEqual(prevProps.currentChart, this.props.currentChart))) {
       this.storeChartGraph(prevProps);
       this.storeChartGraph(prevProps);
       this.getChartGraph();
       this.getChartGraph();
     }
     }
@@ -243,7 +245,11 @@ export default class GraphDisplay extends Component<PropsType, StateType> {
   };
   };
 
 
   storeChartGraph = (props?: PropsType) => {
   storeChartGraph = (props?: PropsType) => {
+
     let useProps = props || this.props;
     let useProps = props || this.props;
+
+    console.log("STORE CHART GRAPH CALLED ON", useProps, props, this.props)
+
     let { currentChart } = useProps;
     let { currentChart } = useProps;
     let graph = JSON.parse(JSON.stringify(this.state));
     let graph = JSON.parse(JSON.stringify(this.state));
 
 
@@ -559,9 +565,9 @@ export default class GraphDisplay extends Component<PropsType, StateType> {
           showKindLabels={this.state.showKindLabels}
           showKindLabels={this.state.showKindLabels}
           isOpen={node === this.state.openedNode}
           isOpen={node === this.state.openedNode}
           // Parameterized to allow setting to null
           // Parameterized to allow setting to null
-          setCurrentNode={(node: NodeType) =>
+          setCurrentNode={(node: NodeType) => {
             this.setState({ currentNode: node })
             this.setState({ currentNode: node })
-          }
+          }}
         />
         />
       );
       );
     });
     });