-
Notifications
You must be signed in to change notification settings - Fork 1
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
[MIM-1947] Mim 1947 table export refactor #3073
Conversation
Add feature toggling for table export utils MIM-1947
…ad for security measures etc
…when useNewTableExport feature toggle is on
…display name for file name
…nto MIM-1947_table_export_refactor
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.
Jeg har ikke testet koden, men lest igjennom.
Har ikke så mange kommentarer, men noen. Fiks de du er enig i 😄
Edit: Fjernet spørsmål om hva som har skjedd med den gamle tableExport, ser at det er brukt featureToggle :)
@@ -56,7 +76,7 @@ function Table(props: TableProps) { | |||
} | |||
|
|||
function addDownloadTableDropdown(mobile: boolean) { | |||
if (props.downloadTableLabel && props.downloadTableTitle && props.downloadTableOptions) { | |||
if (downloadTableLabel && downloadTableTitle && downloadTableOptions) { |
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.
Vurder å bruk dette som en if-guard istedenfor.
if(!downloadTableLabel || !downloadTableTitle || !downloadTableOptions) {
return null;
}
if (showPreviewDraft) { | ||
if (fetchUnPublished && draftExist) { | ||
return <Alert variant='info'>Tallene i tabellen nedenfor er upublisert</Alert> | ||
} else if (fetchUnPublished && !props.draftExist) { | ||
} else if (fetchUnPublished && !draftExist) { | ||
return <Alert variant='warning'>Finnes ikke upubliserte tall for denne tabellen</Alert> | ||
} | ||
} |
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.
Her er fetchUnpublished brukt to ganger.
Vurder å skriv det om til:
if(showPreviewDraft && fetchUnpublished) {
return draftExists? <Alert.....> : <Alert.....>
}
return <Alert variant='warning'>Finnes ikke upubliserte tall for denne tabellen</Alert> | ||
} | ||
} | ||
return null | ||
} | ||
|
||
function renderSources() { | ||
if ((props.sourceListTables && props.sourceListTables.length > 0) || (props.sources && props.sources.length > 0)) { | ||
if ((sourceListTables && sourceListTables.length > 0) || (sources && sources.length > 0)) { |
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.
Vurder å konverter dette til en if-guard. Slik at den returnerer null ved det motsatte logiske utrykket. Da slipper vi å nøste så mye kode
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.
Jeg fikk ikke til dette helt med motsatt logiske utrykk men det gikk å forkorte det til
if (sourceListTables?.length || sources?.length)
heldigvis
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.
Very good 👍
More minor refactoring
c8e42a7
Quality Gate passedIssues Measures |
Jira Issues!
Link to ticket: MIM-1947