Skip to content

Commit

Permalink
MWB-952: update xpath file table
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverBerserk committed Jan 17, 2025
1 parent fdf9af4 commit 861fdea
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import DialogContentText from "@mui/material/DialogContentText";

import {Scrollbar} from 'src/components/scrollbar';
import {useHighlighterTheme} from "src/hooks/use-highlighter-theme";
import TablePagination from "src/sections/components/table-pagination";
import TablePagination from "src/sections/components/table-pagination-pages";
import TableSorterHeader from "src/sections/components/table-sorter-header";
import {TableFilterHeader} from "../../../layouts/app/table-filter-header/table-filter-header";
import validationColor from '../mapping-package/state/validation-color';
import {ValueChip} from './utils';

export const ListTable = (props) => {
const [descriptionDialog, setDescriptionDialog] = useState({open: false, title: "", text: ""})
Expand Down Expand Up @@ -86,8 +88,7 @@ export const ListTable = (props) => {
<SorterHeader fieldName="xpath_condition"
title="XPath Condition"/>
</TableCell>
<TableCell width="10%"
align="right">
<TableCell width="10%">
<SorterHeader fieldName="is_covered"
title="Found"/>
</TableCell>
Expand All @@ -107,6 +108,7 @@ export const ListTable = (props) => {
language="xquery"
wrapLines
style={highLighterTheme}
customStyle={{borderRadius: 12, border: '1px solid #E4E7EC'}}
lineProps={{style: {wordBreak: 'break-all', whiteSpace: 'pre-wrap'}}}>
{item.sdk_element_xpath}
</SyntaxHighlighter>
Expand All @@ -119,36 +121,37 @@ export const ListTable = (props) => {
direction="column"
spacing={1}
>
<Stack
direction="row"
justifyContent="right"
alignItems="center"
spacing={2}
>
<SyntaxHighlighter
language="xquery"
wrapLines
style={highLighterTheme}
lineProps={{
style: {
wordBreak: 'break-all',
whiteSpace: 'pre-wrap'
}
}}>
{xpath_condition.xpath_condition || '-'}
</SyntaxHighlighter>
{xpath_condition.meets_xpath_condition ?
<CheckIcon color="success"/> :
<CloseIcon color="error"/>}
</Stack>
<SyntaxHighlighter
language="xquery"
wrapLines
style={highLighterTheme}
customStyle={{
borderRadius: 12,
border: '1px solid',
borderColor: validationColor(xpath_condition.meets_xpath_condition ?
'valid' : 'invalid')
}}
lineProps={{
style: {
wordBreak: 'break-all',
whiteSpace: 'pre-wrap'
}
}}>
{xpath_condition.xpath_condition || '-'}
</SyntaxHighlighter>
</Stack>
);
})}
</TableCell>
<TableCell align="right">
{item.is_covered
? <CheckIcon color="success"/>
: <CloseIcon color="error"/>}
<TableCell>
{item.is_covered ? <ValueChip color='success'
style={{p: 0.3, width: 30}}>
<CheckIcon/>
</ValueChip> :
<ValueChip color='error'
style={{p: 0.3, width: 30}}>
<CloseIcon/>
</ValueChip>}
</TableCell>
</TableRow>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {useEffect, useState} from "react";

import Card from '@mui/material/Card';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Unstable_Grid2';

import {TableLoadWrapper} from "./utils";
import {ListTable} from "./list-table-file";
import ResultSummaryCoverage from './result-summary-coverage';
import useItemsSearch from "../../../hooks/use-items-search";
import {mappingPackageStatesApi as sectionApi} from "../../../api/mapping-packages/states";
import useItemsSearch from "src/hooks/use-items-search";
import {mappingPackageStatesApi as sectionApi} from "src/api/mapping-packages/states";

const XpathValidationReportTest = ({sid, suiteId, testId, mappingSuiteIdentifier, handleExport}) => {
const [validationReport, setValidationReport] = useState([])
Expand Down Expand Up @@ -42,7 +42,7 @@ const XpathValidationReportTest = ({sid, suiteId, testId, mappingSuiteIdentifier
validationReport={validationReport}/>
</Grid>
<Grid xs={12}>
<Card>
<Paper>
<TableLoadWrapper dataState={dataState}
data={validationReport}>
<ListTable
Expand All @@ -59,7 +59,7 @@ const XpathValidationReportTest = ({sid, suiteId, testId, mappingSuiteIdentifier
sectionApi={sectionApi}
/>
</TableLoadWrapper>
</Card>
</Paper>
</Grid>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const XpathValidationReportSuite = ({sid, suiteId, mappingSuiteIdentifier, handl

useEffect(() => {
handleValidationReportsSuiteGet(sid, suiteId)
}, [suiteId])
}, [sid, suiteId])

const handleValidationReportsSuiteGet = (sid, suiteId) => {
setDataState({load: true, error: false})
Expand All @@ -32,9 +32,9 @@ const XpathValidationReportSuite = ({sid, suiteId, mappingSuiteIdentifier, handl
})
}

const itemsSearch = useItemsSearch(validationReport, sectionApi);
const itemsSearch = useItemsSearch(validationReport, sectionApi, [], {is_covered: ''});

const handleCoverageFilterChange = e => itemsSearch.handleFiltersChange({is_covered: e.target.value})
const handleCoverageFilterChange = e => itemsSearch.handleFiltersChange({is_covered: e})

const FILTER_VALUES = [{label: 'All', value: '', color: 'primary', count: validationReport.length},
{label: 'Covered', value: true, color: 'info', count: validationReport.filter(e => e.is_covered).length},
Expand Down

0 comments on commit 861fdea

Please sign in to comment.