@@ -23,7 +23,7 @@ import { MqInfo } from '../core/info/MqInfo'
2323import { alpha } from '@mui/material/styles'
2424import { bindActionCreators } from 'redux'
2525import { connect } from 'react-redux'
26- import { datasetFacetsStatus } from '../../helpers/nodes'
26+ import { datasetFacetsQualityAssertions , datasetFacetsStatus } from '../../helpers/nodes'
2727import {
2828 deleteDataset ,
2929 dialogToggle ,
@@ -38,16 +38,19 @@ import { formatUpdatedAt } from '../../helpers'
3838import { truncateText } from '../../helpers/text'
3939import { useNavigate , useSearchParams } from 'react-router-dom'
4040import { useTheme } from '@emotion/react'
41+ import Assertions from './Assertions'
4142import CloseIcon from '@mui/icons-material/Close'
4243import DatasetInfo from './DatasetInfo'
4344import DatasetTags from './DatasetTags'
4445import DatasetVersions from './DatasetVersions'
4546import Dialog from '../Dialog'
4647import IconButton from '@mui/material/IconButton'
4748import ListIcon from '@mui/icons-material/List'
49+ import MQTooltip from '../core/tooltip/MQTooltip'
4850import MqStatus from '../core/status/MqStatus'
4951import MqText from '../core/text/MqText'
5052import React , { ChangeEvent , FunctionComponent , useEffect , useState } from 'react'
53+ import RuleIcon from '@mui/icons-material/Rule'
5154import StorageIcon from '@mui/icons-material/Storage'
5255
5356interface StateProps {
@@ -143,6 +146,8 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
143146 const { name, tags, description } = firstVersion
144147 const facetsStatus = datasetFacetsStatus ( firstVersion . facets )
145148
149+ const assertions = datasetFacetsQualityAssertions ( firstVersion . facets )
150+
146151 return (
147152 < Box px = { 2 } >
148153 < Box
@@ -155,11 +160,6 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
155160 mb = { 2 }
156161 >
157162 < Box display = { 'flex' } alignItems = { 'center' } justifyContent = { 'space-between' } pb = { 2 } >
158- { facetsStatus && (
159- < Box mr = { 1 } >
160- < MqStatus label = { 'Quality' } color = { facetsStatus } />
161- </ Box >
162- ) }
163163 < Box display = { 'flex' } alignItems = { 'center' } >
164164 < Box >
165165 < Box display = { 'flex' } alignItems = { 'center' } >
@@ -224,27 +224,74 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
224224 </ Box >
225225 </ Box >
226226 < Grid container spacing = { 2 } >
227- < Grid item xs = { 4 } >
227+ < Grid item xs = { 6 } >
228228 < MqInfo
229229 icon = { < CalendarIcon color = { 'disabled' } /> }
230230 label = { 'Updated at' . toUpperCase ( ) }
231231 value = { formatUpdatedAt ( firstVersion . createdAt ) }
232232 />
233233 </ Grid >
234- < Grid item xs = { 4 } >
234+ < Grid item xs = { 6 } >
235235 < MqInfo
236236 icon = { < StorageIcon color = { 'disabled' } /> }
237237 label = { 'Dataset Type' . toUpperCase ( ) }
238238 value = { < MqText font = { 'mono' } > { firstVersion . type } </ MqText > }
239239 />
240240 </ Grid >
241- < Grid item xs = { 4 } >
241+ < Grid item xs = { 6 } >
242242 < MqInfo
243243 icon = { < ListIcon color = { 'disabled' } /> }
244244 label = { 'Fields' . toUpperCase ( ) }
245245 value = { `${ firstVersion . fields . length } columns` }
246246 />
247247 </ Grid >
248+ < Grid item xs = { 6 } >
249+ < MqInfo
250+ icon = { < RuleIcon color = { 'disabled' } /> }
251+ label = { 'Quality' . toUpperCase ( ) }
252+ value = {
253+ facetsStatus ? (
254+ < Box display = { 'flex' } >
255+ < MQTooltip
256+ title = {
257+ < Assertions
258+ assertions = { assertions . filter ( ( assertion ) => assertion . success ) }
259+ />
260+ }
261+ >
262+ < Box >
263+ < MqStatus
264+ label = { `${
265+ assertions . filter ( ( assertion ) => assertion . success ) . length
266+ } Passing`. toUpperCase ( ) }
267+ color = { theme . palette . primary . main }
268+ />
269+ </ Box >
270+ </ MQTooltip >
271+ < Divider sx = { { mx : 1 } } orientation = { 'vertical' } />
272+ < MQTooltip
273+ title = {
274+ < Assertions
275+ assertions = { assertions . filter ( ( assertion ) => ! assertion . success ) }
276+ />
277+ }
278+ >
279+ < Box >
280+ < MqStatus
281+ label = { `${
282+ assertions . filter ( ( assertion ) => ! assertion . success ) . length
283+ } Failing`. toUpperCase ( ) }
284+ color = { theme . palette . error . main }
285+ />
286+ </ Box >
287+ </ MQTooltip >
288+ </ Box >
289+ ) : (
290+ < MqStatus label = { 'N/A' } color = { theme . palette . secondary . main } />
291+ )
292+ }
293+ />
294+ </ Grid >
248295 </ Grid >
249296 < Divider sx = { { my : 2 } } />
250297 < Box display = { 'flex' } justifyContent = { 'space-between' } alignItems = { 'center' } >
0 commit comments