This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
[TES-6303] Update Test Run List table column and decorators #37
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bc0f2a9
Update column and data object
triquanminh 58580c2
Add new assets
triquanminh 61c1368
Remove unused code
triquanminh 57311c7
Remove unused code
triquanminh cf3ef84
Update decorator + add tooltip
triquanminh 08a2b3b
Add icons and links
triquanminh 583c60b
Update icons
triquanminh 5367fa0
Update icons
triquanminh 600cd1d
Handle N/A case for columns
triquanminh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 6 additions & 0 deletions
6
superset-frontend/src/assets/images/katalon/browser-safari.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions
11
superset-frontend/src/assets/images/katalon/status-failed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
superset-frontend/src/assets/images/katalon/status-importing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions
11
superset-frontend/src/assets/images/katalon/status-incomplete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions
11
superset-frontend/src/assets/images/katalon/status-passed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions
5
superset-frontend/src/assets/images/katalon/status-running.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
superset-frontend/src/assets/images/katalon/status-skipped.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
/* eslint-disable theme-colors/no-literal-colors */ | ||
|
||
import React from 'react'; | ||
import { DataRecord } from '@superset-ui/core'; | ||
import { makeStyles } from '@mui/styles'; | ||
Check failure on line 5 in superset-frontend/src/katalon/DataTable/TableChart.tsx GitHub Actions / frontend-build
|
||
import { DataGrid, GridColDef } from '@katalon-studio/katalon-ui/v2'; | ||
Check failure on line 6 in superset-frontend/src/katalon/DataTable/TableChart.tsx GitHub Actions / frontend-build
|
||
import { TableChartTransformedProps } from './types'; | ||
import { | ||
statusDecorator, | ||
IDDecorator, | ||
nameDecorator, | ||
profileDecorator, | ||
durationDecorator, | ||
environmentDecorator, | ||
timeStartedDecorator, | ||
testResultStatusDecorator, | ||
configurationDecorator, | ||
executorDecorator, | ||
} from './TestRunDecorators'; | ||
|
||
const useStyles = makeStyles(() => ({ | ||
tableHeader: { | ||
backgroundColor: '#f7f9fb', | ||
'& .MuiDataGrid-columnHeaderTitle': { | ||
color: '#46474d', | ||
fontSize: '11px', | ||
fontWeight: 700, | ||
}, | ||
}, | ||
lastColumnHeader: { | ||
backgroundColor: '#f7f9fb', | ||
width: '100%', | ||
'& .MuiDataGrid-columnHeaderTitle': { | ||
color: '#46474d', | ||
fontSize: '11px', | ||
fontWeight: 700, | ||
paddingRight: '16px', | ||
}, | ||
}, | ||
})); | ||
|
||
const PAGE_SIZE = 10; | ||
|
||
const parseJSON = (value: any) => { | ||
try { | ||
return JSON.parse(value); | ||
} catch (error) { | ||
console.error(error); | ||
return value; | ||
} | ||
}; | ||
|
||
const formatData = (data: any) => | ||
data.map((row: any) => { | ||
const { | ||
configuration, | ||
profile, | ||
environment, | ||
executor, | ||
test_result_status, | ||
run_configuration_name, | ||
test_suite_collection_name, | ||
test_suite_name, | ||
...rest | ||
} = row; | ||
|
||
const parsedConfiguration = parseJSON(configuration); | ||
const parsedProfile = parseJSON(profile); | ||
const parsedEnvironment = parseJSON(environment); | ||
const parsedExecutor = parseJSON(executor); | ||
const parsedTestResultStatus = parseJSON(test_result_status); | ||
|
||
let name: string[] = []; | ||
if (run_configuration_name) { | ||
name = parseJSON(run_configuration_name); | ||
} else if (test_suite_collection_name) { | ||
name = parseJSON(test_suite_collection_name); | ||
} else if (test_suite_name) { | ||
name = parseJSON(test_suite_name); | ||
} | ||
|
||
return { | ||
configuration: parsedConfiguration, | ||
profile: parsedProfile, | ||
environment: parsedEnvironment, | ||
name, | ||
executor: parsedExecutor, | ||
test_result_status: parsedTestResultStatus, | ||
...rest, | ||
}; | ||
}); | ||
|
||
export default function TableChart<D extends DataRecord = DataRecord>( | ||
props: TableChartTransformedProps<D>, | ||
) { | ||
// TODO: Only use the decorators for Test Run v2 dataset | ||
|
||
const classes = useStyles(); | ||
|
||
const { data } = props; | ||
|
||
const rows = formatData(data); | ||
|
||
const columns: GridColDef[] = [ | ||
{ | ||
field: 'status', | ||
headerName: 'STATUS', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i18n |
||
minWidth: 60, | ||
flex: 0.8, | ||
headerAlign: 'center', | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => statusDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'id', | ||
headerName: 'ID', | ||
minWidth: 80, | ||
flex: 0.7, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => IDDecorator(cell.value), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
{ | ||
field: 'name', | ||
headerName: 'NAME', | ||
minWidth: 320, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => nameDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'profile', | ||
headerName: 'PROFILE', | ||
minWidth: 150, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => profileDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'duration', | ||
headerName: 'DURATION', | ||
minWidth: 100, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => durationDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'environment', | ||
headerName: 'ENVIRONMENT', | ||
minWidth: 150, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => environmentDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'time_started', | ||
headerName: 'TIME STARTED', | ||
minWidth: 150, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => timeStartedDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'test_result_status', | ||
headerName: 'TEST RESULT STATUS', | ||
minWidth: 280, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => testResultStatusDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'configuration', | ||
headerName: 'CONFIGURATION', | ||
minWidth: 150, | ||
flex: 1, | ||
headerClassName: classes.tableHeader, | ||
renderCell: cell => configurationDecorator(cell.value), | ||
}, | ||
{ | ||
field: 'executor', | ||
headerName: 'EXECUTOR', | ||
minWidth: 200, | ||
flex: 1, | ||
headerClassName: classes.lastColumnHeader, | ||
renderCell: cell => executorDecorator(cell.value), | ||
}, | ||
]; | ||
|
||
return ( | ||
<DataGrid | ||
sx={{ | ||
fontFamily: 'Inter', | ||
'.MuiDataGrid-columnHeaderTitleContainer': { | ||
backgroundColor: '#f7f9fb', | ||
}, | ||
}} | ||
initialState={{ | ||
pagination: { paginationModel: { pageSize: PAGE_SIZE } }, | ||
}} | ||
rowHeight={42} | ||
columnHeaderHeight={42} | ||
rows={rows} | ||
columns={columns} | ||
pageSizeOptions={[PAGE_SIZE]} | ||
hideFooter={rows.length <= PAGE_SIZE} | ||
checkboxSelection | ||
disableRowSelectionOnClick | ||
/> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revamp to support decorators based on specific dataset.