@@ -45,6 +45,7 @@ const QuickValuesPlusVisualization = React.createClass({
4545 this . topValues = 5 ;
4646 this . dimension = this . quickValuesData . dimension ( ( d ) => d . term ) ;
4747 this . group = this . dimension . group ( ) . reduceSum ( ( d ) => d . count ) ;
48+ this . currentConfig = { } ;
4849
4950 return {
5051 total : undefined ,
@@ -59,9 +60,37 @@ const QuickValuesPlusVisualization = React.createClass({
5960 } else {
6061 this . sortOrder = d3 . ascending ;
6162 }
63+
64+ if ( this . props . config . dashboardID ) {
65+ this . setState ( {
66+ currentConfig : {
67+ dashboardID : this . props . config . dashboardID ,
68+ field : this . props . config . field ,
69+ query : this . props . config . query ,
70+ show_data_table : this . props . config . show_data_table ,
71+ show_pie_chart : this . props . config . show_pie_chart ,
72+ sort_order : this . props . config . sort_order ,
73+ stream_id : this . props . config . stream_id ,
74+ table_size : this . props . config . table_size ,
75+ timerange : this . props . config . timerange ,
76+ top_values : this . props . config . top_values ,
77+ }
78+ } ) ;
79+ } else {
80+ this . setState ( { currentConfig : {
81+ show_data_table : this . props . config . show_data_table ,
82+ show_pie_chart : this . props . config . show_pie_chart ,
83+ sort_order : this . props . config . sort_order ,
84+ table_size : this . props . config . table_size ,
85+ top_values : this . props . config . top_values ,
86+ }
87+ } ) ;
88+ }
89+
6290 this . tableChanged = false ;
6391 this . tableSize = this . props . config . table_size ;
6492 this . topValues = this . props . config . top_values ;
93+
6594 this . _resizeVisualization ( this . props . width , this . props . height , this . props . config . show_data_table ) ;
6695 this . _formatProps ( this . props ) ;
6796 this . _renderDataTable ( ) ;
@@ -83,10 +112,38 @@ const QuickValuesPlusVisualization = React.createClass({
83112 this . tableChanged = true ;
84113 this . tableSize = nextProps . config . table_size ;
85114 this . topValues = nextProps . config . top_values ;
115+
86116 this . _resizeVisualization ( nextProps . width , nextProps . height , nextProps . config . show_data_table ) ;
87117 this . _formatProps ( nextProps ) ;
88- this . _renderDataTable ( ) ;
89- this . _renderPieChart ( ) ;
118+
119+ if ( ! deepEqual ( this . state . currentConfig , nextProps . config ) ) {
120+ if ( this . props . config . dashboardID ) {
121+ this . setState ( { currentConfig : {
122+ dashboardID : nextProps . config . dashboardID ,
123+ field : nextProps . config . field ,
124+ query : nextProps . config . query ,
125+ show_data_table : nextProps . config . show_data_table ,
126+ show_pie_chart : nextProps . config . show_pie_chart ,
127+ sort_order : nextProps . config . sort_order ,
128+ stream_id : nextProps . config . stream_id ,
129+ table_size : nextProps . config . table_size ,
130+ timerange : nextProps . config . timerange ,
131+ top_values : nextProps . config . top_values ,
132+ }
133+ } ) ;
134+ } else {
135+ this . setState ( { currentConfig : {
136+ show_data_table : nextProps . config . show_data_table ,
137+ show_pie_chart : nextProps . config . show_pie_chart ,
138+ sort_order : nextProps . config . sort_order ,
139+ table_size : nextProps . config . table_size ,
140+ top_values : nextProps . config . top_values ,
141+ }
142+ } ) ;
143+ }
144+ this . _renderDataTable ( ) ;
145+ this . _renderPieChart ( ) ;
146+ }
90147 } ,
91148 NUMBER_OF_TOP_VALUES : 10 ,
92149 DEFAULT_PIE_CHART_SIZE : 200 ,
0 commit comments