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

Move panel width/height calculation to PanelChrome

Dominik Prokop 7 лет назад
Родитель
Сommit
0c8f0416a0

+ 4 - 2
public/app/features/dashboard/dashgrid/PanelChrome.tsx

@@ -19,6 +19,8 @@ import { DashboardModel } from '../dashboard_model';
 import { PanelPlugin } from 'app/types';
 import { TimeRange } from '@grafana/ui';
 
+import variables from 'sass/_variables.scss';
+
 export interface Props {
   panel: PanelModel;
   dashboard: DashboardModel;
@@ -122,8 +124,8 @@ export class PanelChrome extends PureComponent<Props, State> {
                         timeSeries={timeSeries}
                         timeRange={timeRange}
                         options={panel.getOptions(plugin.exports.PanelDefaults)}
-                        width={width}
-                        height={height - PANEL_HEADER_HEIGHT}
+                        width={width - 2 * variables.panelHorizontalPadding }
+                        height={height - PANEL_HEADER_HEIGHT - variables.panelVerticalPadding}
                         renderCounter={renderCounter}
                       />
                     </div>

+ 2 - 3
public/app/plugins/panel/gauge/GaugePanel.tsx

@@ -3,7 +3,6 @@ import { GaugeOptions, PanelProps, NullValueMode } from '@grafana/ui';
 
 import { getTimeSeriesVMs } from 'app/viz/state/timeSeries';
 import Gauge from 'app/viz/Gauge';
-import variables from 'sass/_variables.scss';
 
 interface Props extends PanelProps<GaugeOptions> {}
 
@@ -20,8 +19,8 @@ export class GaugePanel extends PureComponent<Props> {
       <Gauge
         timeSeries={vmSeries}
         {...this.props.options}
-        width={width - 2 * variables.panelHorizontalPadding}
-        height={height - variables.panelVerticalPadding}
+        width={width}
+        height={height}
       />
     );
   }