mirror of
https://github.com/grafana/grafana.git
synced 2025-01-10 08:03:58 -06:00
Merge pull request #15943 from grafana/15429-removed-sass-var-in-js
Removed SASS variables being used in JS
This commit is contained in:
commit
ab2caf9ef9
@ -246,9 +246,4 @@ $external-services: (
|
||||
icon: '',
|
||||
),
|
||||
) !default;
|
||||
|
||||
:export {
|
||||
panelhorizontalpadding: $panel-horizontal-padding;
|
||||
panelverticalpadding: $panel-vertical-padding;
|
||||
}
|
||||
`;
|
||||
|
@ -62,6 +62,10 @@ const theme: GrafanaThemeCommons = {
|
||||
sm: '1px',
|
||||
},
|
||||
},
|
||||
panelPadding: {
|
||||
horizontal: 10,
|
||||
vertical: 5,
|
||||
},
|
||||
};
|
||||
|
||||
export default theme;
|
||||
|
@ -67,6 +67,10 @@ export interface GrafanaThemeCommons {
|
||||
sm: string;
|
||||
};
|
||||
};
|
||||
panelPadding: {
|
||||
horizontal: number;
|
||||
vertical: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GrafanaTheme extends GrafanaThemeCommons {
|
||||
|
@ -6,11 +6,6 @@ import { cleanUpDashboard } from '../state/actions';
|
||||
import { getNoPayloadActionCreatorMock, NoPayloadActionCreatorMock } from 'app/core/redux';
|
||||
import { DashboardRouteInfo, DashboardInitPhase } from 'app/types';
|
||||
|
||||
jest.mock('sass/_variables.generated.scss', () => ({
|
||||
panelhorizontalpadding: 10,
|
||||
panelVerticalPadding: 10,
|
||||
}));
|
||||
|
||||
jest.mock('app/features/dashboard/components/DashboardSettings/SettingsCtrl', () => ({}));
|
||||
|
||||
interface ScenarioContext {
|
||||
|
@ -1,10 +1,5 @@
|
||||
import { PanelChrome } from './PanelChrome';
|
||||
|
||||
jest.mock('sass/_variables.generated.scss', () => ({
|
||||
panelhorizontalpadding: 10,
|
||||
panelVerticalPadding: 10,
|
||||
}));
|
||||
|
||||
describe('PanelChrome', () => {
|
||||
let chrome: PanelChrome;
|
||||
|
||||
|
@ -14,6 +14,7 @@ import ErrorBoundary from '../../../core/components/ErrorBoundary/ErrorBoundary'
|
||||
import { applyPanelTimeOverrides, snapshotDataToPanelData } from 'app/features/dashboard/utils/panel';
|
||||
import { PANEL_HEADER_HEIGHT } from 'app/core/constants';
|
||||
import { profiler } from 'app/core/profiler';
|
||||
import config from 'app/core/config';
|
||||
|
||||
// Types
|
||||
import { DashboardModel, PanelModel } from '../state';
|
||||
@ -21,7 +22,6 @@ import { PanelPlugin } from 'app/types';
|
||||
import { DataQueryResponse, TimeRange, LoadingState, PanelData, DataQueryError } from '@grafana/ui';
|
||||
import { ScopedVars } from '@grafana/ui';
|
||||
|
||||
import variables from 'sass/_variables.generated.scss';
|
||||
import templateSrv from 'app/features/templating/template_srv';
|
||||
|
||||
const DEFAULT_PLUGIN_ERROR = 'Error in plugin';
|
||||
@ -160,8 +160,8 @@ export class PanelChrome extends PureComponent<Props, State> {
|
||||
panelData={panelData}
|
||||
timeRange={timeRange}
|
||||
options={panel.getOptions(plugin.exports.reactPanel.defaults)}
|
||||
width={width - 2 * variables.panelhorizontalpadding}
|
||||
height={height - PANEL_HEADER_HEIGHT - variables.panelverticalpadding}
|
||||
width={width - 2 * config.theme.panelPadding.horizontal}
|
||||
height={height - PANEL_HEADER_HEIGHT - config.theme.panelPadding.vertical}
|
||||
renderCounter={renderCounter}
|
||||
replaceVariables={this.replaceVariables}
|
||||
/>
|
||||
|
@ -249,8 +249,3 @@ $external-services: (
|
||||
icon: '',
|
||||
),
|
||||
) !default;
|
||||
|
||||
:export {
|
||||
panelhorizontalpadding: $panel-horizontal-padding;
|
||||
panelverticalpadding: $panel-vertical-padding;
|
||||
}
|
||||
|
8
public/sass/_variables.generated.scss.d.ts
vendored
8
public/sass/_variables.generated.scss.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
export interface GrafanaVariables {
|
||||
panelhorizontalpadding: number;
|
||||
panelverticalpadding: number;
|
||||
}
|
||||
|
||||
declare const variables: GrafanaVariables;
|
||||
|
||||
export default variables;
|
Loading…
Reference in New Issue
Block a user