-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dcellar-web-ui): add dashboard module (#288)
* feat(dcellar-web-ui): add billing history * feat(dcellar-web-ui): add billing history * fix(dcellar-web-ui): fix some billint history issues * feat(dcellar-web-ui): add billing history * fix(dcellar-web-ui): fix some billint history issues * feat(dcellar-web-ui): migrate billing type to types * chore(dcellar-web-ui): remove log * feat(dcellar-web-ui): change the precision of billing history to 18 * fix(dcellar-web-ui): delete object format * feat(dcellar-web-ui): update filter type data * feat(dcellar-web-ui): add billing history * feat(dcellar-web-ui): add billing history * fix(dcellar-web-ui): fix some billint history issues * feat(dcellar-web-ui): migrate billing type to types * chore(dcellar-web-ui): remove log * feat(dcellar-web-ui): change the precision of billing history to 18 * fix(dcellar-web-ui): delete object format * feat(dcellar-web-ui): update filter type data * feat(dcellar-web-ui): add dashboard module * feat(dcellar-web-ui): add loading to dashboard * feat(dcellar-web-ui): add bucket chart and opt constants * fix(dcellar-web-ui): remove feature value in barchart hook * fix(dcellar-web-ui): fix bar chart y-axis * fix(dcellar-web-ui): fix invlid date and compatiable 429 * fix(dcellar-web-ui): set as nonrefundable button width * fix(dcellar-web-ui): mergeArr function error * fix(dcellar-web-ui): merge arr error * feat(dcellar-web-ui): enlargement upload limit to 100 (#286) * feat(dcellar-web-ui): enlargement upload limit to 100 * fix(dcellar-web-ui): upload tab z-index * feat(dcellar-web-ui): only one task can be signed before the upload task
- Loading branch information
Showing
82 changed files
with
1,292 additions
and
422 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
13 changes: 13 additions & 0 deletions
13
apps/dcellar-web-ui/src/components/charts/BarChart/index.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,13 @@ | ||
import { BaseChart, BaseChartProps } from '@/components/charts/BaseChart'; | ||
import { useBarChartOptions } from './useBarChartOptions'; | ||
|
||
export interface BarChartProps extends BaseChartProps { | ||
noData: boolean | ||
} | ||
|
||
export function BarChart({noData, ...props}: BarChartProps) { | ||
const { options, ...restProps } = props; | ||
const finalOptions = useBarChartOptions(options, noData); | ||
|
||
return <BaseChart options={finalOptions} {...restProps} />; | ||
} |
118 changes: 118 additions & 0 deletions
118
apps/dcellar-web-ui/src/components/charts/BarChart/useBarChartOptions.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,118 @@ | ||
import { useColorMode, useColorModeValue, useTheme } from '@totejs/uikit'; | ||
import { useEffect, useState } from 'react'; | ||
import { merge } from 'lodash-es'; | ||
import { cssVar } from '@/utils/common'; | ||
import { noDataOptions } from '@/constants/chart'; | ||
|
||
export function useBarChartOptions(options: any, noData: boolean) { | ||
const theme = useTheme(); | ||
const { colorMode } = useColorMode(); | ||
const colors = useColorModeValue(theme.colors.light, theme.colors.dark); | ||
|
||
const [finalOptions, setFinalOptions] = useState({}); | ||
|
||
useEffect(() => { | ||
if (colorMode !== document.documentElement.dataset.theme) { | ||
return; | ||
} | ||
if (noData) { | ||
return setFinalOptions(noDataOptions); | ||
} | ||
const defaultOptions = { | ||
title: { | ||
text: 'Cost Trend', | ||
textStyle: { | ||
color: cssVar('readable.normal'), | ||
fontSize: 16, | ||
fontWeight: 700, | ||
}, | ||
left: 0, | ||
padding: [5, 5, 5, 0], | ||
textAlign: 'left', | ||
}, | ||
tooltip: { | ||
trigger: 'axis', | ||
axisPointer: { | ||
type: 'shadow', | ||
}, | ||
}, | ||
grid: { | ||
containLabel: true, | ||
left: 'left', | ||
right: '0%', | ||
bottom: '0%', | ||
}, | ||
toolbox: { | ||
feature: { | ||
dataView: { show: false, readOnly: false }, | ||
restore: { show: false }, | ||
saveAsImage: { show: false }, | ||
}, | ||
}, | ||
legend: { | ||
icon: 'circle', | ||
itemHeight: 8, | ||
itemWidth: 8, | ||
itemGap: 16, | ||
right: 30, | ||
textStyle: { | ||
fontWeight: 400, | ||
}, | ||
}, | ||
xAxis: [{ | ||
type: 'category', | ||
axisTick: { | ||
show: true, | ||
alignWithLabel: true, | ||
lineStyle: { | ||
color: cssVar('bg.bottom'), | ||
}, | ||
}, | ||
axisLabel: { | ||
color: cssVar('readable.tertiary'), | ||
fontSize: 12, | ||
fontWeight: 500, | ||
margin: 16, | ||
lineHeight: 12, | ||
}, | ||
axisLine: { | ||
show: false, | ||
margin: 18, | ||
}, | ||
axisPointer: { | ||
lineStyle: { | ||
color: cssVar('readable.secondary'), | ||
type: 'solid', | ||
}, | ||
}, | ||
}], | ||
yAxis: [{ | ||
type: 'value', | ||
position: 'left', | ||
alignTicks: true, | ||
splitNumber: 5, | ||
axisLine: { | ||
show: false, | ||
}, | ||
axisLabel: { | ||
color: cssVar('readable.tertiary'), | ||
fontSize: 12, | ||
fontWeight: 500, | ||
}, | ||
splitLine: { | ||
lineStyle: { | ||
color: cssVar('bg.bottom'), | ||
}, | ||
}, | ||
}], | ||
series: [ | ||
], | ||
}; | ||
|
||
const finalOptions = merge(defaultOptions, options); | ||
|
||
setFinalOptions(finalOptions); | ||
}, [colors, options, colorMode, noData]); | ||
|
||
return finalOptions; | ||
} |
12 changes: 7 additions & 5 deletions
12
apps/dcellar-web-ui/src/components/charts/LineChart/index.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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { BaseChart, BaseChartProps } from '@/components/charts/BaseChart'; | ||
import { useLineChartOptions } from '@/components/charts/LineChart/useLineChartOptions'; | ||
|
||
export interface LineChartProps extends BaseChartProps {} | ||
export interface LineChartProps extends BaseChartProps { | ||
noData: boolean | ||
} | ||
|
||
export function LineChart(props: LineChartProps) { | ||
const { options } = props; | ||
const finalOptions = useLineChartOptions(options); | ||
export function LineChart({noData, ...props}: LineChartProps) { | ||
const { options, ...restProps } = props; | ||
const finalOptions = useLineChartOptions(options, noData); | ||
|
||
return <BaseChart options={finalOptions} />; | ||
return <BaseChart options={finalOptions} {...restProps} />; | ||
} |
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
Oops, something went wrong.