Add inclusive and exclusive for date start and end (#12859)

This commit is contained in:
Victor Malai
2021-02-04 08:55:02 +02:00
committed by GitHub
parent 137cf5d4d9
commit 77093a874e
2 changed files with 30 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import { SEPARATOR } from 'src/explore/dateFilterUtils';
import { Input } from 'src/common/components';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import { FrameComponentProps } from '../types';
import DateFunctionTooltip from './DateFunctionTooltip';
@@ -59,13 +60,25 @@ export function AdvancedFrame(props: FrameComponentProps) {
<i className="fa fa-info-circle text-muted" />
</DateFunctionTooltip>
</div>
<div className="control-label">{t('START')}</div>
<div className="control-label">
{t('START (INCLUSIVE)')}{' '}
<InfoTooltipWithTrigger
tooltip={t('Start date included in time range')}
placement="right"
/>
</div>
<Input
key="since"
value={since}
onChange={e => onChange('since', e.target.value)}
/>
<div className="control-label">{t('END')}</div>
<div className="control-label">
{t('END (EXCLUSIVE)')}{' '}
<InfoTooltipWithTrigger
tooltip={t('End date excluded from time range')}
placement="right"
/>
</div>
<Input
key="until"
value={until}

View File

@@ -23,6 +23,7 @@ import { isInteger } from 'lodash';
import { Col, DatePicker, InputNumber, Row } from 'src/common/components';
import { Radio } from 'src/common/components/Radio';
import { Select } from 'src/components/Select';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import {
SINCE_GRAIN_OPTIONS,
SINCE_MODE_OPTIONS,
@@ -110,7 +111,13 @@ export function CustomFrame(props: FrameComponentProps) {
<div className="section-title">{t('Configure custom time range')}</div>
<Row gutter={24}>
<Col span={12}>
<div className="control-label">{t('START')}</div>
<div className="control-label">
{t('START (INCLUSIVE)')}{' '}
<InfoTooltipWithTrigger
tooltip={t('Start date included in time range')}
placement="right"
/>
</div>
<Select
options={SINCE_MODE_OPTIONS}
value={SINCE_MODE_OPTIONS.filter(
@@ -162,7 +169,13 @@ export function CustomFrame(props: FrameComponentProps) {
)}
</Col>
<Col span={12}>
<div className="control-label">{t('END')}</div>
<div className="control-label">
{t('END (EXCLUSIVE)')}{' '}
<InfoTooltipWithTrigger
tooltip={t('End date excluded from time range')}
placement="right"
/>
</div>
<Select
options={UNTIL_MODE_OPTIONS}
value={UNTIL_MODE_OPTIONS.filter(