Commit b3b1c21d by Dominik Prokop

Fixed Gauge being cropped when resizing panel

Enabled import of SASS viariables into TS
parent 9d4354b7
...@@ -3,6 +3,7 @@ import { GaugeOptions, PanelProps, NullValueMode } from '@grafana/ui'; ...@@ -3,6 +3,7 @@ import { GaugeOptions, PanelProps, NullValueMode } from '@grafana/ui';
import { getTimeSeriesVMs } from 'app/viz/state/timeSeries'; import { getTimeSeriesVMs } from 'app/viz/state/timeSeries';
import Gauge from 'app/viz/Gauge'; import Gauge from 'app/viz/Gauge';
import variables from 'sass/_variables.scss';
interface Props extends PanelProps<GaugeOptions> {} interface Props extends PanelProps<GaugeOptions> {}
...@@ -15,6 +16,13 @@ export class GaugePanel extends PureComponent<Props> { ...@@ -15,6 +16,13 @@ export class GaugePanel extends PureComponent<Props> {
nullValueMode: NullValueMode.Ignore, nullValueMode: NullValueMode.Ignore,
}); });
return <Gauge timeSeries={vmSeries} {...this.props.options} width={width} height={height} />; return (
<Gauge
timeSeries={vmSeries}
{...this.props.options}
width={width - 2 * variables.panelHorizontalPadding}
height={height - variables.panelVerticalPadding}
/>
);
} }
} }
...@@ -189,7 +189,9 @@ $side-menu-width: 60px; ...@@ -189,7 +189,9 @@ $side-menu-width: 60px;
// dashboard // dashboard
$panel-margin: 10px; $panel-margin: 10px;
$dashboard-padding: $panel-margin * 2; $dashboard-padding: $panel-margin * 2;
$panel-padding: 0px 10px 5px 10px; $panel-horizontal-padding: 10;
$panel-vertical-padding: 5;
$panel-padding: 0px $panel-horizontal-padding+0px $panel-vertical-padding+0px $panel-horizontal-padding+0px;
// tabs // tabs
$tabs-padding: 10px 15px 9px; $tabs-padding: 10px 15px 9px;
...@@ -202,3 +204,8 @@ $external-services: ( ...@@ -202,3 +204,8 @@ $external-services: (
oauth: (bgColor: #262628, borderColor: #393939, icon: '') oauth: (bgColor: #262628, borderColor: #393939, icon: '')
) )
!default; !default;
:export {
panelHorizontalPadding: $panel-horizontal-padding;
panelVerticalPadding: $panel-vertical-padding;
}
export interface GrafanaVariables {
'panelHorizontalPadding': number;
'panelVerticalPadding': number;
}
declare const variables: GrafanaVariables;
export default variables;
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
"pretty": true, "pretty": true,
"typeRoots": ["node_modules/@types", "types"], "typeRoots": ["node_modules/@types", "types"],
"paths": { "paths": {
"app": ["app"] "app": ["app"],
"sass": ["sass"]
} }
}, },
"include": ["public/app/**/*.ts", "public/app/**/*.tsx", "public/test/**/*.ts"] "include": ["public/app/**/*.ts", "public/app/**/*.tsx", "public/test/**/*.ts"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment