diff --git a/packages/cubejs-playground/src/components/RollupDesigner/RollupDesigner.tsx b/packages/cubejs-playground/src/components/RollupDesigner/RollupDesigner.tsx index 46ba943eea12..deef59ae5e2b 100644 --- a/packages/cubejs-playground/src/components/RollupDesigner/RollupDesigner.tsx +++ b/packages/cubejs-playground/src/components/RollupDesigner/RollupDesigner.tsx @@ -10,7 +10,6 @@ import { Divider, Input, notification, - Space, Tabs, Typography, } from 'antd'; @@ -228,7 +227,7 @@ export function RollupDesigner({ function handleSettingsChange(values) { const nextSettings: RollupSettings = {}; - if (values['refreshKey.option'] === 'every') { + if (values['refreshKey.checked.every']) { if (values['refreshKey.cron']) { nextSettings.refreshKey = { every: `\`${values['refreshKey.cron']}\``, @@ -238,11 +237,11 @@ export function RollupDesigner({ every: `\`${values['refreshKey.value']} ${values['refreshKey.granularity']}\``, }; } - } else if ( - values['refreshKey.option'] === 'sql' && - values['refreshKey.sql'] - ) { + } + + if (values['refreshKey.checked.sql'] && values['refreshKey.sql']) { nextSettings.refreshKey = { + ...nextSettings.refreshKey, sql: `\`${values['refreshKey.sql']}\``, }; } diff --git a/packages/cubejs-playground/src/components/RollupDesigner/components/Settings.tsx b/packages/cubejs-playground/src/components/RollupDesigner/components/Settings.tsx index 596610fdf43e..33b68de58bef 100644 --- a/packages/cubejs-playground/src/components/RollupDesigner/components/Settings.tsx +++ b/packages/cubejs-playground/src/components/RollupDesigner/components/Settings.tsx @@ -1,3 +1,4 @@ +import { QuestionCircleFilled } from '@ant-design/icons'; import { GRANULARITIES, TimeDimensionGranularity } from '@cubejs-client/core'; import { Card, @@ -11,11 +12,12 @@ import { Row, Select, Space, + Tooltip, Typography, } from 'antd'; +import { isValidCron } from 'cron-validator'; import { useMemo, useState } from 'react'; import styled from 'styled-components'; -import { isValidCron } from 'cron-validator'; import { Flex } from '../../../grid'; import { ucfirst } from '../../../shared/helpers'; @@ -27,11 +29,6 @@ const Wrapper = styled.div` flex-direction: column; `; -const StyledRadioGroup = styled(Radio.Group)` - font-size: initial; - display: block; -`; - const partionGranularities = GRANULARITIES.filter( ({ name }) => !['second', 'minute'].includes(name || '') ).map((granularity) => { @@ -84,7 +81,10 @@ export function Settings({ const [form] = Form.useForm(); const initialValues = { refreshKey: { - option: 'every', + checked: { + every: true, + sql: false, + }, sql: '', value: 1, granularity: 'day', @@ -155,94 +155,103 @@ export function Settings({ > - Refresh Key - - - - - - Every - - - - - - - - - + + Specify how often to refresh your pre-aggregated data + + + + + + Every + + + + + + + + - or - - { - if ( - value && - !isValidCron(value, { seconds: true }) - ) { - onCronExpressionValidityChange(false); - callback('Cron expression is invalid'); - } else { - onCronExpressionValidityChange(true); - } - }, - }, - ]} - > - - - - - - - - - SQL - - - - - - - - + + +
+ or +
+ + { + if (value && !isValidCron(value, { seconds: true })) { + onCronExpressionValidityChange(false); + callback('Cron expression is invalid'); + } else { + onCronExpressionValidityChange(true); + } + }, + }, + ]} + > + + +
+ +
- {/* + + - Automated Refresh - */} -
-
+ SQL + + + + + + + + + + + {/* + Automated Refresh + */}
{hasTimeDimension ? ( <> - - Partition Granularity - + + Partitions are shards of the pre-aggregation dataset. To enable + partitions, you must specify here the desired granularity. +