Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8242c0
commit b6fe69c
Showing
6 changed files
with
150 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...bejs-playground/src/components/PlaygroundQueryBuilder/components/PreAggregationStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import styled from 'styled-components'; | ||
import { Space, Typography } from 'antd'; | ||
import Icon from '@ant-design/icons'; | ||
|
||
import { formatNumber } from '../../../utils'; | ||
import { LightningIcon } from '../../../shared/icons/LightningIcon'; | ||
|
||
type PreAggregationStatusProps = { | ||
timeElapsed: number; | ||
isAggregated: boolean; | ||
}; | ||
|
||
const Badge = styled.div` | ||
display: flex; | ||
align-items: center; | ||
padding: 2px 4px; | ||
border-radius: 4px; | ||
background: var(--warning-bg-color); | ||
`; | ||
|
||
export function PreAggregationStatus({ | ||
timeElapsed, | ||
isAggregated, | ||
}: PreAggregationStatusProps) { | ||
const renderTime = () => ( | ||
<Typography.Text strong style={{ color: 'rgba(20, 20, 70, 0.85)' }}> | ||
{formatNumber(timeElapsed)} ms | ||
</Typography.Text> | ||
); | ||
|
||
return ( | ||
<Space style={{ marginLeft: 'auto' }}> | ||
{isAggregated ? ( | ||
<Badge> | ||
<Space size={4}> | ||
<Icon | ||
style={{ color: 'var(--warning-color)' }} | ||
component={() => <LightningIcon />} | ||
/> | ||
{renderTime()} | ||
</Space> | ||
</Badge> | ||
) : ( | ||
renderTime() | ||
)} | ||
|
||
{isAggregated ? ( | ||
<Typography.Text> | ||
Query was accelerated with pre-aggregation | ||
</Typography.Text> | ||
) : ( | ||
<Typography.Link | ||
href="https://cube.dev/docs/caching/pre-aggregations/getting-started" | ||
target="_blank" | ||
> | ||
Query was not accelerated with pre-aggregation {'->'} | ||
</Typography.Link> | ||
)} | ||
</Space> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/cubejs-playground/src/components/PlaygroundQueryBuilder/components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './PreAggregationStatus' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters