Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSVB needs to display better UX message when default index pattern is non-time based #124341

Merged
merged 2 commits into from
Feb 8, 2022
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
10 changes: 10 additions & 0 deletions src/plugins/vis_types/timeseries/common/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ export class AggNotSupportedError extends UIError {
}
}

export class TimeFieldNotSpecifiedError extends UIError {
constructor() {
super(
i18n.translate('visTypeTimeseries.errors.timeFieldNotSpecifiedError', {
defaultMessage: 'Time field is required to visualize the data',
})
);
}
}

export const filterCannotBeAppliedErrorMessage = i18n.translate(
'visTypeTimeseries.filterCannotBeAppliedError',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import moment from 'moment';
import { AUTO_INTERVAL } from '../../../common/constants';
import { validateField } from '../../../common/fields_utils';
import { validateInterval } from '../../../common/validate_interval';
import { TimeFieldNotSpecifiedError } from '../../../common/errors';

import type { FetchedIndexPattern, Panel, Series } from '../../../common/types';

Expand All @@ -34,7 +35,11 @@ export function getIntervalAndTimefield(
}

if (panel.use_kibana_indexes) {
validateField(timeField!, index);
if (timeField) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

validateField(timeField, index);
} else {
throw new TimeFieldNotSpecifiedError();
}
}

let interval = panel.interval;
Expand Down