Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export class MarkdownEditor extends Component {
}

render() {
const { visData, model, dateFormat } = this.props;
const { visData, model, getConfig } = this.props;

if (!visData) {
return null;
}

const dateFormat = getConfig('dateFormat');
const series = _.get(visData, `${model.id}.series`, []);
const variables = convertSeriesToVars(series, model, dateFormat, this.props.getConfig);
const rows = [];
Expand Down Expand Up @@ -214,6 +214,6 @@ export class MarkdownEditor extends Component {
MarkdownEditor.propTypes = {
onChange: PropTypes.func,
model: PropTypes.object,
dateFormat: PropTypes.string,
getConfig: PropTypes.func,
visData: PropTypes.object,
};
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ PanelConfig.propTypes = {
fields: PropTypes.object,
model: PropTypes.object,
onChange: PropTypes.func,
dateFormat: PropTypes.string,
visData$: PropTypes.object,
getConfig: PropTypes.func,
};
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ MarkdownPanelConfigUi.propTypes = {
fields: PropTypes.object,
model: PropTypes.object,
onChange: PropTypes.func,
dateFormat: PropTypes.string,
};

export const MarkdownPanelConfig = injectI18n(MarkdownPanelConfigUi);
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function TimeseriesVisualization({
if (VisComponent) {
return (
<VisComponent
dateFormat={getConfig('dateFormat')}
getConfig={getConfig}
model={model}
visData={visData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export class VisEditor extends Component {
fields={this.state.visFields}
model={model}
visData$={this.visData$}
dateFormat={this.props.config.get('dateFormat')}
onChange={this.handleChange}
getConfig={this.getConfig}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ export interface TimeseriesVisProps {
) => void;
uiState: PersistedState;
visData: TimeseriesVisData;
dateFormat: string;
getConfig: IUiSettingsClient['get'];
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import { isBackgroundInverted } from '../../../lib/set_is_reversed';
const getMarkdownId = (id) => `markdown-${id}`;

function MarkdownVisualization(props) {
const { backgroundColor, model, visData, dateFormat } = props;
const { backgroundColor, model, visData, getConfig } = props;
const series = get(visData, `${model.id}.series`, []);
const variables = convertSeriesToVars(series, model, dateFormat, props.getConfig);
const variables = convertSeriesToVars(series, model, getConfig('dateFormat'), props.getConfig);
const markdownElementId = getMarkdownId(uuid.v1());

const panelBackgroundColor = model.background_color || backgroundColor;
Expand Down Expand Up @@ -103,7 +103,6 @@ MarkdownVisualization.propTypes = {
onBrush: PropTypes.func,
onChange: PropTypes.func,
visData: PropTypes.object,
dateFormat: PropTypes.string,
getConfig: PropTypes.func,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@ class TimeseriesVisualization extends Component {
model: PropTypes.object,
onBrush: PropTypes.func,
visData: PropTypes.object,
dateFormat: PropTypes.string,
getConfig: PropTypes.func,
};

xAxisFormatter = (interval) => (val) => {
const scaledDataFormat = this.props.getConfig('dateFormat:scaled');
const { dateFormat } = this.props;
scaledDataFormat = this.props.getConfig('dateFormat:scaled');
dateFormat = this.props.getConfig('dateFormat');

if (!scaledDataFormat || !dateFormat) {
xAxisFormatter = (interval) => (val) => {
if (!this.scaledDataFormat || !this.dateFormat) {
return val;
}

const formatter = createXaxisFormatter(interval, scaledDataFormat, dateFormat);

const formatter = createXaxisFormatter(interval, this.scaledDataFormat, this.dateFormat);
return formatter(val);
};

Expand Down