fix(explore): deprecated x periods pattern in new time picker value (#12552)

This commit is contained in:
Yongjie Zhao
2021-01-24 15:41:15 +08:00
committed by GitHub
parent 1f27b62d51
commit 9e58eb809e
6 changed files with 188 additions and 21 deletions

View File

@@ -197,16 +197,15 @@ export default function DateFilterControl(props: DateFilterLabelProps) {
+--------------+------+----------+--------+----------+-----------+
| | Last | Previous | Custom | Advanced | No Filter |
+--------------+------+----------+--------+----------+-----------+
| control pill | HRT | HRT | ADR | ADR | ADR |
| control pill | HRT | HRT | ADR | ADR | HRT |
+--------------+------+----------+--------+----------+-----------+
| tooltip | ADR | ADR | HRT | HRT | HRT |
| tooltip | ADR | ADR | HRT | HRT | ADR |
+--------------+------+----------+--------+----------+-----------+
*/
const valueToLower = value.toLowerCase();
if (
valueToLower.startsWith('last') ||
valueToLower.startsWith('next') ||
valueToLower.startsWith('previous')
frame === 'Common' ||
frame === 'Calendar' ||
frame === 'No filter'
) {
setActualTimeRange(value);
setTooltipTitle(actualRange || '');

View File

@@ -23,7 +23,11 @@ import { Input } from 'src/common/components';
import { FrameComponentProps } from '../types';
export function AdvancedFrame(props: FrameComponentProps) {
const [since, until] = getAdvancedRange(props.value || '').split(SEPARATOR);
const advancedRange = getAdvancedRange(props.value || '');
const [since, until] = advancedRange.split(SEPARATOR);
if (advancedRange !== props.value) {
props.onChange(getAdvancedRange(props.value || ''));
}
function getAdvancedRange(value: string): string {
if (value.includes(SEPARATOR)) {