Skip to content

Commit 6151120

Browse files
authored
Merge pull request #2510 from bcgov/fix/daniel-round-changelog-2446
Small Fixes and Improvements
2 parents 8f74c43 + 718c530 commit 6151120

File tree

8 files changed

+129
-274
lines changed

8 files changed

+129
-274
lines changed

backend/lcfs/web/api/compliance_report/services.py

+2
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ async def get_changelog_data(
738738
for group_uuid, versions in group_map.items():
739739
latest_version = max(versions.keys())
740740
latest_item = versions[latest_version]
741+
if hasattr(latest_item, "compliance_units"):
742+
latest_item.compliance_units = round(latest_item.compliance_units)
741743

742744
if latest_item.action_type == "DELETE":
743745
continue

frontend/src/components/BCDataGrid/columns.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { suppressKeyboardEvent } from '@/utils/grid/eventHandlers'
2-
import { ActionsRenderer2, ValidationRenderer2 } from './components'
2+
import { ActionsRenderer, ValidationRenderer2 } from './components'
33

44
export const validation = {
55
colId: 'validation',
@@ -20,7 +20,7 @@ export const validation = {
2020
export const actions = (props) => ({
2121
colId: 'action',
2222
headerName: 'Action',
23-
cellRenderer: ActionsRenderer2,
23+
cellRenderer: ActionsRenderer,
2424
cellRendererParams: props,
2525
pinned: 'left',
2626
maxWidth: 200,
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,32 @@
1-
import { IconButton, Tooltip, Stack } from '@mui/material'
2-
import {
3-
Edit,
4-
Delete,
5-
Save,
6-
Cancel,
7-
Queue,
8-
Warning,
9-
DoneAll
10-
} from '@mui/icons-material'
1+
import BCTypography from '@/components/BCTypography'
2+
import { Cancel, Delete, Edit, Queue, Replay } from '@mui/icons-material'
3+
import { Box, IconButton, Stack, Tooltip } from '@mui/material'
114

12-
export const ActionsRenderer = ({ onDuplicate, onDelete, ...props }) => {
5+
export const ActionsRenderer = (props) => {
136
const isCurrentRowEditing = props.api
147
.getEditingCells()
158
.some((cell) => cell.rowIndex === props.node.rowIndex)
169

1710
return (
18-
<Stack direction="row" spacing={0.1} m={0}>
11+
<Stack direction="row" spacing={0.1} m={0} mt={0.2}>
1912
{props.enableDuplicate && (
2013
<Tooltip title="duplicate">
21-
<IconButton
22-
aria-label="copy the data to new row"
23-
data-testid="duplicate-button"
24-
color="primary"
25-
onClick={() => {
26-
onDuplicate(props)
27-
}}
28-
>
29-
<Queue
30-
sx={{
31-
transform: 'scaleX(-1)'
32-
}}
33-
/>
34-
</IconButton>
35-
</Tooltip>
36-
)}
37-
{!props.data.isValid && props.data.modified && (
38-
<Tooltip title={props.data.validationMsg}>
39-
<IconButton
40-
aria-label="shows sign for validation"
41-
data-testid="validation-sign"
42-
>
43-
<Warning color="error" />
44-
</IconButton>
45-
</Tooltip>
46-
)}
47-
{props.data.isValid && isCurrentRowEditing && props.data.modified && (
48-
<Tooltip title={'validation success'}>
49-
<IconButton
50-
aria-label="shows sign for validation"
51-
data-testid="validation-sign"
52-
>
53-
<DoneAll color="success" />
54-
</IconButton>
14+
<span>
15+
<IconButton
16+
aria-label="copy the data to new row"
17+
data-testid="duplicate-button"
18+
data-action="duplicate"
19+
color="primary"
20+
disabled={props.data.validationStatus === 'error'}
21+
>
22+
<Queue
23+
style={{ pointerEvents: 'none' }}
24+
sx={{
25+
transform: 'scaleX(-1)'
26+
}}
27+
/>
28+
</IconButton>
29+
</span>
5530
</Tooltip>
5631
)}
5732
{props.enableEdit && !isCurrentRowEditing && (
@@ -71,31 +46,15 @@ export const ActionsRenderer = ({ onDuplicate, onDelete, ...props }) => {
7146
</IconButton>
7247
</Tooltip>
7348
)}
74-
{props.enableDelete && !isCurrentRowEditing && (
49+
{props.enableDelete && (
7550
<Tooltip title="Delete">
7651
<IconButton
7752
aria-label="delete row"
7853
data-testid="delete-button"
54+
data-action="delete"
7955
color="error"
80-
onClick={() => {
81-
onDelete(props)
82-
}}
83-
>
84-
<Delete />
85-
</IconButton>
86-
</Tooltip>
87-
)}
88-
{props.enableEdit && isCurrentRowEditing && (
89-
<Tooltip title="Save">
90-
<IconButton
91-
aria-label="save modified data"
92-
data-testid="save-button"
93-
color="success"
94-
onClick={() => {
95-
props.api.stopEditing(false)
96-
}}
9756
>
98-
<Save />
57+
<Delete style={{ pointerEvents: 'none' }} />
9958
</IconButton>
10059
</Tooltip>
10160
)}
@@ -113,7 +72,22 @@ export const ActionsRenderer = ({ onDuplicate, onDelete, ...props }) => {
11372
</IconButton>
11473
</Tooltip>
11574
)}
75+
{props.enableUndo && (
76+
<Tooltip title="Undo">
77+
<IconButton
78+
aria-label="undo row"
79+
data-testid="undo-button"
80+
data-action="undo"
81+
>
82+
<Replay style={{ pointerEvents: 'none' }} />
83+
</IconButton>
84+
</Tooltip>
85+
)}
86+
{props.enableStatus && (
87+
<Box alignItems="center" justifyContent="center" display="flex" m={0}>
88+
<BCTypography variant="body2">{props.enableStatus}</BCTypography>
89+
</Box>
90+
)}
11691
</Stack>
11792
)
11893
}
119-
ActionsRenderer.displayName = 'ActionsRenderer'

frontend/src/components/BCDataGrid/components/Renderers/ActionsRenderer2.jsx

-91
This file was deleted.

frontend/src/components/BCDataGrid/components/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ export { AsyncSuggestionEditor } from './Editors/AsyncSuggestionEditor'
22
export { AsyncValidationEditor } from './Editors/AsyncValidationEditor'
33
export { AutocompleteCellEditor } from './Editors/AutocompleteCellEditor'
44
export { DateEditor } from './Editors/DateEditor'
5-
export { ActionsRenderer } from './Renderers/ActionsRenderer'
6-
export { ActionsRenderer2 } from './Renderers/ActionsRenderer2'
5+
export { ActionsRenderer } from './Renderers/ActionsRenderer.jsx'
76
export { RequiredHeader } from './Renderers/RequiredHeader'
87
export { AccessibleHeader } from './Renderers/AccessibleHeader'
98
export { ValidationRenderer } from './Renderers/ValidationRenderer'

frontend/src/views/AllocationAgreements/_schema.jsx

-90
Original file line numberDiff line numberDiff line change
@@ -456,96 +456,6 @@ export const allocationAgreementColDefs = (
456456
}
457457
]
458458

459-
export const allocationAgreementSummaryColDefs = [
460-
{
461-
headerName: i18n.t(
462-
'allocationAgreement:allocationAgreementColLabels.allocationTransactionType'
463-
),
464-
field: 'allocationTransactionType',
465-
flex: 1,
466-
minWidth: 200
467-
},
468-
{
469-
headerName: i18n.t(
470-
'allocationAgreement:allocationAgreementColLabels.transactionPartner'
471-
),
472-
field: 'transactionPartner',
473-
flex: 1,
474-
minWidth: 200
475-
},
476-
{
477-
headerName: i18n.t(
478-
'allocationAgreement:allocationAgreementColLabels.postalAddress'
479-
),
480-
field: 'postalAddress',
481-
flex: 1,
482-
minWidth: 200
483-
},
484-
{
485-
headerName: i18n.t(
486-
'allocationAgreement:allocationAgreementColLabels.transactionPartnerEmail'
487-
),
488-
field: 'transactionPartnerEmail',
489-
flex: 1
490-
},
491-
{
492-
headerName: i18n.t(
493-
'allocationAgreement:allocationAgreementColLabels.transactionPartnerPhone'
494-
),
495-
field: 'transactionPartnerPhone',
496-
flex: 1
497-
},
498-
{
499-
headerName: i18n.t(
500-
'allocationAgreement:allocationAgreementColLabels.fuelType'
501-
),
502-
field: 'fuelType'
503-
},
504-
{
505-
headerName: i18n.t(
506-
'allocationAgreement:allocationAgreementColLabels.fuelTypeOther'
507-
),
508-
field: 'fuelTypeOther'
509-
},
510-
{
511-
headerName: i18n.t(
512-
'allocationAgreement:allocationAgreementColLabels.fuelCategory'
513-
),
514-
field: 'fuelCategory'
515-
},
516-
{
517-
headerName: i18n.t(
518-
'allocationAgreement:allocationAgreementColLabels.provisionOfTheAct'
519-
),
520-
field: 'provisionOfTheAct'
521-
},
522-
{
523-
headerName: i18n.t(
524-
'allocationAgreement:allocationAgreementColLabels.fuelCode'
525-
),
526-
field: 'fuelCode'
527-
},
528-
{
529-
headerName: i18n.t(
530-
'allocationAgreement:allocationAgreementColLabels.ciOfFuel'
531-
),
532-
field: 'ciOfFuel'
533-
},
534-
{
535-
headerName: i18n.t(
536-
'allocationAgreement:allocationAgreementColLabels.quantity'
537-
),
538-
field: 'quantity',
539-
valueFormatter
540-
},
541-
{
542-
headerName: i18n.t(
543-
'allocationAgreement:allocationAgreementColLabels.units'
544-
),
545-
field: 'units'
546-
}
547-
]
548-
549459
export const defaultColDef = {
550460
editable: true,
551461
resizable: true,

0 commit comments

Comments
 (0)