Skip to content

Commit 5bf77d5

Browse files
committed
feat: Decimal support Progress Table Cell Type h2oai#824
1 parent 7887ef6 commit 5bf77d5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ui/src/progress_table_cell_type.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as Fluent from '@fluentui/react'
16-
import { F, S } from './core'
16+
import { F, S, B } from './core'
1717
import React from 'react'
1818
import { stylesheet } from 'typestyle'
1919
import { ProgressArc } from './parts/progress_arc'
@@ -46,11 +46,17 @@ export interface ProgressTableCellType {
4646
name?: S
4747
}
4848

49-
export const XProgressTableCellType = ({ model: m, progress }: { model: ProgressTableCellType, progress: F }) => (
49+
export const XProgressTableCellType = ({ model: m, progress, decimals }: { model: ProgressTableCellType, progress: F, decimals?: B }) => (
5050
<div data-test={m.name} className={css.container}>
5151
<ProgressArc thickness={2} color={cssVar(m.color || '$red')} value={progress} />
5252
<Fluent.Stack horizontalAlign='center' verticalAlign='center' className={clas(css.percentContainer, 'wave-s12')}>
53-
<div className={css.percent}>{`${Math.round(progress * 100)}%`}</div>
53+
<div className={css.percent}>
54+
{decimals ? (
55+
`${Math.round(progress *10000)/ 100}%`
56+
) : (
57+
`${Math.round(progress * 100)}%`
58+
)}
59+
</div>
5460
</Fluent.Stack>
5561
</div >
5662
)

0 commit comments

Comments
 (0)