-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom and dynamic columns in spreadsheet #2272
Conversation
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
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.
license-eye has totally checked 631 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
586 | 2 | 43 | 0 |
Click to see the invalid file list
- src/components/spreadsheet/custom-columns/custom-column-table.tsx
- src/components/spreadsheet/custom-columns/use-custom-column.ts
src/components/spreadsheet/custom-columns/custom-column-table.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
src/components/spreadsheet/custom-columns/columns-config-custom.tsx
Outdated
Show resolved
Hide resolved
src/components/spreadsheet/custom-columns/columns-config-custom.tsx
Outdated
Show resolved
Hide resolved
src/components/spreadsheet/custom-columns/columns-config-custom.tsx
Outdated
Show resolved
Hide resolved
src/components/spreadsheet/custom-columns/columns-config-custom.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
src/components/spreadsheet/custom-columns/columns-config-custom.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
c6554db
to
0035c25
Compare
src/components/spreadsheet/custom-columns/custom-columns-table.tsx
Outdated
Show resolved
Hide resolved
src/components/spreadsheet/custom-columns/custom-columns-table.tsx
Outdated
Show resolved
Hide resolved
src/components/spreadsheet/custom-columns/custom-columns-utils.tsx
Outdated
Show resolved
Hide resolved
const numberColumns = useStateNumber(0); | ||
const dialogOpen = useStateBoolean(false); | ||
const allDefinitions = useSelector((state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]]); |
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.
const numberColumns = useStateNumber(0); | |
const dialogOpen = useStateBoolean(false); | |
const allDefinitions = useSelector((state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]]); | |
const dialogOpen = useStateBoolean(false); | |
const customColumnsNumber = useSelector( | |
(state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]].columns.length | |
); |
We can do this directly, no ?
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.
I'm passing this value in the props and removed the useSelector in the child component
|
||
const { handleSubmit, reset } = formMethods; | ||
const dispatch = useDispatch<AppDispatch>(); | ||
const columnsDefinitions = useSelector((state: AppState) => state.allCustomColumnsDefinitions); |
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.
const columnsDefinitions = useSelector((state: AppState) => state.allCustomColumnsDefinitions); | |
const columnsDefinitions = useSelector( | |
(state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]]?.columns | |
); |
Also directly this ?
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.
Now it's retrieved from the props
Signed-off-by: TOURI ANIS <anis-1.touri@rte-france.com>
2941620
to
0a83c19
Compare
const numberColumns = useStateNumber(0); | ||
const dialogOpen = useStateBoolean(false); | ||
const customColumnsDefinitions = useSelector( | ||
(state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]] | ||
); | ||
|
||
useEffect(() => { | ||
numberColumns.setValue(customColumnsDefinitions.columns.length); | ||
}, [customColumnsDefinitions.columns.length, numberColumns]); | ||
|
||
return ( | ||
<> | ||
<Button color="inherit" onClick={dialogOpen.setTrue}> | ||
<FormattedMessage id="spreadsheet/custom_column/main_button" /> | ||
<Badge | ||
color="secondary" | ||
anchorOrigin={{ | ||
vertical: 'top', | ||
horizontal: 'left', | ||
}} | ||
badgeContent={numberColumns.value} | ||
> | ||
<CalculateIcon /> | ||
</Badge> | ||
</Button> | ||
<CustomColumnDialog | ||
indexTab={indexTab} | ||
open={dialogOpen} | ||
customColumnsDefinitions={customColumnsDefinitions.columns} | ||
/> | ||
</> |
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.
const numberColumns = useStateNumber(0); | |
const dialogOpen = useStateBoolean(false); | |
const customColumnsDefinitions = useSelector( | |
(state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]] | |
); | |
useEffect(() => { | |
numberColumns.setValue(customColumnsDefinitions.columns.length); | |
}, [customColumnsDefinitions.columns.length, numberColumns]); | |
return ( | |
<> | |
<Button color="inherit" onClick={dialogOpen.setTrue}> | |
<FormattedMessage id="spreadsheet/custom_column/main_button" /> | |
<Badge | |
color="secondary" | |
anchorOrigin={{ | |
vertical: 'top', | |
horizontal: 'left', | |
}} | |
badgeContent={numberColumns.value} | |
> | |
<CalculateIcon /> | |
</Badge> | |
</Button> | |
<CustomColumnDialog | |
indexTab={indexTab} | |
open={dialogOpen} | |
customColumnsDefinitions={customColumnsDefinitions.columns} | |
/> | |
</> | |
const dialogOpen = useStateBoolean(false); | |
const customColumnsDefinitions = useSelector( | |
(state: AppState) => state.allCustomColumnsDefinitions[TABLES_NAMES[indexTab]].columns | |
); | |
return ( | |
<> | |
<Button color="inherit" onClick={dialogOpen.setTrue}> | |
<FormattedMessage id="spreadsheet/custom_column/main_button" /> | |
<Badge | |
color="secondary" | |
anchorOrigin={{ | |
vertical: 'top', | |
horizontal: 'left', | |
}} | |
badgeContent={customColumnsDefinitions.length} | |
> | |
<CalculateIcon /> | |
</Badge> | |
</Button> | |
<CustomColumnDialog | |
indexTab={indexTab} | |
open={dialogOpen} | |
customColumnsDefinitions={customColumnsDefinitions} | |
/> | |
</> |
This can still be simplified
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.
done
headerName: colWithFormula.name, | ||
field: colWithFormula.name, | ||
numeric: true, | ||
cellRenderer: PropertiesCellRenderer, |
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.
Don't put any specific cellRenderer
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.
it won't have the same style as the others, and it won't be rounded like all the values in the spreadsheet
return makeAgGridCustomHeaderColumn({ | ||
headerName: colWithFormula.name, | ||
field: colWithFormula.name, | ||
numeric: true, |
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.
I think you can remove numeric, filterParams, cellDataType, cellRenderer for now because it can be several data types. We will improve that later on :)
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.
For cellRender, the same remark as above
Quality Gate passedIssues Measures |
No description provided.